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 __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 ImageData(self, image_data, x, y): file_str = StringIO(str(image_data)) img_surface = g15cairo.load_surface_from_file(file_str, None) file_str.close() self._page.image(img_surface, x, y)
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 load_surface_from_file(filename, size=None): return g15cairo.load_surface_from_file(filename, size)