Refinements on statusbar update; only updated when really necessary; fixed bug in updating when db is closed

svn: r14141
This commit is contained in:
Doug Blank 2010-01-26 13:38:05 +00:00
parent e7c5d7a207
commit 81bb97e2df
2 changed files with 13 additions and 3 deletions

View File

@ -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):

View File

@ -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):
"""