本文整理汇总了Python中scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.hide方法的典型用法代码示例。如果您正苦于以下问题:Python DateButton.hide方法的具体用法?Python DateButton.hide怎么用?Python DateButton.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scal2.ui_gtk.mywidgets.multi_spin_button.DateButton
的用法示例。
在下文中一共展示了DateButton.hide方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EventWidget
# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import hide [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