当前位置: 首页>>代码示例>>Python>>正文


Python DateButton.connect方法代码示例

本文整理汇总了Python中scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python DateButton.connect方法的具体用法?Python DateButton.connect怎么用?Python DateButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scal2.ui_gtk.mywidgets.multi_spin_button.DateButton的用法示例。


在下文中一共展示了DateButton.connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: EditDbDialog

# 需要导入模块: from scal2.ui_gtk.mywidgets.multi_spin_button import DateButton [as 别名]
# 或者: from scal2.ui_gtk.mywidgets.multi_spin_button.DateButton import connect [as 别名]
class EditDbDialog(gtk.Dialog):
    def __init__(self):## parent FIXME
        gtk.Dialog.__init__(self)
        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()
        hbox.pack_start(self.topLabel, 0, 0)
        self.startDateInput = DateButton()
        self.startDateInput.set_editable(False)## FIXME
        self.startDateInput.connect('changed', lambda widget: self.updateEndDates())
        hbox.pack_start(self.startDateInput, 0, 0)
        self.vbox.pack_start(hbox, 0, 0)
        ############################
        treev = gtk.TreeView()
        trees = gtk.ListStore(int, str, str, int, str)## ym, yearShown, monthShown, monthLenCombo, endDateShown
        treev.set_model(trees)
        #treev.connect('cursor-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.POLICY_AUTOMATIC, gtk.POLICY_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)
        ######
        self.treev = treev
        self.trees = trees
        self.vbox.pack_start(swin, 1, 1)
        ######
        dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK)
        dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL)
        ##
        resetB = self.add_button(gtk.STOCK_UNDO, gtk.RESPONSE_NONE)
        resetB.set_label(_('_Reset to Defaults'))
        resetB.set_image(gtk.image_new_from_stock(gtk.STOCK_UNDO, gtk.ICON_SIZE_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 updateWidget(self):
        #for index, module in enumerate(core.modules):
        #    if module.name != 'hijri':
        for item in ui.shownCals:
            mode = item['mode']
            modeDesc = moduleDescNames[mode]
            if not 'hijri' in modeDesc.lower():
                self.altMode = mode
                self.altModeDesc = modeDesc
                break
        self.topLabel.set_label(_('Start')+': '+dateLocale(*monthDb.startDate)+' '+_('Equals to')+' %s'%_(self.altModeDesc))
        self.startDateInput.set_value(jd_to(monthDb.startJd, self.altMode))
        ###########
        selectYm = getCurrentYm() - 1 ## previous month
        selectIndex = None
        self.trees.clear()
        for index, ym, mLen in monthDb.getMonthLenList():
            if ym == selectYm:
                selectIndex = index
            (year, month0) = divmod(ym, 12)
            self.trees.append([
                ym,
                _(year),
                _(monthName[month0]),
#.........这里部分代码省略.........
开发者ID:karoon,项目名称:starcal2,代码行数:103,代码来源:hijri.py


注:本文中的scal2.ui_gtk.mywidgets.multi_spin_button.DateButton.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。