2007-12-29 Douglas S. Blank <dblank@saliva.brynmawr.edu>

* src/DataViews/MyGrampsView.py: renamed background to main
	* src/plugins/DefaultGadgets.py: call main (generator)



svn: r9622
This commit is contained in:
Doug Blank 2007-12-29 11:49:15 +00:00
parent 3fadb9f213
commit 0fb8fad4ee
3 changed files with 10 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2007-12-29 Douglas S. Blank <dblank@saliva.brynmawr.edu>
* src/DataViews/MyGrampsView.py: renamed background to main
* src/plugins/DefaultGadgets.py: call main (generator)
2007-12-28 Douglas S. Blank <dblank@cs.brynmawr.edu> 2007-12-28 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/SameSurnames.py: new quick report for showing * src/plugins/SameSurnames.py: new quick report for showing
people with same surnames people with same surnames

View File

@ -174,10 +174,7 @@ class Gadget(object):
def init(self): # once, constructor def init(self): # once, constructor
pass pass
def main(self): # once per db open def main(self): # return false finishes
pass
def background(self): # return false finishes
""" """
Generator which will be run in the background. Generator which will be run in the background.
""" """
@ -254,12 +251,11 @@ class Gadget(object):
self.gui.data.append(text) self.gui.data.append(text)
def update(self, *handles): def update(self, *handles):
self.main()
if self._idle_id != 0: if self._idle_id != 0:
if debug: print "%s interrupt!" % self.gui.title if debug: print "%s interrupt!" % self.gui.title
self.interrupt() self.interrupt()
if debug: print "%s creating generator" % self.gui.title if debug: print "%s creating generator" % self.gui.title
self._generator = self.background() self._generator = self.main()
if debug: print "%s adding to gobject" % self.gui.title if debug: print "%s adding to gobject" % self.gui.title
self._idle_id = gobject.idle_add(self._updater, self._idle_id = gobject.idle_add(self._updater,
priority=gobject.PRIORITY_LOW) priority=gobject.PRIORITY_LOW)

View File

@ -36,10 +36,9 @@ import string
# init- run once, on construction # init- run once, on construction
# active_changed- run when active-changed is triggered # active_changed- run when active-changed is triggered
# db_changed- run when db-changed is triggered # db_changed- run when db-changed is triggered
# main- run once per db change, main process (for fast code) # main- run once per db change, main process (a generator)
# background- run once per db change, main process (for slow code)
# You can also call update() to run main and background # You can also call update() to run main
class CalendarGadget(Gadget): class CalendarGadget(Gadget):
def init(self): def init(self):
@ -63,7 +62,7 @@ class CalendarGadget(Gadget):
self.gui.calendar.mark_day(date[2]) self.gui.calendar.mark_day(date[2])
self.gui.calendar.thaw() self.gui.calendar.thaw()
def background(self): def main(self):
self.dates = {} self.dates = {}
# for each day in events # for each day in events
people = self.gui.dbstate.db.get_person_handles(sort_handles=False) people = self.gui.dbstate.db.get_person_handles(sort_handles=False)
@ -161,8 +160,6 @@ class TopSurnamesGadget(Gadget):
def main(self): def main(self):
self.set_text("Processing...\n") self.set_text("Processing...\n")
def background(self):
people = self.dbstate.db.get_person_handles(sort_handles=False) people = self.dbstate.db.get_person_handles(sort_handles=False)
surnames = {} surnames = {}
cnt = 0 cnt = 0
@ -209,7 +206,7 @@ class StatsGadget(Gadget):
def init(self): def init(self):
self.set_text("No Family Tree loaded.") self.set_text("No Family Tree loaded.")
def background(self): def main(self):
self.set_text("Processing...") self.set_text("Processing...")
database = self.dbstate.db database = self.dbstate.db
personList = database.get_person_handles(sort_handles=False) personList = database.get_person_handles(sort_handles=False)