Author: dmeyer
Date: Mon Jan 22 14:58:13 2007
New Revision: 9038

Modified:
   trunk/ui/src/image/viewer.py

Log:
small bugfixes in event/signal handling

Modified: trunk/ui/src/image/viewer.py
==============================================================================
--- trunk/ui/src/image/viewer.py        (original)
+++ trunk/ui/src/image/viewer.py        Mon Jan 22 14:58:13 2007
@@ -92,16 +92,15 @@
         self.filename    = None
         self.rotation    = None
         self.zomm        = None
-        self.sshow_timer = kaa.notifier.OneShotTimer(self.signalhandler)
+        self.sshow_timer = kaa.notifier.OneShotTimer(self._next)
+        self.signals['stop'].connect_weak(self._cleanup)
 
 
-    def hide_app(self):
+    def _cleanup(self):
         """
-        Hide the viewer. This clears the cache and removes the application
-        from the eventhandler stack. It is still possible to show() this
-        object again.
+        Application not running anymore, free cache and remove items
+        from the screen.
         """
-        Application.hide_app(self)
         if self.last_image:
             self.last_image.unparent()
         self.last_image = None
@@ -123,6 +122,15 @@
         self.bitmapcache = ObjectCache(3, desc='viewer')
 
 
+    def _next(self):
+        """
+        Send PLAY_END to show next image.
+        """
+        event = Event(PLAY_END, self.item)
+        event.set_handler(self.eventhandler)
+        event.post()
+
+
     def view(self, item, zoom=0, rotation=0):
         """
         Show the image
@@ -287,6 +295,9 @@
         """
         Stop the current viewing
         """
+        if self.get_status() != STATUS_RUNNING:
+            # already stopped
+            return True
         # set status to stopping
         self.status = STATUS_STOPPING
         event = Event(PLAY_END, self.item)
@@ -304,16 +315,6 @@
             self.bitmapcache[item.filename] = image
 
 
-    def signalhandler(self):
-        """
-        This signalhandler is called for slideshows when
-        the duration is over.
-        """
-        self.hide()
-        self.stop()
-        return False
-
-
     def eventhandler(self, event):
         """
         Handle incoming events

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to