当前位置: 首页>>代码示例>>Python>>正文


Python DateButton.changeMode方法代码示例

本文整理汇总了Python中scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.changeMode方法的典型用法代码示例。如果您正苦于以下问题:Python DateButton.changeMode方法的具体用法?Python DateButton.changeMode怎么用?Python DateButton.changeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scal2.ui_gtk.mywidgets.multi_spin_button.DateButton的用法示例。


在下文中一共展示了DateButton.changeMode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GroupWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
class GroupWidget(BaseGroupWidget):
    def __init__(self, group):
        BaseGroupWidget.__init__(self, group)
        ####
        hbox = gtk.HBox()
        label = gtk.Label(_('Start'))
        label.set_alignment(0, 0.5)
        hbox.pack_start(label, 0, 0)
        self.sizeGroup.add_widget(label)
        self.startDateInput = DateButton()
        hbox.pack_start(self.startDateInput, 0, 0)
        self.pack_start(hbox, 0, 0)
        ###
        hbox = gtk.HBox()
        label = gtk.Label(_('End'))
        label.set_alignment(0, 0.5)
        hbox.pack_start(label, 0, 0)
        self.sizeGroup.add_widget(label)
        self.endDateInput = DateButton()
        hbox.pack_start(self.endDateInput, 0, 0)
        self.pack_start(hbox, 0, 0)
    def updateWidget(self):
        BaseGroupWidget.updateWidget(self)
        self.startDateInput.set_value(jd_to(self.group.startJd, self.group.mode))
        self.endDateInput.set_value(jd_to(self.group.endJd, self.group.mode))
    def updateVars(self):
        BaseGroupWidget.updateVars(self)
        self.group.startJd = self.startDateInput.get_jd(self.group.mode)
        self.group.endJd = self.endDateInput.get_jd(self.group.mode)
    def modeComboChanged(self, obj=None):
        newMode = self.modeCombo.get_active()
        self.startDateInput.changeMode(self.group.mode, newMode)
        self.endDateInput.changeMode(self.group.mode, newMode)
        self.group.mode = newMode
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:36,代码来源:group.py

示例2: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
class EventWidget(common.EventWidget):
    def __init__(self, event):
        common.EventWidget.__init__(self, event)
        ###
        hbox = gtk.HBox()
        pack(hbox, gtk.Label(_("Date")))
        self.dateInput = DateButton()
        pack(hbox, self.dateInput)
        pack(self, hbox)
        #############
        # self.filesBox = common.FilesBox(self.event)
        # pack(self, self.filesBox)

    def updateWidget(self):
        common.EventWidget.updateWidget(self)
        self.dateInput.set_value(self.event.getDate())

    def updateVars(self):
        common.EventWidget.updateVars(self)
        self.event.setDate(*self.dateInput.get_value())

    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
开发者ID:Noori,项目名称:starcal,代码行数:27,代码来源:dailyNote.py

示例3: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
class EventWidget(common.EventWidget):
    def __init__(self, event):  ## FIXME
        common.EventWidget.__init__(self, event)
        ######
        sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        ######
        try:
            seperated = event.parent.showSeperatedYmdInputs
        except AttributeError:
            seperated = False
        if seperated:
            self.startDateInput = YearMonthDayBox()
            self.endDateInput = YearMonthDayBox()
        else:
            self.startDateInput = DateButton()
            self.endDateInput = DateButton()
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_("Start") + ": ")
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        pack(hbox, label)
        pack(hbox, self.startDateInput)
        pack(self, hbox)
        ######
        hbox = gtk.HBox()
        label = gtk.Label(_("End") + ": ")
        label.set_alignment(0, 0.5)
        sizeGroup.add_widget(label)
        pack(hbox, label)
        pack(hbox, self.endDateInput)
        pack(self, hbox)
        #############
        # self.filesBox = common.FilesBox(self.event)
        # pack(self, self.filesBox)

    def updateWidget(self):
        common.EventWidget.updateWidget(self)
        self.startDateInput.set_value(self.event["start"].date)
        self.endDateInput.set_value(self.event["end"].date)

    def updateVars(self):  ## FIXME
        common.EventWidget.updateVars(self)
        self.event["start"].setDate(self.startDateInput.get_value())
        self.event["end"].setDate(self.endDateInput.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
开发者ID:Noori,项目名称:starcal,代码行数:53,代码来源:lifeTime.py

示例4: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
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(' '+_('Time')), 0, 0)
        self.startTimeInput = TimeButton()
        hbox.pack_start(self.startTimeInput, 0, 0)
        ##
        self.pack_start(hbox, 0, 0)
        ######
        hbox = gtk.HBox()
        self.endTypeCombo = gtk.combo_box_new_text()
        for item in ('Duration', 'End'):
            self.endTypeCombo.append_text(_(item))
        self.endTypeCombo.connect('changed', self.endTypeComboChanged)
        sizeGroup.add_widget(self.endTypeCombo)
        hbox.pack_start(self.endTypeCombo, 0, 0)
        ####
        self.durationBox = common.DurationInputBox()
        hbox.pack_start(self.durationBox, 1, 1)
        ####
        self.endDateHbox = gtk.HBox()
        self.endDateInput = DateButton()
        self.endDateHbox.pack_start(self.endDateInput, 0, 0)
        ##
        self.endDateHbox.pack_start(gtk.Label(' '+_('Time')), 0, 0)
        self.endTimeInput = TimeButton()
        self.endDateHbox.pack_start(self.endTimeInput, 0, 0)
        ##
        hbox.pack_start(self.endDateHbox, 1, 1)
        ####
        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)
    def endTypeComboChanged(self, combo=None):
        active = self.endTypeCombo.get_active()
        if active==0:## duration
            self.durationBox.show()
            self.endDateHbox.hide()
        elif active==1:## end date
            self.durationBox.hide()
            self.endDateHbox.show()
        else:
            raise RuntimeError
    def updateWidget(self):## FIXME
        common.EventWidget.updateWidget(self)
        ###
        (startDate, startTime) = self.event.getStart()
        self.startDateInput.set_value(startDate)
        self.startTimeInput.set_value(startTime)
        ###
        (endType, values) = self.event.getEnd()
        if endType=='duration':
            self.endTypeCombo.set_active(0)
            self.durationBox.setDuration(*values)
            self.endDateInput.set_value(startDate)## FIXME
            self.endTimeInput.set_value(startTime)## FIXME
        elif endType=='date':
            self.endTypeCombo.set_active(1)
            self.endDateInput.set_value(values[0])
            self.endTimeInput.set_value(values[1])
        else:
            raise RuntimeError
        self.endTypeComboChanged()
    def updateVars(self):## FIXME
        common.EventWidget.updateVars(self)
        self.event.setStart(self.startDateInput.get_value(), self.startTimeInput.get_value())
        ###
        active = self.endTypeCombo.get_active()
        if active==0:
            self.event.setEnd('duration', *self.durationBox.getDuration())
        elif active==1:
            self.event.setEnd(
                'date',
                self.endDateInput.get_value(),
                self.endTimeInput.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
开发者ID:karoon,项目名称:starcal2,代码行数:99,代码来源:task.py

示例5: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
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)
        pack(hbox, label)
        self.startDateInput = DateButton()
        pack(hbox, self.startDateInput)
        ##
        pack(hbox, gtk.Label(" " + _("Time")))
        self.startTimeInput = TimeButton()
        pack(hbox, self.startTimeInput)
        ##
        pack(self, hbox)
        ######
        hbox = gtk.HBox()
        self.endTypeCombo = gtk.combo_box_new_text()
        for item in ("Duration", "End"):
            self.endTypeCombo.append_text(_(item))
        self.endTypeCombo.connect("changed", self.endTypeComboChanged)
        sizeGroup.add_widget(self.endTypeCombo)
        pack(hbox, self.endTypeCombo)
        ####
        self.durationBox = common.DurationInputBox()
        pack(hbox, self.durationBox, 1, 1)
        ####
        self.endDateHbox = gtk.HBox()
        self.endDateInput = DateButton()
        pack(self.endDateHbox, self.endDateInput)
        ##
        pack(self.endDateHbox, gtk.Label(" " + _("Time")))
        self.endTimeInput = TimeButton()
        pack(self.endDateHbox, self.endTimeInput)
        ##
        pack(hbox, self.endDateHbox, 1, 1)
        ####
        pack(hbox, gtk.Label(""), 1, 1)
        pack(self, hbox)
        #############
        self.notificationBox = common.NotificationBox(event)
        pack(self, self.notificationBox)
        #############
        # self.filesBox = common.FilesBox(self.event)
        # pack(self, self.filesBox)

    def endTypeComboChanged(self, combo=None):
        active = self.endTypeCombo.get_active()
        if active == 0:  ## duration
            self.durationBox.show()
            self.endDateHbox.hide()
        elif active == 1:  ## end date
            self.durationBox.hide()
            self.endDateHbox.show()
        else:
            raise RuntimeError

    def updateWidget(self):  ## FIXME
        common.EventWidget.updateWidget(self)
        ###
        startDate, startTime = self.event.getStart()
        self.startDateInput.set_value(startDate)
        self.startTimeInput.set_value(startTime)
        ###
        endType, values = self.event.getEnd()
        if endType == "duration":
            self.endTypeCombo.set_active(0)
            self.durationBox.setDuration(*values)
            self.endDateInput.set_value(startDate)  ## FIXME
            self.endTimeInput.set_value(startTime)  ## FIXME
        elif endType == "date":
            self.endTypeCombo.set_active(1)
            self.endDateInput.set_value(values[0])
            self.endTimeInput.set_value(values[1])
        else:
            raise RuntimeError
        self.endTypeComboChanged()

    def updateVars(self):  ## FIXME
        common.EventWidget.updateVars(self)
        self.event.setStart(self.startDateInput.get_value(), self.startTimeInput.get_value())
        ###
        active = self.endTypeCombo.get_active()
        if active == 0:
            self.event.setEnd("duration", *self.durationBox.getDuration())
        elif active == 1:
            self.event.setEnd("date", self.endDateInput.get_value(), self.endTimeInput.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
开发者ID:Noori,项目名称:starcal,代码行数:99,代码来源:task.py

示例6: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
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
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:87,代码来源:weekly.py

示例7: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]

#.........这里部分代码省略.........
        ##
        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
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:104,代码来源:universityExam.py

示例8: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
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)
        ##
        self.pack_start(hbox, 0, 0)
        ######
        hbox = gtk.HBox()
        self.endTypeCombo = gtk.combo_box_new_text()
        for item in ("Duration", "End"):
            self.endTypeCombo.append_text(_(item))
        self.endTypeCombo.connect("changed", self.endTypeComboChanged)
        sizeGroup.add_widget(self.endTypeCombo)
        hbox.pack_start(self.endTypeCombo, 0, 0)
        ####
        self.durationBox = gtk.HBox()
        self.durationSpin = IntSpinButton(1, 999)
        self.durationBox.pack_start(self.durationSpin, 0, 0)
        self.durationBox.pack_start(gtk.Label(_(" days")), 0, 0)
        hbox.pack_start(self.durationBox, 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)
        #############
        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 endTypeComboChanged(self, combo=None):
        active = self.endTypeCombo.get_active()
        if active == 0:  ## duration
            self.durationBox.show()
            self.endDateInput.hide()
        elif active == 1:  ## end date
            self.durationBox.hide()
            self.endDateInput.show()
        else:
            raise RuntimeError

    def updateWidget(self):  ## FIXME
        common.EventWidget.updateWidget(self)
        mode = self.event.mode
        ###
        startJd = self.event.getJd()
        self.startDateInput.set_value(jd_to(startJd, mode))
        ###
        (endType, endValue) = self.event.getEnd()
        if endType == "duration":
            self.endTypeCombo.set_active(0)
            self.durationSpin.set_value(endValue)
            self.endDateInput.set_value(jd_to(self.event.getEndJd(), mode))  ## FIXME
        elif endType == "date":
            self.endTypeCombo.set_active(1)
            self.endDateInput.set_value(endValue)
        else:
            raise RuntimeError
        self.endTypeComboChanged()

    def updateVars(self):  ## FIXME
        common.EventWidget.updateVars(self)
        self.event.setStartDate(self.startDateInput.get_value())
        ###
        active = self.endTypeCombo.get_active()
        if active == 0:
            self.event.setEnd("duration", self.durationSpin.get_value())
        elif active == 1:
            self.event.setEnd("date", self.endDateInput.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
开发者ID:karoon,项目名称:starcal2,代码行数:89,代码来源:allDayTask.py

示例9: EventWidget

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import changeMode [as 别名]
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)
        pack(hbox, label)
        self.startDateInput = DateButton()
        pack(hbox, self.startDateInput)
        ##
        pack(self, hbox)
        ######
        hbox = gtk.HBox()
        self.endTypeCombo = gtk.combo_box_new_text()
        for item in ('Duration', 'End'):
            self.endTypeCombo.append_text(_(item))
        self.endTypeCombo.connect('changed', self.endTypeComboChanged)
        sizeGroup.add_widget(self.endTypeCombo)
        pack(hbox, self.endTypeCombo)
        ####
        self.durationBox = gtk.HBox()
        self.durationSpin = IntSpinButton(1, 999)
        pack(self.durationBox, self.durationSpin)
        pack(self.durationBox, gtk.Label(_(' days')))
        pack(hbox, self.durationBox)
        ####
        self.endDateInput = DateButton()
        pack(hbox, self.endDateInput)
        ####
        pack(hbox, gtk.Label(''), 1, 1)
        pack(self, hbox)
        #############
        self.notificationBox = common.NotificationBox(event)
        pack(self, self.notificationBox)
        #############
        #self.filesBox = common.FilesBox(self.event)
        #pack(self, self.filesBox)
    def endTypeComboChanged(self, combo=None):
        active = self.endTypeCombo.get_active()
        if active==0:## duration
            self.durationBox.show()
            self.endDateInput.hide()
        elif active==1:## end date
            self.durationBox.hide()
            self.endDateInput.show()
        else:
            raise RuntimeError
    def updateWidget(self):## FIXME
        common.EventWidget.updateWidget(self)
        mode = self.event.mode
        ###
        startJd = self.event.getJd()
        self.startDateInput.set_value(jd_to(startJd, mode))
        ###
        endType, endValue = self.event.getEnd()
        if endType=='duration':
            self.endTypeCombo.set_active(0)
            self.durationSpin.set_value(endValue)
            self.endDateInput.set_value(jd_to(self.event.getEndJd(), mode))## FIXME
        elif endType=='date':
            self.endTypeCombo.set_active(1)
            self.endDateInput.set_value(endValue)
        else:
            raise RuntimeError
        self.endTypeComboChanged()
    def updateVars(self):## FIXME
        common.EventWidget.updateVars(self)
        self.event.setStartDate(self.startDateInput.get_value())
        ###
        active = self.endTypeCombo.get_active()
        if active==0:
            self.event.setEnd('duration', self.durationSpin.get_value())
        elif active==1:
            self.event.setEnd(
                'date',
                self.endDateInput.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
开发者ID:Noori,项目名称:starcal,代码行数:88,代码来源:allDayTask.py


注:本文中的scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.changeMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。