Ejemplo n.º 1
0
 def __init__(self, defaultValue=''):
     self.defaultValue = defaultValue
     #####
     gtk.HBox.__init__(self)
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(False)
     self.trees = gtk.ListStore(str)
     self.treev.set_model(self.trees)
     ##########
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     col = gtk.TreeViewColumn('', cell, text=0)
     self.treev.append_column(col)
     ####
     self.pack_start(self.treev, 1, 1)
     ##########
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     #try:## DeprecationWarning #?????????????
         #toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
         ### no different (argument to set_icon_size does not affect) ?????????
     #except:
     #    pass
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##no different(argument2 to image_new_from_stock does not affect) ?????????
     #### gtk.ICON_SIZE_SMALL_TOOLBAR or gtk.ICON_SIZE_MENU
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpClicked)
     toolbar.insert(tb, -1)
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownClicked)
     toolbar.insert(tb, -1)
     #######
     self.pack_start(toolbar, 0, 0)
Ejemplo n.º 2
0
 def __init__(self, defaultValue=''):
     self.defaultValue = defaultValue
     #####
     gtk.HBox.__init__(self)
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(False)
     self.trees = gtk.ListStore(str)
     self.treev.set_model(self.trees)
     ##########
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     col = gtk.TreeViewColumn('', cell, text=0)
     self.treev.append_column(col)
     ####
     pack(self, self.treev, 1, 1)
     ##########
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     #try:## DeprecationWarning #?????????????
     #toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
     ### no different (argument to set_icon_size does not affect) ?????????
     #except:
     #	pass
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##no different(argument2 to image_new_from_stock does not affect) ?????????
     #### gtk.ICON_SIZE_SMALL_TOOLBAR or gtk.ICON_SIZE_MENU
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpClicked)
     toolbar.insert(tb, -1)
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownClicked)
     toolbar.insert(tb, -1)
     #######
     pack(self, toolbar)
Ejemplo n.º 3
0
 def __init__(self, term):
     self.term = term
     #####
     gtk.HBox.__init__(self)
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(False)
     self.trees = gtk.ListStore(str)
     self.treev.set_model(self.trees)
     ##########
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.timeEdited)
     col = gtk.TreeViewColumn(_('Time'), cell, text=0)
     self.treev.append_column(col)
     ####
     pack(self, self.treev, 1, 1)
     ##########
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     #try:## DeprecationWarning #?????????????
         #toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
         ### no different (argument to set_icon_size does not affect) ?????????
     #except:
     #    pass
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##no different(argument2 to image_new_from_stock does not affect) ?????????
     #### gtk.ICON_SIZE_SMALL_TOOLBAR or gtk.ICON_SIZE_MENU
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _('Delete'))
     tb.connect('clicked', self.deleteClicked)
     toolbar.insert(tb, -1)
     #self.buttonDel = tb
     #######
     pack(self, toolbar)
Ejemplo n.º 4
0
 def __init__(self, rule):
     self.rule = rule
     gtk.HBox.__init__(self)
     ###
     self.countLabel = gtk.Label("")
     self.pack_start(self.countLabel, 0, 0)
     ###
     self.editButton = gtk.Button(_("Edit"))
     self.editButton.set_image(gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
     self.editButton.connect("clicked", self.showDialog)
     self.pack_start(self.editButton, 0, 0)
     ###
     self.dialog = gtk.Dialog(title=rule.desc)
     ##
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(True)
     self.trees = gtk.ListStore(str)
     self.treev.set_model(self.trees)
     ##
     cell = gtk.CellRendererText()
     cell.set_property("editable", True)
     cell.connect("edited", self.dateCellEdited)
     col = gtk.TreeViewColumn(_("Date"), cell, text=0)
     self.treev.append_column(col)
     ##
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _("Add"))
     tb.connect("clicked", self.addClicked)
     toolbar.insert(tb, -1)
     # self.buttonAdd = tb
     ##
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _("Delete"))
     tb.connect("clicked", self.deleteClicked)
     toolbar.insert(tb, -1)
     # self.buttonDel = tb
     ##
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _("Move up"))
     tb.connect("clicked", self.moveUpClicked)
     toolbar.insert(tb, -1)
     ##
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _("Move down"))
     tb.connect("clicked", self.moveDownClicked)
     toolbar.insert(tb, -1)
     ##
     dialogHbox = gtk.HBox()
     dialogHbox.pack_start(self.treev, 1, 1)
     dialogHbox.pack_start(toolbar, 0, 0)
     self.dialog.vbox.pack_start(dialogHbox, 1, 1)
     self.dialog.vbox.show_all()
     self.dialog.resize(200, 300)
     self.dialog.connect("response", lambda w, e: self.dialog.hide())
     ##
     okButton = self.dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_CANCEL)
     if ui.autoLocale:
         okButton.set_label(_("_OK"))
         okButton.set_image(gtk.image_new_from_stock(gtk.STOCK_OK, gtk.ICON_SIZE_BUTTON))
Ejemplo n.º 5
0
 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()
     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.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)
     ######
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_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.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()
Ejemplo n.º 6
0
 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()
     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.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)
     ######
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_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.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()
Ejemplo n.º 7
0
 def __init__(
     self,
     term,
     defaultCourseName=_('New Course'),
     defaultCourseUnits=3,
     enableScrollbars=False,
 ):
     self.term = term  ## UniversityTerm obj
     self.defaultCourseName = defaultCourseName
     self.defaultCourseUnits = defaultCourseUnits
     #####
     gtk.HBox.__init__(self)
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(True)
     self.trees = gtk.ListStore(int, str, int)
     self.treev.set_model(self.trees)
     ##########
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.courseNameEdited)
     #cell.connect('editing-started', lambda cell0, editable, path:
     #	sys.stdout.write('editing-started %s\n'%path))
     #cell.connect('editing-canceled', lambda cell0:sys.stdout.write('editing-canceled\n'))
     col = gtk.TreeViewColumn(_('Course Name'), cell, text=1)
     self.treev.append_column(col)
     ###
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.courseUnitsEdited)
     col = gtk.TreeViewColumn(_('Units'), cell, text=2)
     self.treev.append_column(col)
     ####
     if enableScrollbars:  ## FIXME
         swin = gtk.ScrolledWindow()
         swin.add(self.treev)
         swin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
         pack(self, swin, 1, 1)
     else:
         pack(self, self.treev, 1, 1)
     ##########
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     #try:## DeprecationWarning #?????????????
     #toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
     ### no different (argument to set_icon_size does not affect) ?????????
     #except:
     #	pass
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##no different(argument2 to image_new_from_stock does not affect) ?????????
     #### gtk.ICON_SIZE_SMALL_TOOLBAR or gtk.ICON_SIZE_MENU
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _('Delete'))
     tb.connect('clicked', self.deleteClicked)
     toolbar.insert(tb, -1)
     #self.buttonDel = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpClicked)
     toolbar.insert(tb, -1)
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownClicked)
     toolbar.insert(tb, -1)
     #######
     pack(self, toolbar)
Ejemplo n.º 8
0
 def __init__(self, widget):
     gtk.Dialog.__init__(self)
     self.set_title(_('Customize'))
     self.set_has_separator(False)
     self.connect('delete-event', self.close)
     dialog_add_button(self, gtk.STOCK_CLOSE, _('_Close'), 0, self.close)
     ###
     self.widget = widget
     self.activeOptionsWidget = None
     ###
     self.model = gtk.TreeStore(bool, str) ## (gdk.Pixbuf, str)
     treev = self.treev = gtk.TreeView(self.model)
     ##
     treev.set_enable_tree_lines(True)
     treev.set_headers_visible(False)
     treev.connect('row-activated', self.rowActivated)
     ##
     col = gtk.TreeViewColumn('Widget')
     ##
     cell = gtk.CellRendererToggle()
     cell.connect('toggled', self.enableCellToggled)
     col.pack_start(cell, expand=False)
     col.add_attribute(cell, 'active', 0)
     ##
     treev.append_column(col)
     col = gtk.TreeViewColumn('Widget')
     ##
     cell = gtk.CellRendererText()
     col.pack_start(cell, expand=False)
     col.add_attribute(cell, 'text', 1)
     ##
     treev.append_column(col)
     ###
     for item in widget.items:
         if isinstance(item, CustomizableCalObj):
             self.appendItemTree(item, None)
     ###
     hbox = gtk.HBox()
     vbox_l = gtk.VBox()
     vbox_l.pack_start(treev, 1, 1)
     hbox.pack_start(vbox_l, 1, 1)
     ###
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     toolbar.set_icon_size(size)
     ## argument2 to image_new_from_stock does not affect
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.upClicked)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.downClicked)
     toolbar.insert(tb, -1)
     ###
     hbox.pack_start(toolbar, 0, 0)
     self.vbox.pack_start(hbox, 1, 1)
     self.vbox_l = vbox_l
     ###
     self.vbox.connect('size-request', self.vboxSizeRequest)
     self.vbox.show_all()
     treev.connect('cursor-changed', self.treevCursorChanged)
Ejemplo n.º 9
0
 def __init__(self, term, defaultCourseName=_('New Course'), defaultCourseUnits=3, enableScrollbars=False):
     self.term = term ## UniversityTerm obj
     self.defaultCourseName = defaultCourseName
     self.defaultCourseUnits = defaultCourseUnits
     #####
     gtk.HBox.__init__(self)
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(True)
     self.trees = gtk.ListStore(int, str, int)
     self.treev.set_model(self.trees)
     ##########
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.courseNameEdited)
     #cell.connect('editing-started', lambda cell0, editable, path:
     #    sys.stdout.write('editing-started %s\n'%path))
     #cell.connect('editing-canceled', lambda cell0:sys.stdout.write('editing-canceled\n'))
     col = gtk.TreeViewColumn(_('Course Name'), cell, text=1)
     self.treev.append_column(col)
     ###
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.courseUnitsEdited)
     col = gtk.TreeViewColumn(_('Units'), cell, text=2)
     self.treev.append_column(col)
     ####
     if enableScrollbars:## FIXME
         swin = gtk.ScrolledWindow()
         swin.add(self.treev)
         swin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
         self.pack_start(swin, 1, 1)
     else:
         self.pack_start(self.treev, 1, 1)
     ##########
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     #try:## DeprecationWarning #?????????????
         #toolbar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR)
         ### no different (argument to set_icon_size does not affect) ?????????
     #except:
     #    pass
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##no different(argument2 to image_new_from_stock does not affect) ?????????
     #### gtk.ICON_SIZE_SMALL_TOOLBAR or gtk.ICON_SIZE_MENU
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _('Delete'))
     tb.connect('clicked', self.deleteClicked)
     toolbar.insert(tb, -1)
     #self.buttonDel = tb
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpClicked)
     toolbar.insert(tb, -1)
     ####
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownClicked)
     toolbar.insert(tb, -1)
     #######
     self.pack_start(toolbar, 0, 0)
Ejemplo n.º 10
0
 def __init__(self, rule):
     self.rule = rule
     gtk.HBox.__init__(self)
     ###
     self.countLabel = gtk.Label('')
     pack(self, self.countLabel)
     ###
     self.editButton = gtk.Button(_('Edit'))
     self.editButton.set_image(
         gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
     self.editButton.connect('clicked', self.showDialog)
     pack(self, self.editButton)
     ###
     self.dialog = gtk.Dialog(title=rule.desc)
     ##
     self.treev = gtk.TreeView()
     self.treev.set_headers_visible(True)
     self.trees = gtk.ListStore(str)
     self.treev.set_model(self.trees)
     ##
     cell = gtk.CellRendererText()
     cell.set_property('editable', True)
     cell.connect('edited', self.dateCellEdited)
     col = gtk.TreeViewColumn(_('Date'), cell, text=0)
     self.treev.append_column(col)
     ##
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ##
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     #self.buttonAdd = tb
     ##
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _('Delete'))
     tb.connect('clicked', self.deleteClicked)
     toolbar.insert(tb, -1)
     #self.buttonDel = tb
     ##
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpClicked)
     toolbar.insert(tb, -1)
     ##
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownClicked)
     toolbar.insert(tb, -1)
     ##
     dialogHbox = gtk.HBox()
     pack(dialogHbox, self.treev, 1, 1)
     pack(dialogHbox, toolbar)
     pack(self.dialog.vbox, dialogHbox, 1, 1)
     self.dialog.vbox.show_all()
     self.dialog.resize(200, 300)
     self.dialog.connect('response', lambda w, e: self.dialog.hide())
     ##
     okButton = self.dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_CANCEL)
     if ui.autoLocale:
         okButton.set_label(_('_OK'))
         okButton.set_image(
             gtk.image_new_from_stock(gtk.STOCK_OK, gtk.ICON_SIZE_BUTTON))
Ejemplo n.º 11
0
 def __init__(self):
     gtk.Dialog.__init__(self)
     self.initVars()
     ud.windowList.appendItem(self)
     ####
     self.syncing = None ## or a tuple of (groupId, statusText)
     self.groupIterById = {}
     self.trashIter = None
     self.isLoaded = False
     ####
     self.set_title(_('Event Manager'))
     self.resize(600, 300)
     self.connect('delete-event', self.onDeleteEvent)
     self.set_transient_for(None)
     self.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)
     ##
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK)
     #self.connect('response', lambda w, e: self.hide())
     self.connect('response', self.onResponse)
     self.connect('show', self.onShow)
     #######
     self.searchWin = EventSearchWindow()
     #######
     menubar = gtk.MenuBar()
     ####
     fileItem = gtk.MenuItem(_('_File'))
     fileMenu = gtk.Menu()
     fileItem.set_submenu(fileMenu)
     menubar.append(fileItem)
     ##
     addGroupItem = gtk.MenuItem(_('Add New Group'))
     addGroupItem.connect('activate', self.addGroupBeforeSelection)
     ## or before selected group? FIXME
     fileMenu.append(addGroupItem)
     ##
     searchItem = gtk.MenuItem(_('_Search Events'))## FIXME right place?
     searchItem.connect('activate', self.mbarSearchClicked)
     fileMenu.append(searchItem)
     ##
     exportItem = gtk.MenuItem(_('_Export'))
     exportItem.connect('activate', self.mbarExportClicked)
     fileMenu.append(exportItem)
     ##
     importItem = gtk.MenuItem(_('_Import'))
     importItem.connect('activate', self.mbarImportClicked)
     fileMenu.append(importItem)
     ##
     orphanItem = gtk.MenuItem(_('Check for Orphan Events'))
     orphanItem.connect('activate', self.mbarOrphanClicked)
     fileMenu.append(orphanItem)
     ####
     editItem = gtk.MenuItem(_('_Edit'))
     editMenu = gtk.Menu()
     editItem.set_submenu(editMenu)
     menubar.append(editItem)
     ##
     editEditItem = gtk.MenuItem(_('Edit'))
     editEditItem.connect('activate', self.mbarEditClicked)
     editMenu.append(editEditItem)
     editMenu.connect('show', self.mbarEditMenuPopup)
     self.mbarEditItem = editEditItem
     ##
     editMenu.append(gtk.SeparatorMenuItem())
     ##
     cutItem = gtk.MenuItem(_('Cu_t'))
     cutItem.connect('activate', self.mbarCutClicked)
     editMenu.append(cutItem)
     self.mbarCutItem = cutItem
     ##
     copyItem = gtk.MenuItem(_('_Copy'))
     copyItem.connect('activate', self.mbarCopyClicked)
     editMenu.append(copyItem)
     self.mbarCopyItem = copyItem
     ##
     pasteItem = gtk.MenuItem(_('_Paste'))
     pasteItem.connect('activate', self.mbarPasteClicked)
     editMenu.append(pasteItem)
     self.mbarPasteItem = pasteItem
     ##
     editMenu.append(gtk.SeparatorMenuItem())
     ##
     dupItem = gtk.MenuItem(_('_Duplicate'))
     dupItem.connect('activate', self.duplicateSelectedObj)
     editMenu.append(dupItem)
     self.mbarDupItem = dupItem
     ####
     viewItem = gtk.MenuItem(_('_View'))
     viewMenu = gtk.Menu()
     viewItem.set_submenu(viewMenu)
     menubar.append(viewItem)
     ##
     collapseItem = gtk.MenuItem(_('Collapse All'))
     collapseItem.connect('activate', self.collapseAllClicked)
     viewMenu.append(collapseItem)
     ##
     expandItem = gtk.MenuItem(_('Expand All'))
     expandItem.connect('activate', self.expandAllClicked)
     viewMenu.append(expandItem)
     ##
     viewMenu.append(gtk.SeparatorMenuItem())
     ##
     self.showDescItem = gtk.CheckMenuItem(_('Show _Description'))
     self.showDescItem.set_active(ui.eventManShowDescription)
     self.showDescItem.connect('toggled', self.showDescItemToggled)
     viewMenu.append(self.showDescItem)
     ####
     #testItem = gtk.MenuItem(_('Test'))
     #testMenu = gtk.Menu()
     #testItem.set_submenu(testMenu)
     #menubar.append(testItem)
     ###
     #item = gtk.MenuItem('')
     #item.connect('activate', )
     #testMenu.append(item)
     ####
     menubar.show_all()
     pack(self.vbox, menubar)
     #######
     treeBox = gtk.HBox()
     #####
     self.treev = gtk.TreeView()
     self.treev.set_search_column(2)
     #self.treev.set_headers_visible(False)## FIXME
     #self.treev.get_selection().set_mode(gtk.SELECTION_MULTIPLE)## FIXME
     #self.treev.set_rubber_banding(gtk.SELECTION_MULTIPLE)## FIXME
     #self.treev.connect('realize', self.onTreeviewRealize)
     self.treev.connect('cursor-changed', self.treeviewCursorChanged)## FIXME
     self.treev.connect('button-press-event', self.treeviewButtonPress)
     self.treev.connect('row-activated', self.rowActivated)
     self.treev.connect('key-press-event', self.keyPress)
     #####
     swin = gtk.ScrolledWindow()
     swin.add(self.treev)
     swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     pack(treeBox, swin, 1, 1)
     ###
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.moveUpByButton)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.moveDownByButton)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_COPY, size)
     set_tooltip(tb, _('Duplicate'))
     tb.connect('clicked', self.duplicateSelectedObj)
     toolbar.insert(tb, -1)
     ###
     pack(treeBox, toolbar)
     #####
     pack(self.vbox, treeBox, 1, 1)
     #######
     self.trees = gtk.TreeStore(int, gdk.Pixbuf, str, str)
     ## event: eid,  event_icon,   event_summary, event_description
     ## group: gid,  group_pixbuf, group_title,   ?description
     ## trash: -1,        trash_icon,   _('Trash'),    ''
     self.treev.set_model(self.trees)
     ###
     col = gtk.TreeViewColumn()
     cell = gtk.CellRendererPixbuf()
     pack(col, cell)
     col.add_attribute(cell, 'pixbuf', 1)
     self.treev.append_column(col)
     ###
     col = gtk.TreeViewColumn(
         _('Summary'),
         gtk.CellRendererText(),
         text=2,
     )
     col.set_resizable(True)
     self.treev.append_column(col)
     ###
     self.colDesc = gtk.TreeViewColumn(
         _('Description'),
         gtk.CellRendererText(),
         text=3,
     )
     if ui.eventManShowDescription:
         self.treev.append_column(self.colDesc)
     ###
     #self.treev.set_search_column(2)## or 3
     ###
     self.toPasteEvent = None ## (path, bool move)
     #####
     self.sbar = gtk.Statusbar()
     self.sbar.set_direction(gtk.TEXT_DIR_LTR)
     #self.sbar.set_has_resize_grip(False)
     pack(self.vbox, self.sbar)
     #####
     self.vbox.show_all()
Ejemplo n.º 12
0
 def __init__(self, widget):
     gtk.Dialog.__init__(self)
     self.set_title(_('Customize'))
     self.set_has_separator(False)
     self.connect('delete-event', self.close)
     dialog_add_button(self, gtk.STOCK_CLOSE, _('_Close'), 0, self.close)
     ###
     self._widget = widget
     self.activeOptionsWidget = None
     ###
     self.model = gtk.TreeStore(bool, str)  ## (gdk.Pixbuf, str)
     treev = self.treev = gtk.TreeView(self.model)
     ##
     treev.set_enable_tree_lines(True)
     treev.set_headers_visible(False)
     treev.connect('row-activated', self.rowActivated)
     ##
     col = gtk.TreeViewColumn('Widget')
     ##
     cell = gtk.CellRendererToggle()
     cell.connect('toggled', self.enableCellToggled)
     pack(col, cell)
     col.add_attribute(cell, 'active', 0)
     ##
     treev.append_column(col)
     col = gtk.TreeViewColumn('Widget')
     ##
     cell = gtk.CellRendererText()
     pack(col, cell)
     col.add_attribute(cell, 'text', 1)
     ##
     treev.append_column(col)
     ###
     for item in widget.items:
         if item.customizable:
             self.appendItemTree(item, None)
     ###
     hbox = gtk.HBox()
     vbox_l = gtk.VBox()
     pack(vbox_l, treev, 1, 1)
     pack(hbox, vbox_l, 1, 1)
     ###
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
     size = gtk.ICON_SIZE_SMALL_TOOLBAR
     toolbar.set_icon_size(size)
     ## argument2 to image_new_from_stock does not affect
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.upClicked)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.downClicked)
     toolbar.insert(tb, -1)
     ###
     pack(hbox, toolbar)
     pack(self.vbox, hbox, 1, 1)
     self.vbox_l = vbox_l
     ###
     self.vbox.connect('size-request', self.vboxSizeRequest)
     self.vbox.show_all()
     treev.get_selection().connect('changed', self.treevCursorChanged)