better fix for #5785
authorRyan Campbell <campbellr@gmail.com>
Sat, 22 May 2010 05:31:41 +0000 (23:31 -0600)
committerRyan Campbell <campbellr@gmail.com>
Sat, 22 May 2010 05:31:41 +0000 (23:31 -0600)
package/debian/changelog
package/debian/files
package/src/ui/diablo/gui.py
package/src/ui/fremantle/gui.py

index 3ca835e..d91b608 100644 (file)
@@ -1,4 +1,4 @@
-mevemon (0.4-2) stable; urgency=low
+mevemon (0.4-3) stable; urgency=low
 
     * Fix bug #5785
     * Format numbers with commas
index 6868321..c8bb54c 100644 (file)
@@ -1 +1 @@
-mevemon_0.4-2_all.deb user/utilities extra
+mevemon_0.4-3_all.deb user/utilities extra
index 01a00a6..366710b 100644 (file)
@@ -371,7 +371,12 @@ class CharacterSheetUI(BaseUI):
         progress_bar.set_fraction(1)
         progress_bar.destroy()
 
-        glib.timeout_add_seconds(self.UPDATE_INTERVAL, self.update_live_sp)
+        self.timer = glib.timeout_add_seconds(self.UPDATE_INTERVAL, self.update_live_sp)
+        self.win.connect("destroy", self.back)
+
+        def back(self, widget):
+            glib.source_remove(self.timer)
+            gtk.Window.destroy(self.win)
 
     def display_skill_in_training(self, vbox):
         skill = self.controller.get_skill_in_training(self.uid, self.char_id)
@@ -469,14 +474,6 @@ class CharacterSheetUI(BaseUI):
 
 
     def update_live_sp(self):
-        # we don't want to keep the timer running in the background
-        # when this callback returns False, the timer destorys itself
-       
-        # TODO: figure out why this doesn't work on the real device
-        #
-        #if not self.win.get_is_topmost():
-        #    return False
-        
         self.live_sp_val = self.live_sp_val + self.spps * self.UPDATE_INTERVAL
         self.live_sp.set_label("<small><b>Total SP:</b> %s</small>" %
                                 util.comma(int(self.live_sp_val)))
index e887ded..ff63dad 100644 (file)
@@ -374,7 +374,14 @@ class CharacterSheetUI(BaseUI):
         hildon.hildon_gtk_window_set_progress_indicator(self.win, 0)
         
         # if we start the timer too early, get_is_topmost() returns False
-        glib.timeout_add_seconds(self.UPDATE_INTERVAL, self.update_live_sp)
+        self.timer = glib.timeout_add_seconds(self.UPDATE_INTERVAL, self.update_live_sp)
+
+        self.win.connect("destroy", self.back)
+
+    def back(self, widget):
+        glib.source_remove(self.timer)
+        gtk.Window.destroy(self.win)
+
 
     def display_skill_in_training(self, vbox):
         skill = self.controller.get_skill_in_training(self.uid, self.char_id)
@@ -471,14 +478,7 @@ class CharacterSheetUI(BaseUI):
 
 
     def update_live_sp(self):
-        # we don't want to keep the timer running in the background
-        # when this callback returns False, the timer destorys itself
-        
-        # TODO: figure out why this doesn't work on the real device
-        #
-        #if not self.win.get_is_topmost():
-        #    return False
-        
+        print 'tick'
         self.live_sp_val = self.live_sp_val + self.spps * self.UPDATE_INTERVAL
         self.live_sp.set_label("<small><b>Total SP:</b> %s</small>" %
                                 util.comma(int(self.live_sp_val)))