def _query_tooltip( self, widget, x, y, key, tooltip ): try: winx, winy = self.convert_widget_to_bin_window_coords(x, y) treepath, treecolumn, cellx, celly = self.get_path_at_pos(winx, winy) active_object = self.artist_manager.model.get_from_path(treepath) #active_object=self.artist_manager.model.store[treepath][self.artist_manager.model.columns['artist_album']] if isinstance(active_object, Artist) and \ treecolumn.get_title() == _('Covers') and \ active_object.cover.original != self.artist_manager.cover_man.unknown_cover.original: # we display the tooltip if the row is an artist and the column # is actually the artist cover itself pixbuf = GdkPixbuf.Pixbuf.new_from_file(active_object.cover.original) src_width = pixbuf.get_width() src_height = pixbuf.get_height() factor = min(float(256) / float(src_width), float(256) / float(src_height)) new_width = int(src_width * factor + 0.5) new_height = int(src_height * factor + 0.5) pixbuf = create_pixbuf_from_file_at_size( active_object.cover.original, new_width, new_height) tooltip.set_icon( pixbuf ) return True else: return False except: pass
def _query_tooltip(self, widget, x, y, key, tooltip): try: winx, winy = self.convert_widget_to_bin_window_coords(x, y) treepath, treecolumn, cellx, celly = self.get_path_at_pos(winx, winy) active_object = self.artist_manager.model.get_from_path(treepath) # active_object=self.artist_manager.model.store[treepath][self.artist_manager.model.columns['artist_album']] if isinstance(active_object, Artist) and \ treecolumn.get_title() == _('Covers') and \ active_object.cover.original != self.artist_manager.cover_man.unknown_cover.original: # we display the tooltip if the row is an artist and the column # is actually the artist cover itself pixbuf = GdkPixbuf.Pixbuf.new_from_file(active_object.cover.original) src_width = pixbuf.get_width() src_height = pixbuf.get_height() factor = min(float(256) / float(src_width), float(256) / float(src_height)) new_width = int(src_width * factor + 0.5) new_height = int(src_height * factor + 0.5) pixbuf = create_pixbuf_from_file_at_size( active_object.cover.original, new_width, new_height) tooltip.set_icon(pixbuf) return True else: return False except: pass
def create_button_image(self, plugin, image, icon_name): """ helper function to create a button image """ if image: del image path = "img/" + Theme(self.plugin).current + "/" return create_pixbuf_from_file_at_size(rb.find_plugin_file(self.plugin, path + icon_name), *get_stock_size())
def create_button_image(self, plugin, image, icon_name): ''' helper function to create a button image ''' if image: del image path = 'img/' + Theme(self.plugin).current + '/' return create_pixbuf_from_file_at_size( rb.find_plugin_file(self.plugin, path + icon_name), *get_stock_size())
def create_button_image(plugin, icon_name): path = 'img/' return create_pixbuf_from_file_at_size( rb.find_plugin_file(plugin, path + icon_name), *get_stock_size())