예제 #1
0
 def __init__(self, event):## FIXME
     common.EventWidget.__init__(self, event)
     ################
     hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Month')), 0, 0)
     self.monthCombo = MonthComboBox()
     self.monthCombo.build(event.mode)
     hbox.pack_start(self.monthCombo, 0, 0)
     hbox.pack_start(gtk.Label(''), 1, 1)
     #self.pack_start(hbox, 0, 0)
     ###
     #hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Day')), 0, 0)
     self.daySpin = DaySpinButton()
     hbox.pack_start(self.daySpin, 0, 0)
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     ###
     hbox = gtk.HBox()
     self.startYearCheck = gtk.CheckButton(_('Start Year'))
     hbox.pack_start(self.startYearCheck, 0, 0)
     self.startYearSpin = YearSpinButton()
     hbox.pack_start(self.startYearSpin, 0, 0)
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     self.startYearCheck.connect('clicked', self.startYearCheckClicked)
     ####
     self.notificationBox = common.NotificationBox(event)
     self.pack_start(self.notificationBox, 0, 0)
예제 #2
0
파일: yearly.py 프로젝트: Noori/starcal
 def __init__(self, event):## FIXME
     common.EventWidget.__init__(self, event)
     ################
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Month')))
     self.monthCombo = MonthComboBox()
     self.monthCombo.build(event.mode)
     pack(hbox, self.monthCombo)
     pack(hbox, gtk.Label(''), 1, 1)
     #pack(self, hbox)
     ###
     #hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Day')))
     self.daySpin = DaySpinButton()
     pack(hbox, self.daySpin)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self, hbox)
     ###
     hbox = gtk.HBox()
     self.startYearCheck = gtk.CheckButton(_('Start Year'))
     pack(hbox, self.startYearCheck)
     self.startYearSpin = YearSpinButton()
     pack(hbox, self.startYearSpin)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self, hbox)
     self.startYearCheck.connect('clicked', self.startYearCheckClicked)
     ####
     self.notificationBox = common.NotificationBox(event)
     pack(self, self.notificationBox)
예제 #3
0
class EventWidget(common.EventWidget):
    def __init__(self, event):## FIXME
        common.EventWidget.__init__(self, event)
        ################
        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Month')), 0, 0)
        self.monthCombo = MonthComboBox()
        self.monthCombo.build(event.mode)
        hbox.pack_start(self.monthCombo, 0, 0)
        hbox.pack_start(gtk.Label(''), 1, 1)
        #self.pack_start(hbox, 0, 0)
        ###
        #hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Day')), 0, 0)
        self.daySpin = DaySpinButton()
        hbox.pack_start(self.daySpin, 0, 0)
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        ###
        hbox = gtk.HBox()
        self.startYearCheck = gtk.CheckButton(_('Start Year'))
        hbox.pack_start(self.startYearCheck, 0, 0)
        self.startYearSpin = YearSpinButton()
        hbox.pack_start(self.startYearSpin, 0, 0)
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        self.startYearCheck.connect('clicked', self.startYearCheckClicked)
        ####
        self.notificationBox = common.NotificationBox(event)
        self.pack_start(self.notificationBox, 0, 0)
        ####
        #self.filesBox = common.FilesBox(self.event)
        #self.pack_start(self.filesBox, 0, 0)
    startYearCheckClicked = lambda self, obj=None: self.startYearSpin.set_sensitive(self.startYearCheck.get_active())
    def updateWidget(self):## FIXME
        common.EventWidget.updateWidget(self)
        self.monthCombo.setValue(self.event.getMonth())
        self.daySpin.set_value(self.event.getDay())
        try:
            startRule = self.event['start']
        except:
            self.startYearCheck.set_active(False)
            self.startYearSpin.set_value(self.event.getSuggestedStartYear())
        else:
            self.startYearCheck.set_active(True)
            self.startYearSpin.set_value(startRule.date[0])
        self.startYearCheckClicked()
    def updateVars(self):## FIXME
        common.EventWidget.updateVars(self)
        self.event.setMonth(self.monthCombo.getValue())
        self.event.setDay(int(self.daySpin.get_value()))
        if self.startYearCheck.get_active():
            startRule = self.event.getAddRule('start')
            startRule.date = (self.startYearSpin.get_value(), 1, 1)
        else:
            try:
                del self.event['start']
            except KeyError:
                pass
    def modeComboChanged(self, obj=None):## overwrite method from common.EventWidget
        newMode = self.modeCombo.get_active()
        module = calTypes[newMode]
        monthCombo = self.monthCombo
        month = monthCombo.getValue()
        monthCombo.build(newMode)
        y2, m2, d2 = convert(
            int(self.startYearSpin.get_value()),
            month,
            int(self.daySpin.get_value()),
            self.event.mode,
            newMode,
        )
        self.startYearSpin.set_value(y2)
        monthCombo.setValue(m2)
        self.daySpin.set_value(d2)
        self.event.mode = newMode