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):
36 self.state = self.SHOWN
40 self.state = self.HIDDEN
43 def removeWidget(self, instance):
46 class PixmapConditional(Pixmap):
47 def __init__(self, withTimer = True):
53 self.conditionCheckTimer = eTimer()
54 self.conditionCheckTimer.timeout.get().append(self.update)
55 self.conditionCheckTimer.start(1000)
57 def setConnect(self, conditionalFunction):
58 self.conditionalFunction = conditionalFunction
60 def activateCondition(self, condition):
62 if (self.state == self.HIDDEN):
65 if (self.state == self.SHOWN):
69 if (self.conditionalFunction != None):
71 self.conditionalFunction() # check, if the conditionalfunction is still valid
73 self.conditionalFunction = None
74 self.activateCondition(False)
76 self.activateCondition(self.conditionalFunction())