1 from ConditionalWidget import *
9 def getePixmap(self, parent):
10 #pixmap = ePixmap(parent)
11 #pixmap.setPixmapFromFile(self.filename)
12 return ePixmap(parent)
14 def createWidget(self, parent):
15 return self.getePixmap(parent)
17 def removeWidget(self, w):
21 self.instance.move(ePoint(int(x), int(y)))
23 class PixmapConditional(ConditionalWidget, Pixmap):
24 def __init__(self, withTimer = True):
25 ConditionalWidget.__init__(self)
28 class MovingPixmap(Pixmap):
34 # TODO: get real values
40 self.moveTimer = eTimer()
41 self.moveTimer.timeout.get().append(self.doMove)
43 def clearPath(self, repeated = False):
50 self.repeated = repeated
52 def addMovePoint(self, x, y, time = 20):
53 self.path.append((x, y, time))
55 def moveTo(self, x, y, time = 20):
57 self.addMovePoint(x, y, time)
59 def startMoving(self):
61 self.time = self.path[self.currDest][2]
62 self.stepX = (self.path[self.currDest][0] - self.x) / float(self.time)
63 self.stepY = (self.path[self.currDest][1] - self.y) / float(self.time)
66 self.moveTimer.start(100)
77 self.move(int(self.x), int(self.y))
78 except: # moving not possible... widget not there any more... stop moving
85 if (self.currDest >= len(self.path)): # end of path