def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' if self.pixbuf == None: self.create_cache_pixbuf() wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow( cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow") ) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow( cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow") ) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb(*color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke() if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width() / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y)
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' if self.pixbuf == None: self.create_cache_pixbuf() wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow(cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow")) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow(cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow")) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb( *color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke() if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width( ) / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y)
def render_info(self, cr, rect): if self.is_hover: draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover") if self.icon_pixbuf is None: self.icon_pixbuf = cache_manager.get_small_pixbuf(self.image_object, 37, 38) icon_width = self.icon_pixbuf.get_width() icon_height = self.icon_pixbuf.get_height() icon_x = rect.x + self.info_padding_x icon_y = rect.y + (rect.height - icon_height) / 2 # Draw shadow. drop_shadow_padding = 3 drop_shadow_radious = 3 draw_shadow( cr, icon_x, icon_y, icon_width + drop_shadow_padding, icon_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow") ) outside_shadow_padding = 2 outside_shadow_radious = 3 draw_shadow( cr, icon_x - outside_shadow_padding, icon_y - outside_shadow_padding, icon_width + outside_shadow_padding * 2, icon_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow") ) # Draw wallpaper. draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y) rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width() _width, _height = get_content_size(self.image_object.get_display_name()) draw_text(cr, "<b>%s</b>" % self.image_object.get_display_name(), rect.x, icon_y, rect.width, _height, text_size=10) rect.y = icon_y + icon_width - _height _width, _height = get_content_size(self.status_text) draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' # Init. if self.pixbuf == None: self.pixbuf = get_optimum_pixbuf_from_file(self.image_path, self.wallpaper_width, self.wallpaper_height) wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow( cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow") ) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow( cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow") ) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb(*color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke()
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' # Init. if self.pixbuf == None: self.pixbuf = get_optimum_pixbuf_from_file(self.image_path, self.wallpaper_width, self.wallpaper_height) wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow(cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow")) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow(cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow")) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb( *color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke()
def render_info(self, cr, rect): if self.is_hover: draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover") if self.icon_pixbuf is None: self.icon_pixbuf = cache_manager.get_small_pixbuf( self.image_object, 37, 38) icon_width = self.icon_pixbuf.get_width() icon_height = self.icon_pixbuf.get_height() icon_x = rect.x + self.info_padding_x icon_y = rect.y + (rect.height - icon_height) / 2 # Draw shadow. drop_shadow_padding = 3 drop_shadow_radious = 3 draw_shadow(cr, icon_x, icon_y, icon_width + drop_shadow_padding, icon_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow")) outside_shadow_padding = 2 outside_shadow_radious = 3 draw_shadow(cr, icon_x - outside_shadow_padding, icon_y - outside_shadow_padding, icon_width + outside_shadow_padding * 2, icon_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow")) # Draw wallpaper. draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y) rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width() _width, _height = get_content_size( self.image_object.get_display_name()) draw_text(cr, "<b>%s</b>" % self.image_object.get_display_name(), rect.x, icon_y, rect.width, _height, text_size=10) rect.y = icon_y + icon_width - _height _width, _height = get_content_size(self.status_text) draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' if self.pixbuf == None: self.create_cache_pixbuf() wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow(cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow")) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow(cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow")) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb( *color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke() if self.is_downloaded: downloaded_str = _("Downloaded") downloaded_padding = 4 downloaded_str_width, downloaded_str_height = get_content_size( downloaded_str) cr.rectangle( wallpaper_x + 1, wallpaper_y + self.wallpaper_height - downloaded_str_height - downloaded_padding, self.wallpaper_width - 2, downloaded_str_height - 1 + downloaded_padding) cr.set_source_rgba(0, 0, 0, 0.4) cr.fill() draw_text(cr, downloaded_str, wallpaper_x + (self.wallpaper_width - downloaded_str_width) / 2, wallpaper_y + self.wallpaper_height - downloaded_str_height - downloaded_padding / 1.5, self.wallpaper_width, downloaded_str_height, text_color="#FFFFFF") if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width( ) / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 #draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y) if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width( ) / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 #draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y) if self.is_loop: loop_pixbuf = self.loop_dpixbuf.get_pixbuf() loop_x = wallpaper_x + (self.wallpaper_width - loop_pixbuf.get_width()) / 2 loop_y = wallpaper_y + (self.wallpaper_height - loop_pixbuf.get_height()) / 2 self.draw_loop_pixbuf(cr, loop_pixbuf, loop_x, loop_y)
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' # Init. wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow(cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow")) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow(cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow")) # Draw add button. cr.set_source_rgb(0.7, 0.7, 0.7) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.fill() add_button_width = 8 add_button_height = 40 cr.set_source_rgb(0.3, 0.3, 0.3) cr.rectangle( wallpaper_x + (self.wallpaper_width - add_button_height) / 2, wallpaper_y + (self.wallpaper_height - add_button_width) / 2, add_button_height, add_button_width) cr.fill() cr.rectangle( wallpaper_x + (self.wallpaper_width - add_button_width) / 2, wallpaper_y + (self.wallpaper_height - add_button_height) / 2, add_button_width, add_button_height) cr.fill() # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb( *color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke()
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' if self.pixbuf == None: self.create_cache_pixbuf() wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow( cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow") ) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow( cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow") ) # Draw wallpaper. draw_pixbuf(cr, self.pixbuf, wallpaper_x, wallpaper_y) # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb(*color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke() if self.is_downloaded: downloaded_str = _("Downloaded") downloaded_padding = 4 downloaded_str_width, downloaded_str_height = get_content_size(downloaded_str) cr.rectangle(wallpaper_x + 1, wallpaper_y + self.wallpaper_height - downloaded_str_height - downloaded_padding, self.wallpaper_width - 2, downloaded_str_height - 1 + downloaded_padding) cr.set_source_rgba(0, 0, 0, 0.4) cr.fill() draw_text(cr, downloaded_str, wallpaper_x + (self.wallpaper_width - downloaded_str_width) / 2, wallpaper_y + self.wallpaper_height - downloaded_str_height - downloaded_padding / 1.5, self.wallpaper_width, downloaded_str_height, text_color = "#FFFFFF") if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width() / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 #draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y) if self.is_tick: tick_pixbuf = self.tick_normal_dpixbuf.get_pixbuf() else: tick_pixbuf = self.tick_gray_dpixbuf.get_pixbuf() tick_x = wallpaper_x + self.wallpaper_width - tick_pixbuf.get_width() / 2 tick_y = wallpaper_y - tick_pixbuf.get_height() / 2 #draw_pixbuf(cr, tick_pixbuf, tick_x, tick_y) if self.is_loop: loop_pixbuf = self.loop_dpixbuf.get_pixbuf() loop_x = wallpaper_x + (self.wallpaper_width - loop_pixbuf.get_width()) / 2 loop_y = wallpaper_y + (self.wallpaper_height - loop_pixbuf.get_height()) / 2 self.draw_loop_pixbuf(cr, loop_pixbuf, loop_x, loop_y)
def render(self, cr, rect): ''' Render item. This is IconView interface, you should implement it. ''' # Init. wallpaper_x = rect.x + (rect.width - self.wallpaper_width) / 2 wallpaper_y = rect.y + (rect.height - self.wallpaper_height) / 2 # Draw shadow. drop_shadow_padding = 7 drop_shadow_radious = 7 draw_shadow( cr, wallpaper_x, wallpaper_y, self.wallpaper_width + drop_shadow_padding, self.wallpaper_height + drop_shadow_padding, drop_shadow_radious, app_theme.get_shadow_color("window_shadow") ) outside_shadow_padding = 4 outside_shadow_radious = 5 draw_shadow( cr, wallpaper_x - outside_shadow_padding, wallpaper_y - outside_shadow_padding, self.wallpaper_width + outside_shadow_padding * 2, self.wallpaper_height + outside_shadow_padding * 2, outside_shadow_radious, app_theme.get_shadow_color("window_shadow") ) # Draw add button. cr.set_source_rgb(0.7, 0.7, 0.7) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.fill() add_button_width = 8 add_button_height = 40 cr.set_source_rgb(0.3, 0.3, 0.3) cr.rectangle(wallpaper_x + (self.wallpaper_width - add_button_height) / 2, wallpaper_y + (self.wallpaper_height - add_button_width) / 2, add_button_height, add_button_width) cr.fill() cr.rectangle(wallpaper_x + (self.wallpaper_width - add_button_width) / 2, wallpaper_y + (self.wallpaper_height - add_button_height) / 2, add_button_width, add_button_height) cr.fill() # Draw wallpaper frame. with cairo_disable_antialias(cr): cr.set_line_width(2) cr.set_source_rgba(1, 1, 1, 1) cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.stroke() if self.is_hover: cr.rectangle(wallpaper_x, wallpaper_y, self.wallpaper_width, self.wallpaper_height) cr.set_source_rgb(*color_hex_to_cairo(self.hover_stroke_dcolor.get_color())) cr.stroke()