self.timer.timeout.get().append(self.timerTick)
self.onExecBegin.append(self.startTimer)
self.origTitle = None
- try:
- if self.instance and self.instance.isVisible():
- self.timerTick()
- else:
- self.onShown.append(self.timerTick)
- except AttributeError:
- self.onShown.append(self.timerTick)
+ if self.execing:
+ self.timerTick()
+ else:
+ self.onShown.append(self.__onShown)
self.timerRunning = True
else:
self.timerRunning = False
+ def __onShown(self):
+ self.onShown.remove(self.__onShown)
+ self.timerTick()
+
def startTimer(self):
self.timer.start(1000)
if self.timerRunning:
del self.timer
self.setTitle(self.origTitle)
- self.onShown.remove(self.timerTick)
+ self.timerRunning = False
def timerTick(self):
if self.execing:
def move(self, direction):
if self.close_on_any_key:
self.close(True)
-
self["list"].instance.moveSelection(direction)
- if self.timerRunning:
- self.timer.stop()
- self.setTitle(self.origTitle)
- self.timerRunning = False
+ self.stopTimer()
def __repr__(self):
return str(type(self)) + "(" + self.text + ")"