Author: esr
Date: Sat Oct 18 06:49:11 2008
New Revision: 30242

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30242&view=rev
Log:
trackplacer: factor out the flush() function for cleaner animation.

Modified:
    trunk/data/tools/trackplacer

Modified: trunk/data/tools/trackplacer
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/trackplacer?rev=30242&r1=30241&r2=30242&view=diff
==============================================================================
--- trunk/data/tools/trackplacer (original)
+++ trunk/data/tools/trackplacer Sat Oct 18 06:49:11 2008
@@ -674,6 +674,12 @@
         self.pixmap.draw_pixbuf(self.default_gc, icon, 0, 0, *rect)
         widget.queue_draw_area(*rect)
 
+    def flush(self, widget):
+        "Force pending events out."
+        self.expose_event(widget)
+        while gtk.events_pending():
+            gtk.main_iteration(False)
+
     def redraw(self, widget, delay=0):
         "Redraw the map and tracks."
         self.refresh_map()
@@ -686,6 +692,7 @@
                     self.draw_feature(widget, item, False)
                     if delay:
                         time.sleep(delay)
+                        self.flush(widget)
         for id in self.journey.track_order:
             track = self.journey.tracks[id]
             if id in self.visible_set and id == self.journey.selected_id:
@@ -693,9 +700,8 @@
                     self.draw_feature(widget, item, True)
                     if delay:
                         time.sleep(delay)
-        self.expose_event(widget)
-        while gtk.events_pending():
-            gtk.main_iteration(False)
+                        self.flush(widget)
+        self.flush(widget)
 
     def configure_event(self, widget, event):
         "Create a new backing pixmap of the appropriate size."


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to