def render_stop(self, cr, rect):    
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     icon_x = rect.x + (rect.width - self.stop_pixbuf.get_width()) / 2
     icon_y = rect.y + (rect.height - self.stop_pixbuf.get_height()) / 2
     draw_pixbuf(cr, self.stop_pixbuf, icon_x, icon_y)
    def render_stop(self, cr, rect):
        if self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height,
                             "globalItemHover")

        icon_x = rect.x + (rect.width - self.stop_pixbuf.get_width()) / 2
        icon_y = rect.y + (rect.height - self.stop_pixbuf.get_height()) / 2
        draw_pixbuf(cr, self.stop_pixbuf, icon_x, icon_y)
 def render_progressbar(self, cr, rect):     
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
    
     self.progress_buffer.render(cr, 
                                 gtk.gdk.Rectangle(rect.x + (rect.width - self.progressbar_width) / 2,
                                                   rect.y + (rect.height - self.progressbar_height)/ 2,
                                                   self.progressbar_width, self.progressbar_height))
    def render_progressbar(self, cr, rect):
        if self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height,
                             "globalItemHover")

        self.progress_buffer.render(
            cr,
            gtk.gdk.Rectangle(
                rect.x + (rect.width - self.progressbar_width) / 2,
                rect.y + (rect.height - self.progressbar_height) / 2,
                self.progressbar_width, self.progressbar_height))
    def render_title(self, cr, rect):
        # Draw select background.
        rect.width -= 2

        if not self.is_parent:
            if self.is_highlight:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
            elif self.is_hover:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")

            if self.is_highlight:
                text_color = "#FFFFFF"
            else:
                text_color = "#000000"
        else:
            text_color = "#000000"

        # draw arrow and blacklist icon
        left_pixbuf_width = 18
        if not self.is_parent:
            rect.x += self.child_offset
            rect.width -= self.child_offset

            if self.is_in_blacklist:
                if self.is_highlight:
                    pixbuf = pixbuf_blacklist_white
                else:
                    pixbuf = pixbuf_blacklist_grey
            else:
                pixbuf = None

            if pixbuf:
                draw_pixbuf(cr, pixbuf, rect.x + self.draw_padding_x, rect.y + 5)
        else:
            left_pixbuf_width = 0

            if self.is_expand:
                pixbuf = pixbuf_arrow_down
            else:
                pixbuf = pixbuf_arrow_right

            content_width, content_height = get_content_size(self.title)

            draw_pixbuf(cr, pixbuf, rect.x + content_width + 20,  rect.y + 10)


        draw_text(cr, " " + self.title,
                  rect.x + self.draw_padding_x + left_pixbuf_width,
                  rect.y,
                  rect.width - self.draw_padding_x * 2,
                  rect.height,
                  text_color = text_color,
                  alignment=pango.ALIGN_LEFT)
    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_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)
Example #8
0
 def render_title(self, cr, rect):        
     # Draw select background.
         
     if self.is_highlight:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     if self.is_highlight:
         text_color = "#FFFFFF"
     else:    
         text_color = "#000000"
         
         
     column_offset = self.column_offset * self.column_index    
     draw_text(cr, self.title, rect.x + self.title_padding_x + column_offset,
               rect.y, rect.width - self.title_padding_x - column_offset ,
               rect.height, text_size=10, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
    def render_time(self, cr, rect):    
        if self.row_index % 2:
            cr.rectangle(*rect)
            cr.set_source_rgba(0, 0, 1, 0.05)
            cr.fill()
        
        if self.owner == "detail":
            if self.is_select:    
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
            elif self.is_hover:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
                
            if self.is_select:
                text_color = "#FFFFFF"
            else:    
                text_color = "#000000"
                
        else:
            if self.is_hover:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "#ebf4fd")
                draw_half_rectangle(cr, rect, "#7da2ce", False)
                
            text_color = "#000000"

        if self.owner == "detail":
            text = self.time.replace('-', ' ')
        else:
            text = self.time.split("-")[1][:-3]
            
        draw_text(cr, text, rect.x + 20,
                  rect.y + 10, rect.width,
                  rect.height / 2, 
                  text_color = text_color,
                  wrap_width = 50,
                  alignment=pango.ALIGN_CENTER)    
    def render_content(self, cr, rect):        
        if self.row_index % 2:
            cr.rectangle(*rect)
            cr.set_source_rgba(0, 0, 1, 0.05)
            cr.fill()
        
        # Draw select background.
        if self.owner == "detail":
            if self.is_select:    
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
            elif self.is_hover:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
                
            if self.is_select:
                text_color = "#FFFFFF"
            else:    
                text_color = "#000000"

        else:
            if self.is_hover:
                draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "#ebf4fd")
                draw_half_rectangle(cr, rect, "#7da2ce")
                
            text_color = "#000000"
                
            
        wrap_width = 25 * 10 if self.owner == "detail" else 20 * 10
        render_hyperlink_support_text(self, cr, self.content, 
                                      rect.x + self.draw_padding_x, 
                                      rect.y + self.draw_padding_y,
                                      rect.width - self.draw_padding_x * 2, 
                                      rect.height - self.draw_padding_y * 2, 
                                      wrap_width = wrap_width,
                                      clip_line_count = 2,
                                      text_color = text_color,
                                      alignment=pango.ALIGN_LEFT)    
 def render_block(self, cr, rect):
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height,
                          "globalItemHover")
 def render_block(self, cr, rect):    
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")