fix imports
[enigma2.git] / lib / python / Screens / MessageBox.py
index 6c7bdd3c620f5af8cba0b275e6b95deb77b6c342..0133de2a5038e1ebc9086b63375c6a541b901f6a 100644 (file)
@@ -1,10 +1,9 @@
 from Screen import Screen
 from Components.ActionMap import ActionMap
 from Components.Label import Label
-from Components.Button import Button
 from Components.Pixmap import Pixmap
 from Components.MenuList import MenuList
-from enigma import eSize, ePoint, eTimer
+from enigma import eTimer
 
 class MessageBox(Screen):
        TYPE_YESNO = 0
@@ -62,17 +61,18 @@ class MessageBox(Screen):
                        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)
 
@@ -80,7 +80,7 @@ class MessageBox(Screen):
                if self.timerRunning:
                        del self.timer
                        self.setTitle(self.origTitle)
-                       self.onShown.remove(self.timerTick)
+                       self.timerRunning = False
 
        def timerTick(self):
                if self.execing: