本文整理汇总了Python中scal3.ui_gtk.mywidgets.multi_spin.date.DateButton.set_editable方法的典型用法代码示例。如果您正苦于以下问题:Python DateButton.set_editable方法的具体用法?Python DateButton.set_editable怎么用?Python DateButton.set_editable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scal3.ui_gtk.mywidgets.multi_spin.date.DateButton
的用法示例。
在下文中一共展示了DateButton.set_editable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EditDbDialog
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import set_editable [as 别名]
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, str, str, int, str)## ym, yearShown, monthShown, monthLenCombo, endDateShown
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, gtk.IconSize.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()
def resetToDefaults(self, widget):
if isfile(monthDb.userDbPath):
os.remove(monthDb.userDbPath)
monthDb.load()
self.updateWidget()
return True
def addClicked(self, obj=None):
last = self.trees[-1]
## 0 ym
## 1 yearLocale
## 2 monthLocale
## 3 mLen
#.........这里部分代码省略.........
示例2: EditDbDialog
# 需要导入模块: from scal3.ui_gtk.mywidgets.multi_spin.date import DateButton [as 别名]
# 或者: from scal3.ui_gtk.mywidgets.multi_spin.date.DateButton import set_editable [as 别名]
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(
#.........这里部分代码省略.........