• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python multi_spin_button.DateButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

 def __init__(self, saveIcsFunc, defaultFileName):
     self.saveIcsFunc = saveIcsFunc
     gtk.Dialog.__init__(self, title=_('Export to %s')%'iCalendar', parent=None)
     self.set_has_separator(False)
     ########
     hbox = gtk.HBox(spacing=2)
     hbox.pack_start(gtk.Label(_('From')+' '), 0, 0)
     self.startDateInput = DateButton()
     hbox.pack_start(self.startDateInput, 0, 0)
     hbox.pack_start(gtk.Label(' '+_('To')+' '), 0, 0)
     self.endDateInput = DateButton()
     hbox.pack_start(self.endDateInput, 0, 0)
     self.vbox.pack_start(hbox, 0, 0)
     ####
     (year, month, day) = ui.todayCell.dates[core.primaryMode]
     self.startDateInput.set_value((year, 1, 1))
     self.endDateInput.set_value((year+1, 1, 1))
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FILE_CHOOSER_ACTION_SAVE)
     self.vbox.pack_start(self.fcw, 1, 1)
     self.vbox.show_all()
     ##
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1, self.onDelete)
     dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
     ##
     self.connect('delete-event', self.onDelete)
     try:
         self.fcw.set_current_folder(core.deskDir)
     except AttributeError:## PyGTK < 2.4
         pass
     if not defaultFileName.endswith('.ics'):
         defaultFileName += '.ics'
     self.fcw.set_current_name(defaultFileName)
开发者ID:karoon,项目名称:starcal2,代码行数:33,代码来源:export.py


示例2: GroupWidget

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,代码行数:34,代码来源:group.py


示例3: EventWidget

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,代码行数:25,代码来源:dailyNote.py


示例4: __init__

 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)
     hbox.pack_start(label, 0, 0)
     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)
     sizeGroup.add_widget(label)
     hbox.pack_start(label, 0, 0)
     hbox.pack_start(self.endDateInput, 0, 0)
     self.pack_start(hbox, 0, 0)
开发者ID:karoon,项目名称:starcal2,代码行数:31,代码来源:lifeTime.py


示例5: __init__

 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)
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:52,代码来源:weekly.py


示例6: EventWidget

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,代码行数:51,代码来源:lifeTime.py


示例7: __init__

 def __init__(self, event):
     common.EventWidget.__init__(self, event)
     ###
     hbox = gtk.HBox()
     hbox.pack_start(gtk.Label(_('Date')), 0, 0)
     self.dateInput = DateButton()
     hbox.pack_start(self.dateInput, 0, 0)
     self.pack_start(hbox, 0, 0)
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:8,代码来源:dailyNote.py


示例8: __init__

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


示例9: __init__

 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)
开发者ID:karoon,项目名称:starcal2,代码行数:45,代码来源:task.py


示例10: __init__

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


示例11: __init__

 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)
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:20,代码来源:group.py


示例12: __init__

 def __init__(self, rule):
     self.rule = rule
     ###
     gtk.HBox.__init__(self)
     ###
     self.dateInput = DateButton()
     self.pack_start(self.dateInput, 0, 0)
     ###
     self.pack_start(gtk.Label('   '+_('Time')), 0, 0)
     self.timeInput = TimeButton()
     self.pack_start(self.timeInput, 0, 0)
开发者ID:karoon,项目名称:starcal2,代码行数:11,代码来源:dateTime.py


示例13: __init__

 def __init__(self, rule):
     self.rule = rule
     ###
     gtk.HBox.__init__(self)
     ###
     self.dateInput = DateButton()
     pack(self, self.dateInput)
     ###
     pack(self, gtk.Label('   '+_('Time')))
     self.timeInput = TimeButton()
     pack(self, self.timeInput)
开发者ID:Noori,项目名称:starcal,代码行数:11,代码来源:dateTime.py


示例14: __init__

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


示例15: __init__

 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)
开发者ID:karoon,项目名称:starcal2,代码行数:37,代码来源:allDayTask.py


示例16: ExportToIcsDialog

class ExportToIcsDialog(gtk.Dialog):
    def __init__(self, saveIcsFunc, defaultFileName):
        self.saveIcsFunc = saveIcsFunc
        gtk.Dialog.__init__(self, title=_('Export to %s')%'iCalendar', parent=None)
        self.set_has_separator(False)
        ########
        hbox = gtk.HBox(spacing=2)
        pack(hbox, gtk.Label(_('From')+' '))
        self.startDateInput = DateButton()
        pack(hbox, self.startDateInput)
        pack(hbox, gtk.Label(' '+_('To')+' '))
        self.endDateInput = DateButton()
        pack(hbox, self.endDateInput)
        pack(self.vbox, hbox)
        ####
        year, month, day = ui.todayCell.dates[calTypes.primary]
        self.startDateInput.set_value((year, 1, 1))
        self.endDateInput.set_value((year+1, 1, 1))
        ########
        self.fcw = gtk.FileChooserWidget(action=gtk.FILE_CHOOSER_ACTION_SAVE)
        pack(self.vbox, self.fcw, 1, 1)
        self.vbox.set_focus_child(self.fcw)## FIXME
        self.vbox.show_all()
        ##
        dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1, self.onDelete)
        dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
        ##
        self.connect('delete-event', self.onDelete)
        self.fcw.connect('file-activated', self.save)## not working FIXME
        ##
        try:
            self.fcw.set_current_folder(core.deskDir)
        except AttributeError:## PyGTK < 2.4
            pass
        if not defaultFileName.endswith('.ics'):
            defaultFileName += '.ics'
        self.fcw.set_current_name(defaultFileName)
    def onDelete(self, widget=None, event=None):## hide(close) File Chooser Dialog
        self.destroy()
        return True
    def save(self, widget=None):
        self.get_window().set_cursor(gdk.Cursor(gdk.WATCH))
        while gtk.events_pending():
            gtk.main_iteration_do(False)
        path = self.fcw.get_filename()
        if path in (None, ''):
            return
        print('Exporting to ics file "%s"'%path)
        self.saveIcsFunc(
            path,
            core.primary_to_jd(*self.startDateInput.get_value()),
            core.primary_to_jd(*self.endDateInput.get_value()),
        )
        self.get_window().set_cursor(gdk.Cursor(gdk.LEFT_PTR))
        self.destroy()
开发者ID:Noori,项目名称:starcal,代码行数:55,代码来源:export.py


示例17: RuleWidget

class RuleWidget(gtk.HBox):
    def __init__(self, rule):
        self.rule = rule
        ###
        gtk.HBox.__init__(self)
        ###
        self.dateInput = DateButton()
        self.pack_start(self.dateInput, 0, 0)
        ###
        self.pack_start(gtk.Label('   '+_('Time')), 0, 0)
        self.timeInput = TimeButton()
        self.pack_start(self.timeInput, 0, 0)
    def updateWidget(self):
        self.dateInput.set_value(self.rule.date)
        self.timeInput.set_value(self.rule.time)
    def updateVars(self):
        self.rule.date = self.dateInput.get_value()
        self.rule.time = self.timeInput.get_value()
    def changeMode(self, mode):
        curMode = self.rule.getMode()
        if mode!=curMode:
            (y, m, d) = self.dateInput.get_value()
            self.dateInput.set_value(core.convert(y, m, d, curMode, mode))
开发者ID:karoon,项目名称:starcal2,代码行数:23,代码来源:dateTime.py


示例18: AdjusterDialog

class AdjusterDialog(gtk.Dialog):
    xpad = 15
    def __init__(self):
        gtk.Dialog.__init__(self)
        self.set_title(_('Adjust System Date & Time'))##????????
        self.set_icon(self.render_icon(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_BUTTON))
        #########
        self.buttonCancel = self.add_button(gtk.STOCK_CANCEL, 0)
        #self.buttonCancel.connect('clicked', lambda w: sys.exit(0))
        self.buttonSet = self.add_button(_('Set System Time'), 1)
        #self.buttonSet.connect('clicked', self.setSysTimeClicked)
        #########
        hbox = gtk.HBox()
        self.label_cur = gtk.Label(_('Current:'))
        hbox.pack_start(self.label_cur, 0, 0)
        self.vbox.pack_start(hbox, 0, 0)
        #########
        hbox = gtk.HBox()
        self.radioMan = gtk.RadioButton(None, _('Set _Manully:'), True)
        self.radioMan.connect('clicked', self.radioManClicked)
        hbox.pack_start(self.radioMan, 0, 0)
        self.vbox.pack_start(hbox, 0, 0)
        ######
        vb = gtk.VBox()
        sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        ###
        hbox = gtk.HBox()
        ##
        l = gtk.Label('')
        l.set_property('width-request', self.xpad)
        hbox.pack_start(l, 0, 0)
        ##
        self.ckeckbEditTime = gtk.CheckButton(_('Edit Time'))
        self.editTime = False
        self.ckeckbEditTime.connect('clicked', self.ckeckbEditTimeClicked)
        hbox.pack_start(self.ckeckbEditTime, 0, 0)
        sg.add_widget(self.ckeckbEditTime)
        self.timeInput = TimeButton() ## ??????? options
        hbox.pack_start(self.timeInput, 0, 0)
        vb.pack_start(hbox, 0, 0)
        ###
        hbox = gtk.HBox()
        ##
        l = gtk.Label('')
        l.set_property('width-request', self.xpad)
        hbox.pack_start(l, 0, 0)
        ##
        self.ckeckbEditDate = gtk.CheckButton(_('Edit Date'))
        self.editDate = False
        self.ckeckbEditDate.connect('clicked', self.ckeckbEditDateClicked)
        hbox.pack_start(self.ckeckbEditDate, 0, 0)
        sg.add_widget(self.ckeckbEditDate)
        self.dateInput = DateButton() ## ??????? options
        hbox.pack_start(self.dateInput, 0, 0)
        vb.pack_start(hbox, 0, 0)
        ###
        self.vbox.pack_start(vb, 0, 0, 10)#?????
        self.vboxMan = vb
        ######
        hbox = gtk.HBox()
        self.radioNtp = gtk.RadioButton(self.radioMan, _('Set from _NTP:'), True)
        self.radioNtp.connect('clicked', self.radioNtpClicked)
        hbox.pack_start(self.radioNtp, 0, 0)
        self.vbox.pack_start(hbox, 0, 0)
        ###
        hbox = gtk.HBox()
        ##
        l = gtk.Label('')
        l.set_property('width-request', self.xpad)
        hbox.pack_start(l, 0, 0)
        ##
        hbox.pack_start(gtk.Label(_('Server:')+' '), 0, 0)
        combo = gtk.combo_box_entry_new_text()
        combo.child.connect('changed', self.updateSetButtonSensitive)
        hbox.pack_start(combo, 1, 1)
        self.ntpServerEntry = combo.child
        for s in ui.ntpServers:
            combo.append_text(s)
        combo.set_active(0)
        self.hboxNtp = hbox
        self.vbox.pack_start(hbox, 0, 0)
        ######
        self.radioManClicked()
        #self.radioNtpClicked()
        self.ckeckbEditTimeClicked()
        self.ckeckbEditDateClicked()
        ######
        self.updateTimes()
        self.vbox.show_all()
    def radioManClicked(self, radio=None):
        if self.radioMan.get_active():
            self.vboxMan.set_sensitive(True)
            self.hboxNtp.set_sensitive(False)
        else:
            self.vboxMan.set_sensitive(False)
            self.hboxNtp.set_sensitive(True)
        self.updateSetButtonSensitive()
    def radioNtpClicked(self, radio=None):
        if self.radioNtp.get_active():
            self.vboxMan.set_sensitive(False)
#.........这里部分代码省略.........
开发者ID:ErfanBagheri,项目名称:starcal,代码行数:101,代码来源:adjust_dtime.py


示例19: EventWidget

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,代码行数:97,代码来源:task.py


示例20: __init__

 def __init__(self):## parent FIXME
     gtk.Dialog.__init__(self)
     self.set_title(_('Tune Hijri Monthes'))
     self.connect('delete-event', self.onDeleteEvent)
     ############
     self.altMode = 0
     self.altModeDesc = 'Gregorian'
     ############
     hbox = gtk.HBox()
     self.topLabel = gtk.Label()
     hbox.pack_start(self.topLabel, 0, 0)
     self.startDateInput = DateButton()
     self.startDateInput.set_editable(False)## FIXME
     self.startDateInput.connect('changed', lambda widget: self.updateEndDates())
     hbox.pack_start(self.startDateInput, 0, 0)
     self.vbox.pack_start(hbox, 0, 0)
     ############################
     treev = gtk.TreeView()
     trees = gtk.ListStore(int, str, str, int, str)## ym, yearShown, monthShown, monthLenCombo, endDateShown
     treev.set_model(trees)
     #treev.connect('cursor-changed', self.plugTreevCursorChanged)
     #treev.connect('row-activated', self.plugTreevRActivate)
     #treev.connect('button-press-event', self.plugTreevButtonPress)
     ###
     swin = gtk.ScrolledWindow()
     swin.add(treev)
     swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Year'), cell, text=1)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Month'), cell, text=2)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererCombo()
     mLenModel = gtk.ListStore(int)
     mLenModel.append([29])
     mLenModel.append([30])
     cell.set_property('model', mLenModel)
     #cell.set_property('has-entry', False)
     cell.set_property('editable', True)
     cell.set_property('text-column', 0)
     cell.connect('edited', self.monthLenCellEdited)
     col = gtk.TreeViewColumn(_('Month Length'), cell, text=3)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('End Date'), cell, text=4)
     treev.append_column(col)
     ######
     self.treev = treev
     self.trees = trees
     self.vbox.pack_start(swin, 1, 1)
     ######
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK)
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL)
     ##
     resetB = self.add_button(gtk.STOCK_UNDO, gtk.RESPONSE_NONE)
     resetB.set_label(_('_Reset to Defaults'))
     resetB.set_image(gtk.image_new_from_stock(gtk.STOCK_UNDO, gtk.ICON_SIZE_BUTTON))
     resetB.connect('clicked', self.resetToDefaults)
     ##
     self.connect('response', self.onResponse)
     #print dir(self.get_action_area())
     #self.get_action_area().set_homogeneous(False)
     ######
     self.vbox.show_all()
开发者ID:karoon,项目名称:starcal2,代码行数:69,代码来源:hijri.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.toUnicode函数代码示例发布时间:2022-05-27
下一篇:
Python locale_man._函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap