本文整理汇总了Python中scal3.ui_gtk.mywidgets.multi_spin.date.DateButton.changeMode方法的典型用法代码示例。如果您正苦于以下问题:Python DateButton.changeMode方法的具体用法?Python DateButton.changeMode怎么用?Python DateButton.changeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scal3.ui_gtk.mywidgets.multi_spin.date.DateButton
的用法示例。
在下文中一共展示了DateButton.changeMode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
class WidgetClass(common.WidgetClass):
def __init__(self, event):
common.WidgetClass.__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.WidgetClass.updateWidget(self)
self.dateInput.set_value(self.event.getDate())
def updateVars(self):
common.WidgetClass.updateVars(self)
self.event.setDate(*self.dateInput.get_value())
def modeComboChanged(self, obj=None):
# overwrite method from common.WidgetClass
newMode = self.modeCombo.get_active()
self.dateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例2: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
class WidgetClass(common.WidgetClass):
def __init__(self, event):## FIXME
common.WidgetClass.__init__(self, event)
######
sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.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.WidgetClass.updateWidget(self)
self.startDateInput.set_value(self.event['start'].date)
self.endDateInput.set_value(self.event['end'].date)
def updateVars(self):## FIXME
common.WidgetClass.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.WidgetClass
newMode = self.modeCombo.get_active()
self.startDateInput.changeMode(self.event.mode, newMode)
self.endDateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例3: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
class WidgetClass(common.WidgetClass):
def __init__(self, event):## FIXME
common.WidgetClass.__init__(self, event)
######
sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.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.ComboBoxText()
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.WidgetClass.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.WidgetClass.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.WidgetClass
newMode = self.modeCombo.get_active()
self.startDateInput.changeMode(self.event.mode, newMode)
self.endDateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例4: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
#.........这里部分代码省略.........
######
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.ComboBoxText()
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.WidgetClass.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.WidgetClass.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.WidgetClass
newMode = self.modeCombo.get_active()
self.startDateInput.changeMode(self.event.mode, newMode)
self.endDateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例5: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
class WidgetClass(common.WidgetClass):
def __init__(self, event):## FIXME
common.WidgetClass.__init__(self, event)
######
sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.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(''), 1, 1)
pack(self, hbox)
######
hbox = gtk.HBox()
label = gtk.Label(_('Repeat Every '))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.weeksSpin = IntSpinButton(1, 99999)
pack(hbox, self.weeksSpin)
pack(hbox, gtk.Label(' '+_(' Weeks')))
###
pack(hbox, gtk.Label(''), 1, 1)
pack(self, hbox)
######
hbox = gtk.HBox()
label = gtk.Label(_('End'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.endDateInput = DateButton()
pack(hbox, self.endDateInput)
###
pack(hbox, gtk.Label(''), 1, 1)
pack(self, hbox)
#########
hbox = gtk.HBox()
label = gtk.Label(_('Time'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
##
self.dayTimeStartInput = HourMinuteButton()
self.dayTimeEndInput = HourMinuteButton()
##
pack(hbox, self.dayTimeStartInput)
pack(hbox, gtk.Label(' ' + _('to') + ' '))
pack(hbox, self.dayTimeEndInput)
pack(self, hbox)
#############
#self.notificationBox = common.NotificationBox(event)
#pack(self, self.notificationBox)
#############
#self.filesBox = common.FilesBox(self.event)
#pack(self, self.filesBox)
def updateWidget(self):## FIXME
common.WidgetClass.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.WidgetClass.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.WidgetClass
newMode = self.modeCombo.get_active()
self.startDateInput.changeMode(self.event.mode, newMode)
self.endDateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例6: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
#.........这里部分代码省略.........
sizeGroup.add_widget(label)
pack(hbox, label)
self.startDateInput = DateButton()
pack(hbox, self.startDateInput)
###
pack(hbox, gtk.Label(""), 1, 1)
pack(self, hbox)
######
hbox = gtk.HBox()
label = gtk.Label(_("Repeat Every "))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.weeksSpin = IntSpinButton(1, 99999)
pack(hbox, self.weeksSpin)
pack(hbox, gtk.Label(" " + _(" Weeks")))
###
pack(hbox, gtk.Label(""), 1, 1)
pack(self, hbox)
######
hbox = gtk.HBox()
label = gtk.Label(_("End"))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.endDateInput = DateButton()
pack(hbox, self.endDateInput)
###
pack(hbox, gtk.Label(""), 1, 1)
pack(self, hbox)
#########
hbox = gtk.HBox()
label = gtk.Label(_("Time"))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
##
self.dayTimeStartInput = HourMinuteButton()
self.dayTimeEndInput = HourMinuteButton()
##
pack(hbox, self.dayTimeStartInput)
pack(hbox, gtk.Label(" " + _("to") + " "))
pack(hbox, self.dayTimeEndInput)
pack(self, hbox)
#############
#self.notificationBox = common.NotificationBox(event)
#pack(self, self.notificationBox)
#############
#self.filesBox = common.FilesBox(self.event)
#pack(self, self.filesBox)
def updateWidget(self):## FIXME
common.WidgetClass.updateWidget(self)
mode = self.event.mode
###
self.startDateInput.set_value(jd_to(self.event.getStartJd(), mode))
###
cycleWeeks, ok = self.event["cycleWeeks"]
if not ok:
raise RuntimeError("no cycleWeeks rule")
self.weeksSpin.set_value(cycleWeeks.weeks)
###
self.endDateInput.set_value(jd_to(self.event.getEndJd(), mode))
###
dayTimeRange, ok = self.event["dayTimeRange"]
self.dayTimeStartInput.set_value(dayTimeRange.dayTimeStart)
self.dayTimeEndInput.set_value(dayTimeRange.dayTimeEnd)
def updateVars(self):## FIXME
common.WidgetClass.updateVars(self)
###
start, ok = self.event["start"]
if not ok:
raise RuntimeError("no start rule")
start.setDate(self.startDateInput.get_value())
###
end, ok = self.event["end"]
if not ok:
raise RuntimeError("no end rule")
end.setDate(self.endDateInput.get_value())
###
cycleWeeks, ok = self.event["cycleWeeks"]
if not ok:
raise RuntimeError("no cycleWeeks rule")
cycleWeeks.setData(self.weeksSpin.get_value())
###
dayTimeRange, ok = self.event["dayTimeRange"]
if not ok:
raise RuntimeError("no dayTimeRange rule")
dayTimeRange.setRange(
self.dayTimeStartInput.get_value(),
self.dayTimeEndInput.get_value(),
)
def modeComboChanged(self, obj=None):
# overwrite method from common.WidgetClass
newMode = self.modeCombo.get_active()
self.startDateInput.changeMode(self.event.mode, newMode)
self.endDateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例7: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
#.........这里部分代码省略.........
##
self.dayTimeStartCombo = HourMinuteButton()
self.dayTimeEndCombo = HourMinuteButton()
##
#self.dayTimeStartCombo.get_child().set_direction(gtk.TextDirection.LTR)
#self.dayTimeEndCombo.get_child().set_direction(gtk.TextDirection.LTR)
##
pack(hbox, self.dayTimeStartCombo)
pack(hbox, gtk.Label(' ' + _('to') + ' '))
pack(hbox, self.dayTimeEndCombo)
pack(self, hbox)
###########
#hbox = gtk.HBox()
#label = gtk.Label(_('Summary'))
#label.set_alignment(0, 0.5)
#sizeGroup.add_widget(label)
#pack(hbox, label)
#self.summaryEntry = gtk.Entry()
#pack(hbox, self.summaryEntry, 1, 1)
#pack(self, hbox)
#####
hbox = gtk.HBox()
label = gtk.Label(_('Description'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.descriptionInput = TextFrame()
pack(hbox, self.descriptionInput, 1, 1)
pack(self, hbox)
#####
hbox = gtk.HBox()
label = gtk.Label(_('Icon'))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.iconSelect = IconSelectButton()
#print(join(pixDir, self.icon))
pack(hbox, self.iconSelect)
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)
######
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'), ui.eventManDialog)
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.WidgetClass
newMode = self.modeCombo.get_active()
self.dateInput.changeMode(self.event.mode, newMode)
self.event.mode = newMode
示例8: WidgetClass
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import changeMode [as 别名]
class WidgetClass(BaseWidgetClass):
def __init__(self, group):
BaseWidgetClass.__init__(self, group)
####
hbox = gtk.HBox()
label = gtk.Label(_('Start'))
label.set_alignment(0, 0.5)
pack(hbox, label)
self.sizeGroup.add_widget(label)
self.startDateInput = DateButton()
pack(hbox, self.startDateInput)
pack(self, hbox)
###
hbox = gtk.HBox()
label = gtk.Label(_('End'))
label.set_alignment(0, 0.5)
pack(hbox, label)
self.sizeGroup.add_widget(label)
self.endDateInput = DateButton()
pack(hbox, self.endDateInput)
pack(self, hbox)
######
exp = gtk.Expander()
exp.set_label(_('Online Service'))
vbox = gtk.VBox()
exp.add(vbox)
sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
##
hbox = gtk.HBox()
label = gtk.Label(_('Account'))
label.set_alignment(0, 0.5)
pack(hbox, label)
sizeGroup.add_widget(label) ## FIXME
self.accountCombo = AccountCombo()
pack(hbox, self.accountCombo)
pack(vbox, hbox)
##
hbox = gtk.HBox()
label = gtk.Label(_('Remote Group'))
label.set_alignment(0, 0.5)
pack(hbox, label)
sizeGroup.add_widget(label) ## FIXME
accountGroupBox = AccountGroupBox(self.accountCombo)
pack(hbox, accountGroupBox, 1, 1)
pack(vbox, hbox)
self.accountGroupCombo = accountGroupBox.combo
##
pack(self, exp)
def updateWidget(self):
BaseWidgetClass.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))
###
if self.group.remoteIds:
aid, gid = self.group.remoteIds
else:
aid, gid = None, None
self.accountCombo.set_active(aid)
self.accountGroupCombo.set_active(gid)
def updateVars(self):
BaseWidgetClass.updateVars(self)
self.group.startJd = self.startDateInput.get_jd(self.group.mode)
self.group.endJd = self.endDateInput.get_jd(self.group.mode)
###
aid = self.accountCombo.get_active()
if aid:
gid = self.accountGroupCombo.get_active()
self.group.remoteIds = aid, gid
else:
self.group.remoteIds = None
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