1 from HTMLComponent import *
2 from GUIComponent import *
4 from Pixmap import Pixmap
10 class BlinkingPixmap(GUIComponent, Pixmap):
16 GUIComponent.__init__(self)
18 self.state = self.SHOWN
21 self.setBlinkTime(500)
24 self.timer.timeout.get().append(self.blink)
27 def createWidget(self, parent):
28 return self.getePixmap(parent)
30 def removeWidget(self, w):
35 self.state = self.SHOWN
40 self.state = self.HIDDEN
43 def setBlinkTime(self, time):
47 if self.blinking == True:
48 if (self.state == self.SHOWN):
50 elif (self.state == self.HIDDEN):
53 def startBlinking(self):
55 self.timer.start(self.blinktime)
57 def stopBlinking(self):
59 if (self.state == self.SHOWN):
63 class BlinkingPixmapConditional(BlinkingPixmap):
65 BlinkingPixmap.__init__(self)
69 self.conditionCheckTimer = eTimer()
70 self.conditionCheckTimer.timeout.get().append(self.conditionallyBlink)
71 self.conditionCheckTimer.start(1000)
73 def setConnect(self, conditionalFunction):
74 self.conditionalFunction = conditionalFunction
76 def conditionallyBlink(self):
78 self.conditionalFunction() # check, if the conditionalfunction is still valid
80 self.conditionalFunction = None
83 if self.conditionalFunction != None:
84 if self.conditionalFunction(): # we shall blink
85 if self.blinking: # we are already blinking
87 else: # we don't blink
89 else: # we shall not blink
90 if self.blinking: # we are blinking
92 else: # we don't blink