Working on calendar signals
svn: r9623
This commit is contained in:
parent
0fb8fad4ee
commit
50440b7839
@ -250,7 +250,7 @@ class Gadget(object):
|
|||||||
text = text.replace(chr(10), "\\n")
|
text = text.replace(chr(10), "\\n")
|
||||||
self.gui.data.append(text)
|
self.gui.data.append(text)
|
||||||
|
|
||||||
def update(self, *handles):
|
def update(self, *args):
|
||||||
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()
|
||||||
|
@ -30,7 +30,7 @@ import string
|
|||||||
# )
|
# )
|
||||||
|
|
||||||
# There are a number of arguments that you can provide, including:
|
# 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:
|
# Here is a Gadget object. It has a number of method possibilities:
|
||||||
# init- run once, on construction
|
# init- run once, on construction
|
||||||
@ -46,12 +46,27 @@ class CalendarGadget(Gadget):
|
|||||||
self.gui.calendar = gtk.Calendar()
|
self.gui.calendar = gtk.Calendar()
|
||||||
self.gui.calendar.connect('day-selected-double-click', self.double_click)
|
self.gui.calendar.connect('day-selected-double-click', self.double_click)
|
||||||
self.gui.calendar.connect('month-changed', self.refresh)
|
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.remove(self.gui.textview)
|
||||||
self.gui.scrolledwindow.add_with_viewport(self.gui.calendar)
|
self.gui.scrolledwindow.add_with_viewport(self.gui.calendar)
|
||||||
self.gui.calendar.show()
|
self.gui.calendar.show()
|
||||||
self.birthdays = True
|
self.birthdays = True
|
||||||
self.dates = {}
|
self.dates = {}
|
||||||
|
|
||||||
|
def db_changed(self):
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
def run_update(self, signal, *args):
|
||||||
|
print "signal:", signal
|
||||||
|
self.update()
|
||||||
|
|
||||||
def refresh(self, *obj):
|
def refresh(self, *obj):
|
||||||
self.gui.calendar.freeze()
|
self.gui.calendar.freeze()
|
||||||
self.gui.calendar.clear_marks()
|
self.gui.calendar.clear_marks()
|
||||||
|
Loading…
Reference in New Issue
Block a user