def __init__(self, event): gtk.Expander.__init__(self, _('Notification')) self.event = event self.hboxDict = {} totalVbox = gtk.VBox() ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Notify')+' ')) self.notifyBeforeInput = DurationInputBox() pack(hbox, self.notifyBeforeInput, 0, 0) pack(hbox, gtk.Label(' '+_('before event'))) pack(hbox, gtk.Label(), 1, 1) pack(totalVbox, hbox) ### for cls in event_lib.classes.notifier: notifier = cls(self.event) inputWidget = makeWidget(notifier) if not inputWidget: printError('notifier %s, inputWidget = %r'%(cls.name, inputWidget)) continue hbox = gtk.HBox() cb = gtk.CheckButton(notifier.desc) cb.inputWidget = inputWidget cb.connect('clicked', lambda check: check.inputWidget.set_sensitive(check.get_active())) cb.set_active(False) pack(hbox, cb) hbox.cb = cb #pack(hbox, gtk.Label(''), 1, 1) pack(hbox, inputWidget, 1, 1) hbox.inputWidget = inputWidget self.hboxDict[notifier.name] = hbox pack(totalVbox, hbox) self.add(totalVbox)
def load(self): #print('BuiltinTextPlugin(%s).load()'%self.path) db = [] for j in range(12): monthDb = [] for k in range(calTypes[self.mode].maxMonthLen): monthDb.append('') db.append(monthDb) ## last item is a dict of dates (y, m, d) and the description of day: db.append({}) ext = splitext(self.db_path)[1].lower() if ext == '.txt': sep = '\t' lines = open(self.db_path).read().split('\n') for line in lines[1:]: line = line.strip() if not line: continue if line[0]=='#': continue parts = line.split('\t') if len(parts)<2: printError('bad plugin db line: %s'%line) continue date = parts[0].split('/') text = '\t'.join(parts[1:]) if len(date)==3: y = int(date[0]) m = int(date[1]) d = int(date[2]) db[12][(y, m, d)] = text elif len(date)==2: m = int(date[0]) d = int(date[1]) db[m-1][d-1] = text else: raise IOError('Bad line in database %s:\n%s'%(self.db_path, line)) self.data = db
def __init__(self, event): gtk.Expander.__init__(self, _('Notification')) self.event = event self.hboxDict = {} totalVbox = gtk.VBox() ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Notify') + ' ')) self.notifyBeforeInput = DurationInputBox() pack(hbox, self.notifyBeforeInput, 0, 0) pack(hbox, gtk.Label(' ' + _('before event'))) pack(hbox, gtk.Label(), 1, 1) pack(totalVbox, hbox) ### for cls in event_lib.classes.notifier: notifier = cls(self.event) inputWidget = makeWidget(notifier) if not inputWidget: printError('notifier %s, inputWidget = %r' % (cls.name, inputWidget)) continue hbox = gtk.HBox() cb = gtk.CheckButton(notifier.desc) cb.inputWidget = inputWidget cb.connect( 'clicked', lambda check: check.inputWidget.set_sensitive(check.get_active( ))) cb.set_active(False) pack(hbox, cb) hbox.cb = cb #pack(hbox, gtk.Label(''), 1, 1) pack(hbox, inputWidget, 1, 1) hbox.inputWidget = inputWidget self.hboxDict[notifier.name] = hbox pack(totalVbox, hbox) self.add(totalVbox)
'name', 'desc', 'origLang', 'getMonthName', 'getMonthNameAb', 'minMonthLen', 'maxMonthLen', 'getMonthLen', 'to_jd', 'jd_to', 'options', 'save', ): if not hasattr(mod, attr): printError( 'Invalid calendar module: module "%s" has no attribute "%s"\n'\ %(name, attr) ) modules.append(mod) class CalTypesHolder: byName = dict([(mod.name, mod) for mod in modules]) names = [mod.name for mod in modules] ## calOrigLang = [m.origLang for m in modules] __len__ = lambda self: len(self.names) def __init__(self): self.activeNames = ['gregorian'] self.inactiveNames = [] self.update() def update(self):
'name', 'desc', 'origLang', 'getMonthName', 'getMonthNameAb', 'minMonthLen', 'maxMonthLen', 'getMonthLen', 'to_jd', 'jd_to', 'options', 'save', ): if not hasattr(mod, attr): printError( 'Invalid calendar module: module "%s" has no attribute "%s"\n'\ %(name, attr) ) modules.append(mod) class CalTypesHolder: byName = dict([(mod.name, mod) for mod in modules]) names = [mod.name for mod in modules] ## calOrigLang = [m.origLang for m in modules] __len__ = lambda self: len(self.names) def __init__(self): self.activeNames = ['gregorian'] self.inactiveNames = [] self.update()