2 from GUIComponent import *
6 class Widget(GUIComponent):
12 GUIComponent.__init__(self)
14 self.state = self.SHOWN
16 def GUIcreate(self, parent):
17 self.instance = self.createWidget(parent)
20 self.removeWidget(self.instance)
23 def removeWidget(self, w):
27 self.state = self.SHOWN
31 self.state = self.HIDDEN
34 def removeWidget(self, instance):
37 class ConditionalWidget(Widget):
38 def __init__(self, withTimer = True):
44 self.conditionCheckTimer = eTimer()
45 self.conditionCheckTimer.timeout.get().append(self.update)
46 self.conditionCheckTimer.start(1000)
48 def setConnect(self, conditionalFunction):
49 self.conditionalFunction = conditionalFunction
51 def activateCondition(self, condition):
53 if (self.state == self.HIDDEN):
56 if (self.state == self.SHOWN):
60 if (self.conditionalFunction != None):
62 self.conditionalFunction() # check, if the conditionalfunction is still valid
64 self.conditionalFunction = None
65 self.activateCondition(False)
67 self.activateCondition(self.conditionalFunction())