def get_profile_icon_path(self, height): """ Get the icon for the profile. This will either be a specific icon path, or if none is available, the default profile icon. If the icon is a themed icon name, then that icon will be searched for and the full path returned Keyword arguments: height -- preferred height """ icon = self.icon if icon is not None and icon.startswith("/"): return icon path = self.get_resource_path(icon) if path is None: if icon is None or icon == "": icon = [ "preferences-desktop-keyboard-shortcuts", "preferences-desktop-keyboard" ] return g15icontools.get_icon_path(icon, height) return path
def Image(self, path, x, y, width, height): if not "/" in path: path = g15icontools.get_icon_path(path, width if width != 0 else 128) size = None if width == 0 or height == 0 else (width, height) img_surface = g15cairo.load_surface_from_file(path, size) self._page.image(img_surface, x, y)
def _rebuild_model(self): self.__script_model.clear() for macro_text in self.__macros: split = macro_text.split(" ") op = split[0].lower() if len(split) > 1: val = " ".join(split[1:]) if op in OP_ICONS: icon = OP_ICONS[op] icon_path = g15icontools.get_icon_path(icon, 24) self.__script_model.append([gtk.gdk.pixbuf_new_from_file(icon_path), val, op, True]) self._validate_script()
def _rebuild_model(self): self.__script_model.clear() for macro_text in self.__macros: split = macro_text.split(" ") op = split[0].lower() if len(split) > 1: val = " ".join(split[1:]) if op in OP_ICONS: icon = OP_ICONS[op] icon_path = g15icontools.get_icon_path(icon, 24) self.__script_model.append([ gtk.gdk.pixbuf_new_from_file(icon_path), val, op, True ]) self._validate_script()
def __init__(self, gconf_client, gconf_key, screen, icon, page_id, title): """ Constructor Keyword arguments: gconf_client - gconf client gconf_key - gconf key for plugin screen - screen icon - icon to use for thumbnail title - title for page (displayed in menu etc) refresh_interval - how often to refresh the page """ G15Plugin.__init__(self, gconf_client, gconf_key, screen) self.page_id = page_id self.hidden = False self._icon_path = g15icontools.get_icon_path(icon) self._title = title self.page = None self.thumb_icon = g15cairo.load_surface_from_file(self._icon_path) self.add_page_on_activate = True
def get_profile_icon_path(self, height): """ Get the icon for the profile. This will either be a specific icon path, or if none is available, the default profile icon. If the icon is a themed icon name, then that icon will be searched for and the full path returned Keyword arguments: height -- preferred height """ icon = self.icon if icon is not None and icon.startswith("/"): return icon path = self.get_resource_path(icon) if path is None: if icon == None or icon == "": icon = [ "preferences-desktop-keyboard-shortcuts", "preferences-desktop-keyboard" ] return g15icontools.get_icon_path(icon, height) return path
def set_icon(self, icon): self._icon_path = g15icontools.get_icon_path(icon) self.thumb_icon = g15cairo.load_surface_from_file(self._icon_path)
def get_icon_path(icon=None, size=128, warning=True, include_missing=True): return g15icontools.get_icon_path(icon, size, warning, include_missing)