Ejemplo n.º 1
0
 def __init__(self, event):## FIXME
     common.EventWidget.__init__(self, event)
     ######
     sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
     ######
     hbox = gtk.HBox()
     label = gtk.Label(_('Start'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.startDateInput = DateButton()
     hbox.pack_start(self.startDateInput, 0, 0)
     ###
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     ######
     hbox = gtk.HBox()
     label = gtk.Label(_('Repeat Every '))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.weeksSpin = IntSpinButton(1, 99999)
     hbox.pack_start(self.weeksSpin, 0, 0)
     hbox.pack_start(gtk.Label('  '+_(' Weeks')), 0, 0)
     ###
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     ######
     hbox = gtk.HBox()
     label = gtk.Label(_('End'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.endDateInput = DateButton()
     hbox.pack_start(self.endDateInput, 0, 0)
     ###
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     #########
     hbox = gtk.HBox()
     label = gtk.Label(_('Time'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     ##
     self.dayTimeStartInput = HourMinuteButton()
     self.dayTimeEndInput = HourMinuteButton()
     ##
     hbox.pack_start(self.dayTimeStartInput, 0, 0)
     hbox.pack_start(gtk.Label(' ' + _('to') + ' '), 0, 0)
     hbox.pack_start(self.dayTimeEndInput, 0, 0)
     self.pack_start(hbox, 0, 0)
Ejemplo n.º 2
0
 def __init__(self, event):## FIXME
     gtk.VBox.__init__(self)
     self.event = event
     assert event.parent.name == 'universityTerm' ## FIXME
     sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
     #####
     if not event.parent.courses:
         showError(event.parent.noCourseError)
         raise RuntimeError('No courses added')
     self.courseIds = []
     self.courseNames = []
     combo = gtk.combo_box_new_text()
     for course in event.parent.courses:
         self.courseIds.append(course[0])
         self.courseNames.append(course[1])
         combo.append_text(course[1])
     #combo.connect('changed', self.updateSummary)
     self.courseCombo = combo
     ##
     hbox = gtk.HBox()
     label = gtk.Label(_('Course'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     hbox.pack_start(combo, 0, 0)
     ##
     self.pack_start(hbox, 0, 0)
     #####
     hbox = gtk.HBox()
     label = gtk.Label(_('Date'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.dateInput = DateButton()
     hbox.pack_start(self.dateInput, 0, 0)
     self.pack_start(hbox, 0, 0)
     #####
     hbox = gtk.HBox()
     label = gtk.Label(_('Time'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     ##
     self.dayTimeStartCombo = HourMinuteButton()
     self.dayTimeEndCombo = HourMinuteButton()
     ##
     #self.dayTimeStartCombo.child.set_direction(gtk.TEXT_DIR_LTR)
     #self.dayTimeEndCombo.child.set_direction(gtk.TEXT_DIR_LTR)
     ##
     hbox.pack_start(self.dayTimeStartCombo, 0, 0)
     hbox.pack_start(gtk.Label(' ' + _('to') + ' '), 0, 0)
     hbox.pack_start(self.dayTimeEndCombo, 0, 0)
     self.pack_start(hbox, 0, 0)
     ###########
     #hbox = gtk.HBox()
     #label = gtk.Label(_('Summary'))
     #label.set_alignment(0, 0.5)
     #sizeGroup.add_widget(label)
     #hbox.pack_start(label, 0, 0)
     #self.summaryEntry = gtk.Entry()
     #hbox.pack_start(self.summaryEntry, 1, 1)
     #self.pack_start(hbox, 0, 0)
     #####
     hbox = gtk.HBox()
     label = gtk.Label(_('Description'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.descriptionInput = TextFrame()
     hbox.pack_start(self.descriptionInput, 1, 1)
     self.pack_start(hbox, 0, 0)
     #####
     hbox = gtk.HBox()
     label = gtk.Label(_('Icon'))
     label.set_alignment(0, 0.5)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     self.iconSelect = common.IconSelectButton()
     #print join(pixDir, self.icon)
     hbox.pack_start(self.iconSelect, 0, 0)
     hbox.pack_start(gtk.Label(''), 1, 1)
     self.pack_start(hbox, 0, 0)
     ######
     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)
     ######
     self.courseCombo.set_active(0)
Ejemplo n.º 3
0
class EventWidget(common.EventWidget):
    def __init__(self, event):## FIXME
        common.EventWidget.__init__(self, event)
        ######
        sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_('Start'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.startDateInput = DateButton()
        hbox.pack_start(self.startDateInput, 0, 0)
        ###
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_('Repeat Every '))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.weeksSpin = IntSpinButton(1, 99999)
        hbox.pack_start(self.weeksSpin, 0, 0)
        hbox.pack_start(gtk.Label('  '+_(' Weeks')), 0, 0)
        ###
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_('End'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.endDateInput = DateButton()
        hbox.pack_start(self.endDateInput, 0, 0)
        ###
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        #########
        hbox = gtk.HBox()
        label = gtk.Label(_('Time'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        ##
        self.dayTimeStartInput = HourMinuteButton()
        self.dayTimeEndInput = HourMinuteButton()
        ##
        hbox.pack_start(self.dayTimeStartInput, 0, 0)
        hbox.pack_start(gtk.Label(' ' + _('to') + ' '), 0, 0)
        hbox.pack_start(self.dayTimeEndInput, 0, 0)
        self.pack_start(hbox, 0, 0)
        #############
        #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)
    def updateWidget(self):## FIXME
        common.EventWidget.updateWidget(self)
        mode = self.event.mode
        ###
        self.startDateInput.set_value(jd_to(self.event.getStartJd(), mode))
        self.weeksSpin.set_value(self.event['cycleWeeks'].weeks)
        self.endDateInput.set_value(jd_to(self.event.getEndJd(), mode))
        ###
        timeRangeRule = self.event['dayTimeRange']
        self.dayTimeStartInput.set_value(timeRangeRule.dayTimeStart)
        self.dayTimeEndInput.set_value(timeRangeRule.dayTimeEnd)
    def updateVars(self):## FIXME
        common.EventWidget.updateVars(self)
        self.event['start'].setDate(self.startDateInput.get_value())
        self.event['end'].setDate(self.endDateInput.get_value())
        self.event['cycleWeeks'].setData(self.weeksSpin.get_value())
        ###
        self.event['dayTimeRange'].setRange(
            self.dayTimeStartInput.get_value(),
            self.dayTimeEndInput.get_value(),
        )
    def modeComboChanged(self, obj=None):## overwrite method from common.EventWidget
        newMode = self.modeCombo.get_active()
        self.startDateInput.changeMode(self.event.mode, newMode)
        self.endDateInput.changeMode(self.event.mode, newMode)
        self.event.mode = newMode
Ejemplo n.º 4
0
class EventWidget(gtk.VBox):
    def __init__(self, event):## FIXME
        gtk.VBox.__init__(self)
        self.event = event
        assert event.parent.name == 'universityTerm' ## FIXME
        sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        #####
        if not event.parent.courses:
            showError(event.parent.noCourseError)
            raise RuntimeError('No courses added')
        self.courseIds = []
        self.courseNames = []
        combo = gtk.combo_box_new_text()
        for course in event.parent.courses:
            self.courseIds.append(course[0])
            self.courseNames.append(course[1])
            combo.append_text(course[1])
        #combo.connect('changed', self.updateSummary)
        self.courseCombo = combo
        ##
        hbox = gtk.HBox()
        label = gtk.Label(_('Course'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        hbox.pack_start(combo, 0, 0)
        ##
        self.pack_start(hbox, 0, 0)
        #####
        hbox = gtk.HBox()
        label = gtk.Label(_('Date'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.dateInput = DateButton()
        hbox.pack_start(self.dateInput, 0, 0)
        self.pack_start(hbox, 0, 0)
        #####
        hbox = gtk.HBox()
        label = gtk.Label(_('Time'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        ##
        self.dayTimeStartCombo = HourMinuteButton()
        self.dayTimeEndCombo = HourMinuteButton()
        ##
        #self.dayTimeStartCombo.child.set_direction(gtk.TEXT_DIR_LTR)
        #self.dayTimeEndCombo.child.set_direction(gtk.TEXT_DIR_LTR)
        ##
        hbox.pack_start(self.dayTimeStartCombo, 0, 0)
        hbox.pack_start(gtk.Label(' ' + _('to') + ' '), 0, 0)
        hbox.pack_start(self.dayTimeEndCombo, 0, 0)
        self.pack_start(hbox, 0, 0)
        ###########
        #hbox = gtk.HBox()
        #label = gtk.Label(_('Summary'))
        #label.set_alignment(0, 0.5)
        #sizeGroup.add_widget(label)
        #hbox.pack_start(label, 0, 0)
        #self.summaryEntry = gtk.Entry()
        #hbox.pack_start(self.summaryEntry, 1, 1)
        #self.pack_start(hbox, 0, 0)
        #####
        hbox = gtk.HBox()
        label = gtk.Label(_('Description'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.descriptionInput = TextFrame()
        hbox.pack_start(self.descriptionInput, 1, 1)
        self.pack_start(hbox, 0, 0)
        #####
        hbox = gtk.HBox()
        label = gtk.Label(_('Icon'))
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        hbox.pack_start(label, 0, 0)
        self.iconSelect = common.IconSelectButton()
        #print join(pixDir, self.icon)
        hbox.pack_start(self.iconSelect, 0, 0)
        hbox.pack_start(gtk.Label(''), 1, 1)
        self.pack_start(hbox, 0, 0)
        ######
        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)
        ######
        self.courseCombo.set_active(0)
        #self.updateSummary()
    def focusSummary(self):
        pass
    #def updateSummary(self, widget=None):
    #    courseIndex = self.courseCombo.get_active()
    #    summary = _('%s Exam')%self.courseNames[courseIndex]
    #    self.summaryEntry.set_text(summary)
    #    self.event.summary = summary
    def updateWidget(self):## FIXME
        if self.event.courseId is None:
            pass
        else:
            self.courseCombo.set_active(self.courseIds.index(self.event.courseId))
        ##
        self.dateInput.set_value(self.event.getDate())
        ##
        timeRangeRule = self.event['dayTimeRange']
        self.dayTimeStartCombo.set_value(timeRangeRule.dayTimeStart)
        self.dayTimeEndCombo.set_value(timeRangeRule.dayTimeEnd)
        ####
        #self.summaryEntry.set_text(self.event.summary)
        self.descriptionInput.set_text(self.event.description)
        self.iconSelect.set_filename(self.event.icon)
        ####
        self.notificationBox.updateWidget()
        ####
        #self.filesBox.updateWidget()
    def updateVars(self):## FIXME
        courseIndex = self.courseCombo.get_active()
        if courseIndex is None:
            showError(_('No course is selected'), self)
            raise RuntimeError('No courses is selected')
        else:
            self.event.courseId = self.courseIds[courseIndex]
        ##
        self.event.setDate(*tuple(self.dateInput.get_value()))
        ##
        self.event['dayTimeRange'].setRange(
            self.dayTimeStartCombo.get_value(),
            self.dayTimeEndCombo.get_value(),
        )
        ####
        #self.event.summary = self.summaryEntry.get_text()
        self.event.description = self.descriptionInput.get_text()
        self.event.icon = self.iconSelect.get_filename()
        ####
        self.notificationBox.updateVars()
        self.event.updateSummary()
    def modeComboChanged(self, obj=None):## overwrite method from common.EventWidget
        newMode = self.modeCombo.get_active()
        self.dateInput.changeMode(self.event.mode, newMode)
        self.event.mode = newMode