def _buttons(strFolder, layer, conf): hbbox = gtk.HButtonBox() hbbox.set_border_width(10) hbbox.set_layout(gtk.BUTTONBOX_SPREAD) menu = rclick_menu(layer, MAP_SERVERS.index(conf.map_service)) gtk.stock_add([(gtk.STOCK_HARDDISK, "_Download", 0, 0, "")]) self.b_download = gtk.Button(stock=gtk.STOCK_HARDDISK) self.b_download.connect('clicked', self.start_download, strFolder) self.b_download.connect('event', download_rclick, menu) hbbox.pack_start(self.b_download) hbox = gtk.HBox() gtk.stock_add([(gtk.STOCK_UNDELETE, "", 0, 0, "")]) self.b_open = gtk.Button(stock=gtk.STOCK_UNDELETE) self.b_open.connect('clicked', self.do_open, strFolder) hbox.pack_start(self.b_open, padding=25) if isdir(fldDown): hbbox.pack_start(hbox) self.b_pause = gtk.Button(stock='gtk-media-pause') self.b_pause.connect('clicked', self.do_pause) self.b_pause.set_sensitive(False) hbbox.pack_start(self.b_pause) return hbbox
def register_stock_icons(): # virtual or conda environments as well as local installs might # not have access to the system stock items so we update the IconTheme search path. print("[Info] Updating IconTheme search paths") icon_theme = gtk.icon_theme_get_default() icon_paths = lookup_resource_paths(os.path.join('share', 'icons')) for ipath in icon_paths: icon_theme.prepend_search_path(ipath) ctrlshift = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK icons = [ ('odml-logo', '_odML', 0, 0, ''), ('odml_addSection', 'Add _Section', ctrlshift, ord("S"), ''), ('odml_addProperty', 'Add _Property', ctrlshift, ord("P"), ''), ('odml_addValue', 'Add _Value', ctrlshift, ord("V"), ''), ('odml_Dustbin', '_Delete', 0, 0, ''), ('INM6-compare-table', 'Compare_entities', ctrlshift, ord("E"), ''), ('INM6-convert-odml', 'Convert_document', ctrlshift, ord("C"), ''), ('INM6-filter-odml', 'Filter_document', ctrlshift, ord("F"), ''), ('INM6-merge-odml', 'Merge_documents', ctrlshift, ord("M"), '') ] # This method is failing (silently) in registering the stock icons. # Passing a list of Gtk.StockItem also has no effects. # To circumvent this, the *stock* and *label* properties of items # have been separated, wherever necessary. gtk.stock_add(icons) # The icons are being registered by the following steps. # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() for stock_icon in icons: icon_name = stock_icon[0] try: # Dependent on python environment and installation used, default gtk # and custom icons will be found at different locations. name = "%s.%s" % (icon_name, "png") img_dir = get_img_path(name) if not img_dir: print("[Warning] Icon %s not found in supported paths" % name) continue img_path = os.path.join(img_dir, name) icon = load_pixbuf(img_path) icon_set = gtk.IconSet.new_from_pixbuf(icon) for icon in load_icon_pixbufs(icon_name): src = gtk.IconSource() src.set_pixbuf(icon) icon_set.add_source(src) factory.add(icon_name, icon_set) except gobject.GError as error: print('[Warning] Failed to load icon', icon_name, error)
def load_icons(): items = [STOCK_ROTATE_LEFT, STOCK_ROTATE_RIGHT, STOCK_MOVE_TO_ORIGIN, STOCK_HOR_MIRROR, STOCK_VERT_MIRROR, STOCK_MULTIPLY] path = '' + os.path.join(config.resource_dir, 'icons') iconfactory = gtk.IconFactory() for item in items: gtk.stock_add([(item, '', 0, 0, ''), ]) pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(path, item + '.png')) source = gtk.IconSource() source.set_pixbuf(pixbuf) source.set_size_wildcarded(True) iconset = gtk.IconSet() iconset.add_source(source) iconfactory.add(item, iconset) #Creating aliased icons items = [(STOCK_CUTTING, _('_Cutting'), 0, 0, None), (STOCK_DONT_SAVE, _("_Don't save"), 0, 0, None), ] aliases = [(STOCK_CUTTING, gtk.STOCK_PRINT), (STOCK_DONT_SAVE, gtk.STOCK_NO), ] gtk.stock_add(items) for item, alias in aliases: iconset = gtk.icon_factory_lookup_default(alias) iconfactory.add(item, iconset) iconfactory.add_default()
def overwrite_stock(stock_id, new_accelerator): info = list(gtk.stock_lookup(stock_id)) keyval, mask = gtk.accelerator_parse(new_accelerator) info[2] = mask info[3] = keyval logger.debug(str(info)) gtk.stock_add([(info[0], info[1], info[2], info[3], info[4])])
def register_stock_icons(): ''' This function registers our custom toolbar icons, so they can be themed. ''' items = [('demo-gtk-logo', '_GTK!', 0, 0, '')] # Register our stock items gtk.stock_add(items) # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() import os img_dir = os.path.join(os.path.dirname(__file__), 'images') img_path = os.path.join(img_dir, 'gtk-logo-rgb.gif') try: pixbuf = gtk.gdk.pixbuf_new_from_file(img_path) # Register icon to accompany stock item # The gtk-logo-rgb icon has a white background, make it transparent # the call is wrapped to (gboolean, guchar, guchar, guchar) transparent = pixbuf.add_alpha(True, chr(255), chr(255), chr(255)) icon_set = gtk.IconSet(transparent) factory.add('demo-gtk-logo', icon_set) except gobject.GError, error: print 'failed to load GTK logo for toolbar'
def create_stock_icons(): """ Creates the pitivi-only stock icons """ gtk.stock_add([ ('pitivi-render', _('Render'), 0, 0, 'pitivi'), ('pitivi-split', _('Split'), 0, 0, 'pitivi'), ('pitivi-keyframe', _('Keyframe'), 0, 0, 'pitivi'), ('pitivi-unlink', _('Unlink'), 0, 0, 'pitivi'), # Translators: This is an action, the title of a button ('pitivi-link', _('Link'), 0, 0, 'pitivi'), ('pitivi-ungroup', _('Ungroup'), 0, 0, 'pitivi'), # Translators: This is an action, the title of a button ('pitivi-group', _('Group'), 0, 0, 'pitivi'), ]) pixmaps = { "pitivi-render" : "pitivi-render-24.png", "pitivi-split" : "pitivi-split-24.svg", "pitivi-keyframe" : "pitivi-keyframe-24.svg", "pitivi-unlink" : "pitivi-unlink-24.svg", "pitivi-link" : "pitivi-relink-24.svg", "pitivi-ungroup" : "pitivi-ungroup-24.svg", "pitivi-group" : "pitivi-group-24.svg", } factory = gtk.IconFactory() pmdir = get_pixmap_dir() for stockid, path in pixmaps.iteritems(): pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(pmdir, path)) iconset = gtk.IconSet(pixbuf) factory.add(stockid, iconset) factory.add_default()
def register_stock_icons(): try: import pygtk # pygtk.require('2.0') import gtk except: return items = [ ('jdh-hide', '_Hide', 0, 0, None), ('jdh-auto', '_Auto', 0, 0, None), ] # We're too lazy to make our own icons, so we use regular stock icons. aliases = [ ('jdh-hide', gtk.STOCK_CANCEL), ('jdh-auto', gtk.STOCK_EXECUTE), ] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() for new_stock, alias in aliases: icon_set = gtk.icon_factory_lookup_default(alias) factory.add(new_stock, icon_set)
def register_stock_icons(): ''' This function registers our custom toolbar icons, so they can be themed. ''' items = [('demo-gtk-logo', '_GTK!', 0, 0, '')] # Register our stock items gtk.stock_add(items) # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() import os img_dir = os.path.join(os.path.dirname(__file__), 'images') img_path = os.path.join(img_dir, 'gtk-logo-rgb.gif') try: pixbuf = gtk.gdk.pixbuf_new_from_file(img_path) # Register icon to accompany stock item # The gtk-logo-rgb icon has a white background, make it transparent # the call is wrapped to (gboolean, guchar, guchar, guchar) transparent = pixbuf.add_alpha(True, chr(255), chr(255),chr(255)) icon_set = gtk.IconSet(transparent) factory.add('demo-gtk-logo', icon_set) except gobject.GError, error: nuclasses.log_error('failed to load GTK logo for toolbar')
def _buttons(strFolder): hbbox = gtk.HButtonBox() hbbox.set_border_width(10) hbbox.set_layout(gtk.BUTTONBOX_SPREAD) gtk.stock_add([(gtk.STOCK_HARDDISK, "_Download", 0, 0, "")]) self.b_download = gtk.Button(stock=gtk.STOCK_HARDDISK) self.b_download.connect('clicked', self.run, conf.init_path, conf.repository_type, strFolder) hbbox.pack_start(self.b_download) hbox = gtk.HBox() gtk.stock_add([(gtk.STOCK_UNDELETE, "", 0, 0, "")]) self.b_open = gtk.Button(stock=gtk.STOCK_UNDELETE) self.b_open.connect('clicked', self.do_open, strFolder) hbox.pack_start(self.b_open, padding=25) if isdir(fldDown): hbbox.pack_start(hbox) self.b_pause = gtk.Button(stock='gtk-media-pause') self.b_pause.connect('clicked', self.do_pause) self.b_pause.set_sensitive(False) hbbox.pack_start(self.b_pause) return hbbox
def __action_buttons(self, strInfo, filePath, listStore, myTree, parent): bbox = gtk.HButtonBox() bbox.set_layout(gtk.BUTTONBOX_END) bbox.set_border_width(10) bbox.set_spacing(60) button = gtk.Button(stock=gtk.STOCK_ADD) button.connect('clicked', self.btn_add_clicked, listStore, myTree) bbox.add(button) gtk.stock_add([(gtk.STOCK_REMOVE, "_Delete", 0, 0, "")]) button = gtk.Button(stock=gtk.STOCK_REMOVE) button.connect('clicked', self.btn_remove_clicked, listStore, myTree) bbox.add(button) button = gtk.Button(stock=gtk.STOCK_REVERT_TO_SAVED) button.connect('clicked', self.btn_revert_clicked, strInfo, filePath, listStore, myTree) bbox.add(button) button = gtk.Button(stock=gtk.STOCK_SAVE) button.connect('clicked', self.btn_save_clicked, strInfo, filePath, listStore, parent) bbox.add(button) return bbox
def __init_stock_id(self): # # generate a new stock id # # TODO: do we have to create the stock id every time? self.__stock_id = str(uuid1()) # see http://article.gmane.org/gmane.comp.gnome.gtk%2B.python/5119 # TODO: what is this strange construct for? stock_items = ( ((self.__stock_id, "", 0, 0, "")), ) gtk.stock_add(stock_items) factory = gtk.IconFactory() factory.add_default() # TODO: use IconSource, the Pixbuf is just fallback pixbuf = gdk.pixbuf_new_from_file(self.icon.path) icon_set = gtk.IconSet(pixbuf) factory.add(self.__stock_id, icon_set)
def create_stock_items(self): # FIXME: Why don't these stock items work for buttons in win32? # Seem to work fine for images...hmm stock_items = (("mfe-general", "_General", 0, 0, "English"), ("mfe-engine", "_Engine", 0, 0, "English"), ("mfe-about", "_Info", 0, 0, "English"), ("mfe-clear", "", 0, 0, "English"), ("mfe-save", "", 0, 0, "English"), ("mfe-doc", "", 0, 0, "English"), ("mfe-license", "_License", 0, 0, "English"), ("mfe-help", "_Help", 0, 0, "English"), ("mfe-quit", "_Quit", 0, 0, "English"), ("mfe-play", "_Play", 0, 0, "English"), ("mfe-stop", "_Stop", 0, 0, "English")) stock_files = (("mfe-general", mfeconst.genimage), ("mfe-engine", mfeconst.engimage), ("mfe-about", mfeconst.aboutimage), ("mfe-clear", mfeconst.clearimage), ("mfe-save", mfeconst.saveimage), ("mfe-doc", mfeconst.docimage), ("mfe-license", mfeconst.licimage), ("mfe-help", mfeconst.helpimage), ("mfe-quit", mfeconst.quitimage), ("mfe-play", mfeconst.playimage), ("mfe-stop", mfeconst.stopimage)) gtk.stock_add(stock_items) factory = gtk.IconFactory() for item, path in stock_files: pixbuf = gtk.gdk.pixbuf_new_from_file(path) icon_set = gtk.IconSet(pixbuf) factory.add(item, icon_set) factory.add_default()
def add_stock_ids(self): ids = [ ('pyide-next', '_Next', gtk.gdk.CONTROL_MASK, gtk.keysyms.N, 'pyide'), ('pyide-step', '_Step', gtk.gdk.CONTROL_MASK, gtk.keysyms.S, 'pyide'), ('pyide-return', '_Return', gtk.gdk.CONTROL_MASK, gtk.keysyms.R, 'pyide'), ('pyide-continue', '_Continue', gtk.gdk.CONTROL_MASK, gtk.keysyms.C, 'pyide'), ('pyide-break', '_Break', gtk.gdk.CONTROL_MASK, gtk.keysyms.B, 'pyide'), ('pyide-edit', '_Edit', gtk.gdk.CONTROL_MASK, gtk.keysyms.E, 'pyide'), ('pyide-run', 'R_un', gtk.gdk.CONTROL_MASK, gtk.keysyms.U, 'pyide'), ('pyide-quit', '_Quit', gtk.gdk.CONTROL_MASK, gtk.keysyms.Q, 'pyide'), ] gtk.stock_add(ids) names = ['next', 'step', 'return', 'continue', 'break', 'edit', 'run', 'quit'] self.iconfactory = gtk.IconFactory() for name in names: iconset = gtk.IconSet(gtk.gdk.pixbuf_new_from_file(name+'.xpm')) self.iconfactory.add('pyide-'+name, iconset) self.iconfactory.add_default() return
def setFactoryIcons(self,progProvider): goDownPath = progProvider.getIconPath('go-down.svg') goUpPath = progProvider.getIconPath('go-up.svg') refreshPath = progProvider.getIconPath('view-refresh.svg') recordPath = progProvider.getIconPath('multimedia.svg') savePath = progProvider.getIconPath('save.svg') exitPath = progProvider.getIconPath('exit.svg') seriesPath = progProvider.getIconPath('filter_list.png') asList= progProvider.getIconPath('open_folder.png') icoPaths = [goDownPath,goUpPath,refreshPath,recordPath,savePath,exitPath,seriesPath,asList] icoKeys = ["goDown","goUp","refresh","record","save","exit","filtericon","autoSelectList"] for key in icoKeys: items = [(key, '_GTK!', 0, 0, '')] gtk.stock_add(items) # Register our stock items # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() try: for index,path in enumerate(icoPaths): pixbuf = gtk.gdk.pixbuf_new_from_file(path) # @UndefinedVariable #pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path,64,64) # Register icon to accompany stock item icon_set = gtk.IconSet(pixbuf) key = icoKeys[index] factory.add(key, icon_set) except gobject.GError as error: print(('failed to load GTK logo for toolbar',error))
def register_stock_icons(): ctrlshift = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK icons = [('odml-logo', '_odML', 0, 0, ''), ('odml-add-Section', 'Add _Section', ctrlshift, ord("S"), ''), ('odml-add-Property', 'Add _Property', ctrlshift, ord("P"), ''), ('odml-add-Value', 'Add _Value', ctrlshift, ord("V"), ''), ] gtk.stock_add(icons) # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() img_dir = get_image_path() for stock_icon in icons: icon_name = stock_icon[0] img_path = os.path.join(img_dir, "%s.png" % icon_name) try: icon = load_pixbuf(img_path) icon_set = gtk.IconSet(icon) for icon in load_icon_pixbufs(icon_name): src = gtk.IconSource() src.set_pixbuf(icon) icon_set.add_source(src) factory.add(icon_name, icon_set) except gobject.GError, error: print 'failed to load icon', icon_name, error
def add_stock_ids(self): ids = [ ('pyide-next', '_Next', gtk.gdk.CONTROL_MASK, gtk.keysyms.N, 'pyide'), ('pyide-step', '_Step', gtk.gdk.CONTROL_MASK, gtk.keysyms.S, 'pyide'), ('pyide-return', '_Return', gtk.gdk.CONTROL_MASK, gtk.keysyms.R, 'pyide'), ('pyide-continue', '_Continue', gtk.gdk.CONTROL_MASK, gtk.keysyms.C, 'pyide'), ('pyide-break', '_Break', gtk.gdk.CONTROL_MASK, gtk.keysyms.B, 'pyide'), ('pyide-edit', '_Edit', gtk.gdk.CONTROL_MASK, gtk.keysyms.E, 'pyide'), ('pyide-run', 'R_un', gtk.gdk.CONTROL_MASK, gtk.keysyms.U, 'pyide'), ('pyide-quit', '_Quit', gtk.gdk.CONTROL_MASK, gtk.keysyms.Q, 'pyide'), ] gtk.stock_add(ids) names = [ 'next', 'step', 'return', 'continue', 'break', 'edit', 'run', 'quit' ] self.iconfactory = gtk.IconFactory() for name in names: iconset = gtk.IconSet(gtk.gdk.pixbuf_new_from_file(name + '.xpm')) self.iconfactory.add('pyide-' + name, iconset) self.iconfactory.add_default() return
def setFactoryIcons(self,progProvider): goDownPath = progProvider.getIconPath('go-down.svg') goUpPath = progProvider.getIconPath('go-up.svg') refreshPath = progProvider.getIconPath('view-refresh.svg') recordPath = progProvider.getIconPath('multimedia.svg') savePath = progProvider.getIconPath('save.svg') exitPath = progProvider.getIconPath('exit.svg') seriesPath = progProvider.getIconPath('filter_list.png') asList= progProvider.getIconPath('open_folder.png') icoPaths = [goDownPath,goUpPath,refreshPath,recordPath,savePath,exitPath,seriesPath,asList] icoKeys = ["goDown","goUp","refresh","record","save","exit","filtericon","autoSelectList"] for key in icoKeys: items = [(key, '_GTK!', 0, 0, '')] gtk.stock_add(items) # Register our stock items # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() try: for index,path in enumerate(icoPaths): pixbuf = gtk.gdk.pixbuf_new_from_file(path) # @UndefinedVariable #pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(path,64,64) # Register icon to accompany stock item icon_set = gtk.IconSet(pixbuf) key = icoKeys[index] factory.add(key, icon_set) except gobject.GError, error: print 'failed to load GTK logo for toolbar',error
def base_reg_stock_icons(iconpaths, extraiconsize, items): """ Reusable base to register stock icons in Gramps ..attribute iconpaths: list of main directory of the base icon, and extension, eg: [(os.path.join(const.IMAGE_DIR, 'scalable'), '.svg')] ..attribute extraiconsize: list of dir with extra prepared icon sizes and the gtk size to use them for, eg: [(os.path.join(const.IMAGE_DIR, '22x22'), gtk.ICON_SIZE_LARGE_TOOLBAR)] ..attribute items: list of icons to register, eg: [('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, '')] """ # Register our stock items gtk.stock_add(items) # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() for data in items: pixbuf = 0 for (dirname, ext) in iconpaths: icon_file = os.path.expanduser(os.path.join( dirname, data[0] + ext)) if os.path.isfile(icon_file): try: pixbuf = gtk.gdk.pixbuf_new_from_file(icon_file) break except: pass if not pixbuf: icon_file = os.path.join(const.IMAGE_DIR, 'gramps.png') pixbuf = gtk.gdk.pixbuf_new_from_file(icon_file) ## FIXME from gtk 2.17.3/2.15.2 change this to ## FIXME pixbuf = pixbuf.add_alpha(True, 255, 255, 255) pixbuf = pixbuf.add_alpha(True, chr(0xff), chr(0xff), chr(0xff)) icon_set = gtk.IconSet(pixbuf) #add different sized icons, always png type! for size in extraiconsize: pixbuf = 0 icon_file = os.path.expanduser( os.path.join(size[0], data[0] + '.png')) if os.path.isfile(icon_file): try: pixbuf = gtk.gdk.pixbuf_new_from_file(icon_file) except: pass if pixbuf: source = gtk.IconSource() source.set_size_wildcarded(False) source.set_size(size[1]) source.set_pixbuf(pixbuf) icon_set.add_source(source) factory.add(data[0], icon_set)
def __init__(self, parent, dictRes): ## STOCK ITEM self.stock_items = ( ("gtk-sendResult", "", 0, 0, None), ) self.stock_aliases = ( ("gtk-sendResult", gtk.STOCK_EXECUTE), ) gtk.stock_add(self.stock_items) factory = gtk.IconFactory() factory.add_default() style = gtk.Style() for item, alias in self.stock_aliases: icon_set = style.lookup_icon_set(alias) factory.add(item, icon_set) ## FENETRE self.parent=parent Window.__init__(self, "Administration Oracle : Résultats") self.fenetre.connect("delete_event", self.close_window) settings = gtk.settings_get_default() settings.props.gtk_button_images = True self.vbox_main = gtk.VBox(False, 20) self.fenetre.add(self.vbox_main) self.frm_res=gtk.Frame("Résultats") self.scrolled_window = gtk.ScrolledWindow() self.scrolled_window.set_border_width(10) self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) self.scrolled_window.add_with_viewport(self.frm_res) self.tab_send = gtk.Table(2, 1, False) self.frm_send=gtk.Frame("Envoi des résultats par mail ") self.frm_send.add(self.tab_send) self.vbox_main.pack_start(self.frm_send, False, False, 0) self.vbox_main.pack_start(self.scrolled_window, True, True, 0) self.vbox_resultats= gtk.VBox(False, 0) self.entry_mail = gtk.Entry() self.entry_mail.set_width_chars(50) self.entry_mail.set_text("[email protected];[email protected];...") self.but_mailRes = gtk.Button(stock="gtk-sendResult") self.but_mailRes.modify_bg(gtk.STATE_NORMAL, self.but_color) self.but_mailRes.connect("clicked", self.sendResult, dictRes) self.tab_send.attach(self.entry_mail, 0, 1, 0, 1) self.tab_send.attach(self.but_mailRes, 0, 1, 1, 2) self.frm_res.add(self.vbox_resultats) self.setResults(dictRes) self.fenetre.show_all() # Min Size winSize=self.fenetre.get_size() screen = self.fenetre.get_screen() if winSize[0]+80 >= screen.get_width()-80: newWidth = screen.get_width()-80 else: newWidth = winSize[0]+80 if winSize[1]+80 >= screen.get_height()-80: newHeight = screen.get_height()-80 else: newHeight = winSize[1]+80 self.fenetre.resize(newWidth, newHeight) self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
def add_gtk_icon_to_stock(icon_name, label_str_localized): gtk.stock_add([(icon_name, label_str_localized, 0, 0, None)]) iconsource = gtk.IconSource() iconsource.set_icon_name(icon_name) iconset = gtk.IconSet() iconset.add_source(iconsource) icon_factory = gtk.IconFactory() icon_factory.add(icon_name, iconset) icon_factory.add_default()
def add_icon (file_name, stock_id, label=None, modifier=0, keyval=0): pb = gtk.gdk.pixbuf_new_from_file(file_name) iconset = gtk.IconSet(pb) icon_factory.add(stock_id,iconset) icon_factory.add_default() gtk.stock_add([(stock_id, label, modifier, keyval, "")])
def registerStock(self,namen,text,icon): #registriert eine Standart-Button-Beschriftung mit icon items = [(namen, text, 0, 0, '')] # Register our stock items gtk.stock_add(items) # Add our custom icon factory to the list of defaults factory = gtk.IconFactory() factory.add_default() pixbuf=gtk.gdk.pixbuf_new_from_xpm_data(icon) icon_set = gtk.IconSet(pixbuf) factory.add(namen, icon_set)
def _register_icons(self): IconFactory=gtk.IconFactory() IconFactory.add_default() for account in self.ACCOUNT_TYPE: gtk.stock_add([('rbmb-%s' % account, account, 0, 0, '')]) IconSource=gtk.IconSource() IconSet=gtk.IconSet() IconSource.set_filename(self.find_file('icon/%s.png' % account)) IconSet.add_source(IconSource) IconFactory.add('rbmb-%s' % account, IconSet)
def __init__(self, path, callback=None): """ Override the normal Browser class so that we can hide the window as we need. Also, provide a callback for when the close button is clicked so that we can get some desired data. """ self.callback = callback gtk.stock_add([(gtk.STOCK_CLOSE, _("Select"), 0, 0, "")]) SVNBrowser.__init__(self, path)
def create_stock_item(self, id, name, icon = None): "Creates a stock item" gtk.stock_add(((id, name, 0, 0, None), )) if icon is None: pass elif gtk.stock_lookup(icon) is not None: self.add(id, self.parent.get_style().lookup_icon_set(icon)) else: self.create_stock_icon(id, icon, ( gtk.ICON_SIZE_SMALL_TOOLBAR, gtk.ICON_SIZE_LARGE_TOOLBAR, gtk.ICON_SIZE_MENU, gtk.ICON_SIZE_BUTTON, gtk.ICON_SIZE_DIALOG, ICON_SIZE_LABEL, ICON_SIZE_HEADLINE ))
def merge_menu(cls, uimanager): 'Create menu items.' global screen gtk.stock_add([ ("screen-black",_("_Black"), gtk.gdk.MOD1_MASK, 0, "pymserv"), ("screen-bg",_("Bac_kground"), gtk.gdk.MOD1_MASK, 0, "pymserv"), ("screen-logo",_("Lo_go"), gtk.gdk.MOD1_MASK, 0, "pymserv"), ("screen-freeze",_("_Freeze"), gtk.gdk.MOD1_MASK, 0, "pymserv"), ]) cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_MEDIA_PLAY, _('Start _Presentation'), "F5", _("Show the presentation screen"), screen.show), ('Hide', gtk.STOCK_MEDIA_STOP, _('_Exit Presentation'), "Escape", _("Hide the presentation screen"), screen.hide), #('Pause', gtk.STOCK_MEDIA_PAUSE, None, None, # _('Pause a timed slide.'), screen.pause), ]) cls._actions.add_toggle_actions([ ('Black Screen', 'screen-black', _('_Black Screen'), "b", _("Show a black screen."), screen._secondary_button_toggle), ('Background', 'screen-bg', _('Bac_kground'), None, _("Show only the background."), screen._secondary_button_toggle), ('Logo', 'screen-logo', _('Lo_go'), "<Ctrl>g", _("Display the logo."), screen.to_logo), ('Freeze', 'screen-freeze', _('_Freeze'), None , _("Freeze the screen."), screen._secondary_button_toggle), ]) uimanager.insert_action_group(cls._actions, -1) uimanager.add_ui_from_string(""" <menubar name="MenuBar"> <menu action="Presentation"> <menuitem action="Present" position="bot" /> <menuitem action="Hide" position="bot" /> <menu action="pres-controls"> <menuitem action="Black Screen" position="bot" /> <menuitem action="Background" position="bot" /> <menuitem action="Logo" position="bot" /> <menuitem action="Freeze" position="bot" /> </menu> </menu> </menubar> """) # unmerge_menu not implemented, because we will never uninstall this as # a module. cls._set_menu_items_disabled(screen)
def create_stock_button(icons): """ Register stock buttons from custom images. @param icons: A list of tuples containing filename, name and description """ factory = gtk.IconFactory() factory.add_default() for img, name, description in icons: pb = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGEDIR, img)) iconset = gtk.IconSet(pb) factory.add(name, iconset) gtk.stock_add([(name, description, 0, 0, "pigeonplanner")])
def win8(self, widget): #funzione contenente l'8ava finestra self.win8 = gtk.Window(gtk.WINDOW_TOPLEVEL) vbox = gtk.VBox(False, 0) hbox1 = gtk.HBox(False, 0) hbox2 = gtk.HBox(False, 0) hbox3 = gtk.HBox(False, 0) hbox4 = gtk.HBox(False, 0) vbox1 = gtk.VBox(False, 0) vbox2 = gtk.VBox(False, 0) vbox3 = gtk.VBox(False, 0) vbox4 = gtk.VBox(False, 0) vbox5 = gtk.VBox(False, 0) vbox6 = gtk.VBox(False, 0) self.lookbutton =gtk.Button("background") self.lookbutton.connect("clicked", self.lookwin) self.lookbuttonlab =gtk.Label("questo bottone apre una finestra a cui e stato modificato il background di un colore a mia scelta\n con la funzione gtk.window.modify_bg(stato, colore)") self.looklabel = gtk.Label("Questa label ha un colore diverso grazie alla funzione gtk.label.modify_fg(state, color) il colore si imposta cosi come in tutti gli altri casi con gtk.gdk.color_parse('#000000')\n in questo caso ho messo #000000 pero sono colori in esadecimale ci sono numerose liste e numerosi programmi che li elencano!") color1 = gtk.gdk.color_parse('#7885ff') self.looklabel.modify_fg(gtk.STATE_NORMAL, color1) self.lookradbutton = gtk.RadioButton(None, "colore del radiobutton attivo") color2 = gtk.gdk.color_parse('#7885ff') self.lookradbutton.modify_text(gtk.STATE_NORMAL, color2) self.lookradbuttonlab = gtk.Label("questo radio button ha il colore diverso grazie alla funzione gtk.button.modify_text(state, color) applicatagli") gtk.stock_add([(gtk.STOCK_QUIT, " Con questo bottone si esce dal programma", 0, 0, "")]) self.lookbutbutton = gtk.Button(None, gtk.STOCK_QUIT) self.lookbutbutton.connect("clicked", self.exit) self.lookbutbuttonlab = gtk.Label("abbiamo modificato lo stock con gtk.stock_add([stock, label, modifier, keyval, translation_domain]) \n in questo caso gtk.stock_add([(gtk.STOCK_QUIT, ' Con questo bottone si esce dal programma', 0, 0, '')])") vbox1.pack_start(self.lookbutton, False, False, 10) vbox2.pack_start(self.lookbuttonlab, False, False, 10) vbox3.pack_start(self.lookradbutton, False, False, 10) vbox4.pack_start(self.lookradbuttonlab, False, False, 10) vbox5.pack_start(self.lookbutbutton, False, False) vbox6.pack_start(self.lookbutbuttonlab, False, False) hbox1.pack_start(vbox1 ,True, True, 10) hbox1.pack_start(vbox2 ,True, True, 10) hbox2.pack_start(self.looklabel ,True, True, 10) hbox3.pack_start(vbox3 ,True, True, 10) hbox3.pack_start(vbox4 ,True, True, 10) hbox4.pack_start(vbox5 ,True, True, 10) hbox4.pack_start(vbox6 ,True, False, 10) vbox.pack_start(hbox1 ,False, False, 10) vbox.pack_start(hbox2 ,False, False, 10) vbox.pack_start(hbox3 ,False, False, 10) vbox.pack_start(hbox4 ,False, False) self.win8.add(vbox) self.win8.show_all()
def init_custom_stock_items(): """Initialise the set of custom stock items defined here. Called at application start. """ factory = gtk.IconFactory() factory.add_default() gtk.stock_add(_stock_items) for item_spec in _stock_items: stock_id = item_spec[0] source = gtk.IconSource() source.set_icon_name(stock_id) iconset = gtk.IconSet() iconset.add_source(source) factory.add(stock_id, iconset)
def add_toolbar_button(label, command, image = None, ButtonClass = gtk.ToolButton): if image: gtk.stock_add([(label, _(label).replace("_", "__"), gtk.gdk.SHIFT_MASK, 46, "")]) icon_factory.add(label, gtk.IconSet(self.menu_image(image))) if ButtonClass is gtk.RadioToolButton: b = ButtonClass(add_toolbar_button.radio_group, label) add_toolbar_button.radio_group = b else: b = ButtonClass(label) tooltip = _(label) tooltip = tooltip[0].upper() + tooltip[1:] b.set_tooltip_text(tooltip) b.connect("clicked", command) toolbar.insert(b, -1) return b
def register_stock(self): uihelper.register_stock_icons(self.path.get('icon_dir'), prefix='sloppy-') # register stock items items = [('sloppy-rename', '_Rename', 0, 0, None)] aliases = [('sloppy-rename', 'gtk-edit')] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() style = self.window.get_style() for new_stock, alias in aliases: icon_set = style.lookup_icon_set(alias) factory.add(new_stock, icon_set)
def register(name, label, accelerator, icon_name): if accelerator == None: keyval = 0 mask = 0 else: keyval, mask = gtk.accelerator_parse(accelerator) gtk.stock_add([(name, label, mask, keyval, '')]) if icon_name: icon_source = gtk.IconSource() icon_source.set_icon_name(icon_name) icon = gtk.IconSet() icon.add_source(icon_source) icon_factory.add(name, icon) icon_factory.add_default() icons[name] = icon_name
def setup_custom_buttons(self, ctrl): items = [('vmc-send', '_Send', 0, 0, None)] aliases = [('vmc-send', gtk.STOCK_OK)] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() style = self.get_top_widget().get_style() for new_stock, alias in aliases: icon_set = style.lookup_icon_set(alias) factory.add(new_stock, icon_set) bbox = self['sms_edit_hbutton_box'] button = gtk.Button(stock='vmc-send') button.connect('clicked', ctrl.on_send_button_clicked) self['send_button'] = button bbox.pack_end(button)
def register(window): items = [('texttest-stock-load', '_Load', gtk.gdk.CONTROL_MASK, gtk.gdk.keyval_from_name('L'), None), ('texttest-stock-credits', 'C_redits', 0, 0, None)] # We're too lazy to make our own icons, # so we use regular stock icons. aliases = [('texttest-stock-load', gtk.STOCK_OPEN), ('texttest-stock-credits', gtk.STOCK_ABOUT)] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() style= window.get_style() for new_stock, alias in aliases: icon_set = style.lookup_icon_set(alias) factory.add(new_stock, icon_set)
def register(name, label, key): filename = "%s.png" % name import os filename = os.path.join(os.path.dirname(__file__), "stock", filename) domain = "sanaviron" id = "%s-stock-%s" % (domain, name) pixbuf = gtk.gdk.pixbuf_new_from_file(filename) iconset = gtk.IconSet(pixbuf) factory = gtk.IconFactory() factory.add(id, iconset) factory.add_default() keyval = gtk.gdk.keyval_from_name(key) modifier = gtk.gdk.MOD1_MASK gtk.stock_add([(id, label, modifier, keyval, domain)]) return id
def setup_custom_buttons(self, ctrl): items = [('vmb-send', '_Send', 0, 0, None)] aliases = [('vmb-send', gtk.STOCK_OK)] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() style = self.get_top_widget().get_style() for new_stock, alias in aliases: icon_set = style.lookup_icon_set(alias) factory.add(new_stock, icon_set) bbox = self['sms_edit_hbutton_box'] button = gtk.Button(stock='vmb-send') button.connect('clicked', ctrl.on_send_button_clicked) self['send_button'] = button bbox.pack_end(button)
def __init__(self, label=None, stock=None, use_underline=True): gtk.stock_add([(stock, label, 0, 0, "")]) super(SideButton, self).__init__(label=label, stock=stock, use_underline=True) alignment = self.get_children()[0] hbox = alignment.get_children()[0] image, label = hbox.get_children() #label.set_text('Hide') hbox.remove(image) hbox.remove(label) v = gtk.VBox(False, spacing=3) v.pack_start(image, 3) v.pack_start(label, 3) alignment.remove(hbox) alignment.add(v) self.show_all()
def merge_menu(cls, uimanager): "Create menu items." global schedlist gtk.stock_add([("sched-new", _("New Schedule"), gtk.gdk.MOD1_MASK, 0, "pymserv")]) cls._actions = gtk.ActionGroup("schedlist") cls._actions.add_actions( [ ("sched-new", "sched-new", _("New Schedule"), "", _("Create a new schedule"), schedlist._on_new), ( "sched-rename", None, _("_Rename Schedule"), None, _("Rename the selected schedule"), schedlist._on_rename, ), ( "sched-delete", gtk.STOCK_DELETE, _("Delete Schedule"), None, _("Delete the currently selected schedule"), schedlist._on_sched_delete, ), ] ) uimanager.insert_action_group(cls._actions, -1) uimanager.add_ui_from_string( """ <menubar name="MenuBar"> <menu action="File"> <menu action="file-new"> <placeholder name="file-new-sched" > <menuitem action='sched-new' position='bot' /> </placeholder> </menu> </menu> <menu action="Edit"> <menu action="edit-schedule"> <menuitem action='sched-rename' /> <menuitem action='sched-delete' /> </menu> </menu> </menubar> """ )
def register(window): items = [('texttest-stock-load', '_Load', gtk.gdk.CONTROL_MASK, gtk.gdk.keyval_from_name('L'), None), ('texttest-stock-credits', 'C_redits', 0, 0, None)] # We're too lazy to make our own icons, # so we use regular stock icons. aliases = [('texttest-stock-load', gtk.STOCK_OPEN), ('texttest-stock-credits', gtk.STOCK_ABOUT)] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() style = window.get_style() for new_stock, alias in aliases: icon_set = style.lookup_icon_set(alias) factory.add(new_stock, icon_set)
def __init__(self, protector): self.protector = protector self.clipboard = gtk.clipboard_get() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title(_("Editing clipboard")) self.window.set_resizable(True) self.window.set_skip_pager_hint(True) self.window.set_skip_taskbar_hint(True) self.window.set_size_request(500, 300) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_border_width(6) vbox = gtk.VBox(spacing=6) self.window.add(vbox) textscroll = gtk.ScrolledWindow() textscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView() self.textview.set_editable(True) self.textview.set_wrap_mode(gtk.WRAP_WORD) self.textview.get_buffer().set_text(self.clipboard.wait_for_text()) textscroll.add(self.textview) vbox.pack_start(textscroll) def create_button(stock, clicked): button = gtk.Button(stock=stock) button.connect("clicked", clicked) return button hbox = gtk.HButtonBox() hbox.set_spacing(6) hbox.set_layout(gtk.BUTTONBOX_END) gtk.stock_add((('pastie-replace', _("_Replace"), gtk.gdk.MOD1_MASK, gtk.gdk.keyval_from_name(_('R')), 'pastie'), )) hbox.add(create_button(gtk.STOCK_CANCEL, self.cancel_action)) hbox.add(create_button(gtk.STOCK_DELETE, self.delete_action)) hbox.add(create_button("pastie-replace", self.replace_action)) hbox.add(create_button(gtk.STOCK_OK, self.ok_action)) vbox.pack_end(hbox, expand=False) self.window.show_all() self.window.show()
def __init__(self, protector): self.protector = protector self.clipboard = gtk.clipboard_get() self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title(_("Editing clipboard")) self.window.set_resizable(True) self.window.set_skip_pager_hint(True) self.window.set_skip_taskbar_hint(True) self.window.set_size_request(500, 300) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_border_width(6) vbox = gtk.VBox(spacing=6) self.window.add(vbox) textscroll = gtk.ScrolledWindow() textscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView() self.textview.set_editable(True) self.textview.set_wrap_mode(gtk.WRAP_WORD) self.textview.get_buffer().set_text(self.clipboard.wait_for_text()) textscroll.add(self.textview) vbox.pack_start(textscroll) def create_button(stock, clicked): button = gtk.Button(stock=stock) button.connect("clicked", clicked) return button hbox = gtk.HButtonBox() hbox.set_spacing(6) hbox.set_layout(gtk.BUTTONBOX_END) gtk.stock_add( (('pastie-replace', _("_Replace"), gtk.gdk.MOD1_MASK, gtk.gdk.keyval_from_name(_('R')), 'pastie'),) ) hbox.add(create_button(gtk.STOCK_CANCEL, self.cancel_action)) hbox.add(create_button(gtk.STOCK_DELETE, self.delete_action)) hbox.add(create_button("pastie-replace", self.replace_action)) hbox.add(create_button(gtk.STOCK_OK, self.ok_action)) vbox.pack_end(hbox, expand=False) self.window.show_all() self.window.show()
def create_stock(): drct = install.dir + '/pixmaps/' recipe_pixbuf = gtk.gdk.pixbuf_new_from_file( drct + 'cake.png') plan_pixbuf = gtk.gdk.pixbuf_new_from_file( drct + 'plan.png') food_pixbuf = gtk.gdk.pixbuf_new_from_file( drct + 'banana.png') recipe_iconset = gtk.IconSet( recipe_pixbuf) plan_iconset = gtk.IconSet( plan_pixbuf) food_iconset = gtk.IconSet( food_pixbuf) icon_factory = gtk.IconFactory() icon_factory.add( 'gnutr-recipe', recipe_iconset) icon_factory.add( 'gnutr-plan', plan_iconset) icon_factory.add( 'gnutr-food', food_iconset) icon_factory.add_default() gtk.stock_add(( ('gnutr-recipe', '_Recipe', gtk.gdk.MOD1_MASK, ord( "r"), "uk"), ('gnutr-plan', '_Plan', gtk.gdk.MOD1_MASK, ord( "p"), "uk"), ('gnutr-food', '_Food', gtk.gdk.MOD1_MASK, ord( "f"), "uk")))
def merge_menu(cls, uimanager): "Merge new values with the uimanager." gtk.stock_add([('pres-exposong',_('_ExpoSong Presentation'), gtk.gdk.MOD1_MASK, 0, 'pymserv')]) actiongroup = gtk.ActionGroup('exposong-pres') actiongroup.add_actions([('pres-new-exposong', 'pres-exposong-new', _("New ExpoSong Presentation"), None, _("New ExpoSong Presentation"), cls._on_pres_new)]) uimanager.insert_action_group(actiongroup, -1) cls.menu_merge_id = uimanager.add_ui_from_string(""" <menubar name='MenuBar'> <menu action='File'> <menu action='file-new'> <placeholder name="file-new-pres"> <menuitem action='pres-new-exposong' /> </placeholder> </menu> </menu> </menubar> """)
def create_stock(): drct = install.dir + '/pixmaps/' recipe_pixbuf = gtk.gdk.pixbuf_new_from_file(drct + 'cake.png') plan_pixbuf = gtk.gdk.pixbuf_new_from_file(drct + 'plan.png') food_pixbuf = gtk.gdk.pixbuf_new_from_file(drct + 'banana.png') recipe_iconset = gtk.IconSet(recipe_pixbuf) plan_iconset = gtk.IconSet(plan_pixbuf) food_iconset = gtk.IconSet(food_pixbuf) icon_factory = gtk.IconFactory() icon_factory.add('gnutr-recipe', recipe_iconset) icon_factory.add('gnutr-plan', plan_iconset) icon_factory.add('gnutr-food', food_iconset) icon_factory.add_default() gtk.stock_add( (('gnutr-recipe', '_Recipe', gtk.gdk.MOD1_MASK, ord("r"), "uk"), ('gnutr-plan', '_Plan', gtk.gdk.MOD1_MASK, ord("p"), "uk"), ('gnutr-food', '_Food', gtk.gdk.MOD1_MASK, ord("f"), "uk")))
def __init__(self, file, stock_name, title, key): global _iconfactory self.stock_name = stock_name self.title = title try: self.pixbuf = gtk.gdk.pixbuf_new_from_file( fractconfig.instance.find_resource( file, 'pixmaps', '../pixmaps/gnofract4d')) self.iconset = gtk.IconSet(self.pixbuf) _iconfactory.add(stock_name, self.iconset) gtk.stock_add( [(stock_name, title, gtk.gdk.CONTROL_MASK, key, "c")]) except ValueError: # can't find it self.pixbuf = None except gobject.GError: self.pixbuf = None
class HobIconChecker(hic): def set_hob_icon_to_stock_icon(self, file_path, stock_id=""): try: pixbuf = gtk.gdk.pixbuf_new_from_file(file_path) except Exception, e: return None if stock_id and (gtk.icon_factory_lookup_default(stock_id) == None): icon_factory = gtk.IconFactory() icon_factory.add_default() icon_factory.add(stock_id, gtk.IconSet(pixbuf)) gtk.stock_add([(stock_id, '_label', 0, 0, '')]) return icon_factory.lookup(stock_id) return None
def __init__(self, monthspec=None): self.window = None # Create a new window window = gtk.Window(appprop[1]) # - floating when TOPLEVEL window.set_resizable(False) # - window properties window.set_title(appprop[0]) window.set_border_width(appprop[5]) # Connect the destroy event to a handler window.connect("destroy", lambda x: gtk.main_quit()) # Auto exit after timeout timer = gobject.timeout_add(appprop[6], lambda: gtk.main_quit()) # The top part of the window: calendar box vbox = gtk.VBox(False, self.DEF_PAD) hbox = gtk.HBox(False, self.DEF_PAD) hbbox = gtk.HButtonBox() window.add(vbox) vbox.pack_start(hbox, True, True, self.DEF_PAD) hbox.pack_start(hbbox, False, False, self.DEF_PAD) hbbox.set_layout(gtk.BUTTONBOX_SPREAD) hbbox.set_spacing(0) # Calendar widget frame = gtk.Frame() hbbox.pack_start(frame, False, True, self.DEF_PAD) calendar = gtk.Calendar() self.window = calendar # Calendar options # GTK_CALENDAR_SHOW_HEADING = 1 << 0, # GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1, # GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2, # GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3, # GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4, # GTK_CALENDAR_SHOW_DETAILS = 1 << 5 # As default, show heading, show days and allow date changes #self.window.set_display_options(3 + (1<<5)) # Show a specific month if requested on startup if monthspec in range(1, 13): # Clear day selection if not viewing current month if monthspec != self.window.get_date()[1]+1: self.window.select_day(0) self.window.select_month(monthspec-1, self.window.get_date()[0]) # Fake a month change on startup, to get marks right away self.calendar_month_changed(calendar) # Put the finished widget in the frame frame.add(calendar) # Signals Handlers calendar.connect("month_changed", self.calendar_month_changed) # Setup buttons if appprop[7]: # The bottom part of the window: button box bbox = gtk.HButtonBox () vbox.pack_start(bbox, False, False, 0) bbox.set_layout(gtk.BUTTONBOX_SPREAD) # Button widget: Agenda # - modify default label for STOCK_EDIT gtk.stock_add([(gtk.STOCK_EDIT, apptips[1][0], 0, 0, "")]) button = gtk.Button(stock=gtk.STOCK_EDIT) button.connect("clicked", lambda w: self.calendar_show_agenda()) bbox.add(button) button.set_tooltip_text(apptips[1][1]) # Button widget: Close # - modify default label for STOCK_CANCEL gtk.stock_add([(gtk.STOCK_CANCEL, apptips[2][0], 0, 0, "")]) button = gtk.Button(stock=gtk.STOCK_CANCEL) button.connect("clicked", lambda w: gtk.main_quit()) bbox.add(button) # - this is the default button button.set_flags(gtk.CAN_DEFAULT) button.grab_default() button.set_tooltip_text(apptips[2][1]) # Set application icon gtk.window_set_default_icon(self.calendar_select_icon()) # Position the window window.move(self.DEF_POS_X, self.DEF_POS_Y) # Draw the calendar window.show_all()
logging.Logger.debug_rpc = lambda self, msg, *args, **kwargs: self.log( logging.DEBUG_RPC, msg, *args, **kwargs) logging.DEBUG_RPC_ANSWER = logging.DEBUG - 2 logging.addLevelName(logging.DEBUG_RPC_ANSWER, 'DEBUG_RPC_ANSWER') logging.Logger.debug_rpc_answer = lambda self, msg, *args, **kwargs: self.log( logging.DEBUG_RPC_ANSWER, msg, *args, **kwargs) logging.getLogger().setLevel( getattr(logging, options.options['logging.level'].upper())) import modules import common items = [('terp-flag', '_Translation', gtk.gdk.CONTROL_MASK, ord('t'), '')] gtk.stock_add(items) factory = gtk.IconFactory() factory.add_default() pix_file = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'icons') if not os.path.isdir(pix_file): pix_file = os.path.join(options.options['path.pixmaps'], 'icons') for fname in os.listdir(pix_file): ffname = os.path.join(pix_file, fname) if not os.path.isfile(ffname): continue iname = os.path.splitext(fname)[0] try: pixbuf = gtk.gdk.pixbuf_new_from_file(ffname)