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):
20 class PixmapConditional(ConditionalWidget, Pixmap):
21 def __init__(self, withTimer = True):
22 ConditionalWidget.__init__(self)
25 class MovingPixmap(Pixmap):
31 # TODO: get real values
37 self.moveTimer = eTimer()
38 self.moveTimer.timeout.get().append(self.doMove)
40 def clearPath(self, repeated = False):
47 self.repeated = repeated
49 def addMovePoint(self, x, y, time = 20):
50 self.path.append((x, y, time))
52 def moveTo(self, x, y, time = 20):
54 self.addMovePoint(x, y, time)
56 def startMoving(self):
58 self.time = self.path[self.currDest][2]
59 self.stepX = (self.path[self.currDest][0] - self.x) / float(self.time)
60 self.stepY = (self.path[self.currDest][1] - self.y) / float(self.time)
63 self.moveTimer.start(100)
74 self.move(int(self.x), int(self.y))
75 except: # moving not possible... widget not there any more... stop moving
82 if (self.currDest >= len(self.path)): # end of path