本文整理匯總了Python中scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.show方法的典型用法代碼示例。如果您正苦於以下問題:Python DateButton.show方法的具體用法?Python DateButton.show怎麽用?Python DateButton.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scal2.ui_gtk.mywidgets.multi_spin_button.DateButton
的用法示例。
在下文中一共展示了DateButton.show方法的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 show [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