本文整理汇总了Python中scal3.ui_gtk.mywidgets.multi_spin.date.DateButton类的典型用法代码示例。如果您正苦于以下问题:Python DateButton类的具体用法?Python DateButton怎么用?Python DateButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: WidgetClass
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
开发者ID:ilius,项目名称:starcal,代码行数:26,代码来源:dailyNote.py
示例2: __init__
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)
开发者ID:ilius,项目名称:starcal,代码行数:31,代码来源:lifeTime.py
示例3: __init__
def __init__(self, event):## FIXME
event.setJd(ui.cell.jd)
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(_("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(_("Day of Month"))
label.set_alignment(0, 0.5)
sizeGroup.add_widget(label)
pack(hbox, label)
self.daySpin = DaySpinButton()
pack(hbox, self.daySpin)
###
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)
开发者ID:ilius,项目名称:starcal,代码行数:52,代码来源:monthly.py
示例4: __init__
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)
开发者ID:greyzero,项目名称:starcal,代码行数:52,代码来源:weekly.py
示例5: WidgetClass
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
开发者ID:greyzero,项目名称:starcal,代码行数:48,代码来源:lifeTime.py
示例6: __init__
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)
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:47,代码来源:group.py
示例7: __init__
def __init__(self, saveIcsFunc, defaultFileName, **kwargs):
self.saveIcsFunc = saveIcsFunc
gtk.Dialog.__init__(self, **kwargs)
self.set_title(_("Export to %s") % "iCalendar")
## parent=None FIXME
#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.FileChooserAction.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
##
self.fcw.set_current_folder(core.deskDir)
if not defaultFileName.endswith(".ics"):
defaultFileName += ".ics"
self.fcw.set_current_name(defaultFileName)
开发者ID:ilius,项目名称:starcal,代码行数:47,代码来源:export.py
示例8: __init__
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)
开发者ID:greyzero,项目名称:starcal,代码行数:8,代码来源:dailyNote.py
示例9: __init__
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(" " + _("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)
开发者ID:ilius,项目名称:starcal,代码行数:45,代码来源:task.py
示例10: __init__
def __init__(self, rule):
self.rule = rule
###
gtk.ComboBox.__init__(self)
###
self.dateInput = DateButton()
pack(self, self.dateInput)
###
pack(self, gtk.Label(' '+_('Time')))
self.timeInput = TimeButton()
pack(self, self.timeInput)
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:11,代码来源:dateTime.py
示例11: WidgetClass
class WidgetClass(gtk.HBox):
def __init__(self, rule):
self.rule = rule
###
gtk.ComboBox.__init__(self)
###
self.dateInput = DateButton()
pack(self, self.dateInput)
###
pack(self, gtk.Label(" " + _("Time")))
self.timeInput = TimeButton()
pack(self, self.timeInput)
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:hedayat,项目名称:starcal,代码行数:26,代码来源:dateTime.py
示例12: __init__
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)
开发者ID:greyzero,项目名称:starcal,代码行数:37,代码来源:allDayTask.py
示例13: __init__
def __init__(self, rule):
self.rule = rule
DateButton.__init__(self)
开发者ID:greyzero,项目名称:starcal,代码行数:3,代码来源:date.py
示例14: EditDbDialog
class EditDbDialog(gtk.Dialog):
def __init__(self, **kwargs):
gtk.Dialog.__init__(self, **kwargs)
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()
pack(hbox, self.topLabel)
self.startDateInput = DateButton()
self.startDateInput.set_editable(False)## FIXME
self.startDateInput.connect("changed", lambda widget: self.updateEndDates())
pack(hbox, self.startDateInput)
pack(self.vbox, hbox)
############################
treev = gtk.TreeView()
trees = gtk.ListStore(
int, # ym (hidden)
str, # localized year
str, # localized month
int, # monthLenCombo
str, # localized endDate
)
treev.set_model(trees)
#treev.get_selection().connect("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.PolicyType.AUTOMATIC, gtk.PolicyType.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)
######
toolbar = gtk.Toolbar()
toolbar.set_orientation(gtk.Orientation.VERTICAL)
size = gtk.IconSize.SMALL_TOOLBAR
###
tb = toolButtonFromStock(gtk.STOCK_ADD, size)
set_tooltip(tb, _("Add"))
tb.connect("clicked", self.addClicked)
toolbar.insert(tb, -1)
###
tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
set_tooltip(tb, _("Delete"))
tb.connect("clicked", self.delClicked)
toolbar.insert(tb, -1)
######
self.treev = treev
self.trees = trees
#####
mainHbox = gtk.HBox()
pack(mainHbox, swin, 1, 1)
pack(mainHbox, toolbar)
pack(self.vbox, mainHbox, 1, 1)
######
dialog_add_button(
self,
gtk.STOCK_OK,
_("_OK"),
gtk.ResponseType.OK,
)
dialog_add_button(
self,
gtk.STOCK_CANCEL,
_("_Cancel"),
gtk.ResponseType.CANCEL,
)
##
resetB = self.add_button(
gtk.STOCK_UNDO,
gtk.ResponseType.NONE,
)
resetB.set_label(_("_Reset to Defaults"))
resetB.set_image(gtk.Image.new_from_stock(
#.........这里部分代码省略.........
开发者ID:ilius,项目名称:starcal,代码行数:101,代码来源:hijri.py
示例15: WidgetClass
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
开发者ID:greyzero,项目名称:starcal,代码行数:86,代码来源:allDayTask.py
示例16: __init__
def __init__(self, **kwargs):
gtk.Dialog.__init__(self, **kwargs)
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()
pack(hbox, self.topLabel)
self.startDateInput = DateButton()
self.startDateInput.set_editable(False)## FIXME
self.startDateInput.connect("changed", lambda widget: self.updateEndDates())
pack(hbox, self.startDateInput)
pack(self.vbox, hbox)
############################
treev = gtk.TreeView()
trees = gtk.ListStore(
int, # ym (hidden)
str, # localized year
str, # localized month
int, # monthLenCombo
str, # localized endDate
)
treev.set_model(trees)
#treev.get_selection().connect("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.PolicyType.AUTOMATIC, gtk.PolicyType.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)
######
toolbar = gtk.Toolbar()
toolbar.set_orientation(gtk.Orientation.VERTICAL)
size = gtk.IconSize.SMALL_TOOLBAR
###
tb = toolButtonFromStock(gtk.STOCK_ADD, size)
set_tooltip(tb, _("Add"))
tb.connect("clicked", self.addClicked)
toolbar.insert(tb, -1)
###
tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
set_tooltip(tb, _("Delete"))
tb.connect("clicked", self.delClicked)
toolbar.insert(tb, -1)
######
self.treev = treev
self.trees = trees
#####
mainHbox = gtk.HBox()
pack(mainHbox, swin, 1, 1)
pack(mainHbox, toolbar)
pack(self.vbox, mainHbox, 1, 1)
######
dialog_add_button(
self,
gtk.STOCK_OK,
_("_OK"),
gtk.ResponseType.OK,
)
dialog_add_button(
self,
gtk.STOCK_CANCEL,
_("_Cancel"),
gtk.ResponseType.CANCEL,
)
##
resetB = self.add_button(
gtk.STOCK_UNDO,
gtk.ResponseType.NONE,
)
resetB.set_label(_("_Reset to Defaults"))
resetB.set_image(gtk.Image.new_from_stock(
gtk.STOCK_UNDO,
#.........这里部分代码省略.........
开发者ID:ilius,项目名称:starcal,代码行数:101,代码来源:hijri.py
示例17: WidgetClass
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(" " + _("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):
#.........这里部分代码省略.........
开发者ID:ilius,项目名称:starcal,代码行数:101,代码来源:task.py
示例18: WidgetClass
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
开发者ID:ubuntu-ir,项目名称:starcal,代码行数:75,代码来源:group.py
示例19: WidgetClass
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
开发者ID:greyzero,项目名称:starcal,代码行数:85,代码来源:weekly.py
示例20: __init__
def __init__(self, **kwargs):
gtk.Dialog.__init__(self, **kwargs)
self.set_title(_("Adjust System Date & Time")) ##????????
self.set_icon(self.render_icon(gtk.STOCK_PREFERENCES, gtk.IconSize.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:"))
pack(hbox, self.label_cur)
pack(self.vbox, hbox)
#########
hbox = gtk.HBox()
self.radioMan = gtk.RadioButton(None, _("Set _Manully:"), True)
self.radioMan.connect("clicked", self.radioManClicked)
pack(hbox, self.radioMan)
pack(self.vbox, hbox)
######
vb = gtk.VBox()
sg = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
###
hbox = gtk.HBox()
##
l = gtk.Label("")
l.set_property("width-request", self.xpad)
pack(hbox, l)
##
self.ckeckbEditTime = gtk.CheckButton(_("Edit Time"))
self.editTime = False
self.ckeckbEditTime.connect("clicked", self.ckeckbEditTimeClicked)
pack(hbox, self.ckeckbEditTime)
sg.add_widget(self.ckeckbEditTime)
self.timeInput = TimeButton() ## ??????? options
pack(hbox, self.timeInput)
pack(vb, hbox)
###
hbox = gtk.HBox()
##
l = gtk.Label("")
l.set_property("width-request", self.xpad)
pack(hbox, l)
##
self.ckeckbEditDate = gtk.CheckButton(_("Edit Date"))
self.editDate = False
self.ckeckbEditDate.connect("clicked", self.ckeckbEditDateClicked)
pack(hbox, self.ckeckbEditDate)
sg.add_widget(self.ckeckbEditDate)
self.dateInput = DateButton() ## ??????? options
pack(hbox, self.dateInput)
pack(vb, hbox)
###
pack(self.vbox, vb, 0, 0, 10) # ?????
self.vboxMan = vb
######
hbox = gtk.HBox()
self.radioNtp = gtk.RadioButton(group=self.radioMan, label=_("Set from NTP:"))
self.radioNtp.connect("clicked", self.radioNtpClicked)
pack(hbox, self.radioNtp)
pack(self.vbox, hbox)
###
hbox = gtk.HBox()
##
l = gtk.Label("")
l.set_property("width-request", self.xpad)
pack(hbox, l)
##
pack(hbox, gtk.Label(_("Server:") + " "))
combo = gtk.ComboBoxText.new_with_entry()
combo.get_child().connect("changed", self.updateSetButtonSensitive)
pack(hbox, combo, 1, 1)
self.ntpServerEntry = combo.get_child()
for s in ui.ntpServers:
combo.append_text(s)
combo.set_active(0)
self.hboxNtp = hbox
pack(self.vbox, hbox)
######
self.radioManClicked()
# self.radioNtpClicked()
self.ckeckbEditTimeClicked()
self.ckeckbEditDateClicked()
######
self.updateTimes()
self.vbox.show_all()
开发者ID:ilius,项目名称:starcal,代码行数:87,代码来源:adjust_dtime.py
注:本文中的scal3.ui_gtk.mywidgets.multi_spin.date.DateButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论