2 from GUIComponent import *
6 class Pixmap(GUIComponent):
7 """Pixmap can be used for components which diplay a pixmap"""
13 GUIComponent.__init__(self)
15 self.state = self.SHOWN
17 def GUIcreate(self, parent):
18 self.instance = self.createWidget(parent)
21 self.removeWidget(self.instance)
24 def getePixmap(self, parent):
25 #pixmap = ePixmap(parent)
26 #pixmap.setPixmapFromFile(self.filename)
27 return ePixmap(parent)
29 def createWidget(self, parent):
30 return self.getePixmap(parent)
32 def removeWidget(self, w):
37 self.state = self.SHOWN
42 self.state = self.HIDDEN
45 def removeWidget(self, instance):
48 class PixmapConditional(Pixmap):
49 def __init__(self, withTimer = True):
55 self.conditionCheckTimer = eTimer()
56 self.conditionCheckTimer.timeout.get().append(self.update)
57 self.conditionCheckTimer.start(1000)
59 def setConnect(self, conditionalFunction):
60 self.conditionalFunction = conditionalFunction
62 def activateCondition(self, condition):
64 if (self.state == self.HIDDEN):
67 if (self.state == self.SHOWN):
71 if (self.conditionalFunction != None):
73 self.conditionalFunction() # check, if the conditionalfunction is still valid
75 self.conditionalFunction = None
76 self.activateCondition(False)
78 self.activateCondition(self.conditionalFunction())