From 81bb97e2df8b1fab1ebb0e02bd6a6e50595683c4 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 26 Jan 2010 13:38:05 +0000 Subject: [PATCH] Refinements on statusbar update; only updated when really necessary; fixed bug in updating when db is closed svn: r14141 --- src/gen/plug/_gramplet.py | 13 +++++++++++-- src/plugins/view/grampletview.py | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gen/plug/_gramplet.py b/src/gen/plug/_gramplet.py index e17adbbe1..75dad10a2 100644 --- a/src/gen/plug/_gramplet.py +++ b/src/gen/plug/_gramplet.py @@ -265,12 +265,13 @@ class Gramplet(object): """ import gobject if ((not self.active or - self.gui.state in ["closed", "minimized"]) and + self.gui.state in ["closed", "minimized"] or + not self.dbstate.open) and not self.gui.force_update): self.dirty = True #print " %s is not active" % self.gui.title return - #print " %s is UPDATING" % self.gui.title + #print " %s is UPDATING" % self.gui.title self.dirty = False self.uistate.push_message(self.dbstate, _("Gramplet %s is running") % self.gui.title) @@ -287,16 +288,22 @@ class Gramplet(object): """ if not isinstance(self._generator, types.GeneratorType): self._idle_id = 0 + self.uistate.push_message(self.dbstate, + _("Gramplet %s updated") % self.gui.title) return False try: retval = self._generator.next() if not retval: self._idle_id = 0 if self._pause: + self.uistate.push_message(self.dbstate, + _("Gramplet %s updated") % self.gui.title) return False return retval except StopIteration: self._idle_id = 0 + self.uistate.push_message(self.dbstate, + _("Gramplet %s updated") % self.gui.title) return False except Exception, e: import traceback @@ -304,6 +311,8 @@ class Gramplet(object): traceback.print_exc() print "Continuing after gramplet error..." self._idle_id = 0 + self.uistate.push_message(self.dbstate, + _("Gramplet %s caused an error") % self.gui.title) return False def pause(self, *args): diff --git a/src/plugins/view/grampletview.py b/src/plugins/view/grampletview.py index f5aa6a755..bc7e0c9a5 100644 --- a/src/plugins/view/grampletview.py +++ b/src/plugins/view/grampletview.py @@ -422,7 +422,8 @@ class GuiGramplet(object): padding, pack) if oldstate is "minimized" and self.pui: - self.pui.update() + if self.pui.dirty: + self.pui.update() def change_state(self, obj): """