diff --git a/src/DataViews/MyGrampsView.py b/src/DataViews/MyGrampsView.py index 09304d9dd..9dc346989 100644 --- a/src/DataViews/MyGrampsView.py +++ b/src/DataViews/MyGrampsView.py @@ -250,7 +250,7 @@ class Gadget(object): text = text.replace(chr(10), "\\n") self.gui.data.append(text) - def update(self, *handles): + def update(self, *args): if self._idle_id != 0: if debug: print "%s interrupt!" % self.gui.title self.interrupt() diff --git a/src/plugins/DefaultGadgets.py b/src/plugins/DefaultGadgets.py index 91b0c08f0..fd780995d 100644 --- a/src/plugins/DefaultGadgets.py +++ b/src/plugins/DefaultGadgets.py @@ -30,7 +30,7 @@ import string # ) # There are a number of arguments that you can provide, including: -# name, height, content, title, expand, state +# name, height, content, title, expand, state, data # Here is a Gadget object. It has a number of method possibilities: # init- run once, on construction @@ -46,12 +46,27 @@ class CalendarGadget(Gadget): self.gui.calendar = gtk.Calendar() self.gui.calendar.connect('day-selected-double-click', self.double_click) self.gui.calendar.connect('month-changed', self.refresh) + db_signals = ['event-add', + 'event-update', + 'event-delete', + 'event-rebuild', + ] + for signal in db_signals: + self.dbstate.db.connect(signal, lambda *args: self.run_update(signal, *args)) + self.gui.scrolledwindow.remove(self.gui.textview) self.gui.scrolledwindow.add_with_viewport(self.gui.calendar) self.gui.calendar.show() self.birthdays = True self.dates = {} + def db_changed(self): + self.update() + + def run_update(self, signal, *args): + print "signal:", signal + self.update() + def refresh(self, *obj): self.gui.calendar.freeze() self.gui.calendar.clear_marks()