Ejemplo n.º 1
0
    def expose_category_item(self, widget, event):

        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation
        font_color = app_theme.get_color("labelText").get_color()
        arrow_pixbuf = self.arrow_dpixbuf.get_pixbuf()
        select_index = self.get_index()

        if widget.state == gtk.STATE_NORMAL:
            if select_index == self.index:
                select_status = BUTTON_PRESS
            else:
                select_status = BUTTON_NORMAL

        elif widget.state == gtk.STATE_PRELIGHT:
            if select_index == self.index:
                select_status = BUTTON_PRESS
            else:
                select_status = BUTTON_HOVER

        elif widget.state == gtk.STATE_ACTIVE:
            select_status = BUTTON_PRESS

        if select_status == BUTTON_PRESS:
            draw_vlinear(
                cr, rect.x, rect.y, rect.width, rect.height,
                app_theme.get_shadow_color("simpleItemPress").get_color_info())
            font_color = app_theme.get_color("simpleSelectItem").get_color()

        elif select_status == BUTTON_HOVER:
            draw_vlinear(
                cr, rect.x, rect.y, rect.width, rect.height,
                app_theme.get_shadow_color("simpleItemHover").get_color_info())

        # Draw content.
        draw_text(cr,
                  self.content,
                  rect.x + self.padding_left,
                  rect.y,
                  rect.width - self.padding_left - self.arrow_width -
                  self.padding_right,
                  rect.height,
                  self.font_size,
                  font_color,
                  alignment=self.x_align)

        # Draw pixbuf.
        draw_pixbuf(
            cr, arrow_pixbuf,
            rect.x + rect.width - self.arrow_width - self.padding_right,
            rect.y + (rect.height - arrow_pixbuf.get_height()) / 2)
        propagate_expose(widget, event)

        return True
    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 = CoverManager.get_pixbuf_from_song(self.song, 37, 38, try_web=False)
            
            
        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("%s" % self.song.get_str("title"))
        draw_text(cr, "<b>%s</b>" % self.song.get_str("title"), 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)
Ejemplo n.º 3
0
    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 = CoverManager.get_pixbuf_from_song(self.song,
                                                                 37,
                                                                 38,
                                                                 try_web=False)

        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("%s" % self.song.get_str("title"))
        draw_text(cr,
                  "<b>%s</b>" % self.song.get_str("title"),
                  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)
Ejemplo n.º 4
0
 def expose_category_item(self, widget, event):    
     
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     font_color = app_theme.get_color("labelText").get_color()
     arrow_pixbuf = self.arrow_dpixbuf.get_pixbuf()
     select_index = self.get_index()
     
     if widget.state == gtk.STATE_NORMAL:
         if select_index == self.index:
             select_status = BUTTON_PRESS
         else:    
             select_status = BUTTON_NORMAL
             
     elif widget.state == gtk.STATE_PRELIGHT:        
         if select_index == self.index: 
             select_status = BUTTON_PRESS
         else:    
             select_status = BUTTON_HOVER
             
     elif widget.state == gtk.STATE_ACTIVE:        
         select_status = BUTTON_PRESS
         
     if select_status == BUTTON_PRESS:    
         draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, 
                      app_theme.get_shadow_color("simpleItemPress").get_color_info())
         font_color = app_theme.get_color("simpleSelectItem").get_color()
         
     elif select_status == BUTTON_HOVER:    
         draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, 
                      app_theme.get_shadow_color("simpleItemHover").get_color_info())
         
     
     # Draw content.
     draw_text(cr, self.content, 
               rect.x + self.padding_left, 
               rect.y,
               rect.width - self.padding_left - self.arrow_width - self.padding_right,
               rect.height, 
               self.font_size, font_color,
               alignment=self.x_align)
     
     # Draw pixbuf.    
     draw_pixbuf(cr, arrow_pixbuf, rect.x + rect.width - self.arrow_width - self.padding_right ,rect.y + (rect.height - arrow_pixbuf.get_height()) / 2)    
     propagate_expose(widget, event)
     
     return True
Ejemplo n.º 5
0
def create_separator_box(padding_x=0, padding_y=0):    
    separator_box = HSeparator(
        app_theme.get_shadow_color("hSeparator").get_color_info(),
        padding_x, padding_y)
    return separator_box
Ejemplo n.º 6
0
def draw_item_mask(cr, x, y, width, height, name):    
    draw_vlinear(cr, x, y, width, height,
                 app_theme.get_shadow_color(name).get_color_info())
Ejemplo n.º 7
0
def draw_separator(cr, x, y, width, height):
    draw_hlinear(cr, x, y, width, height, 
                 app_theme.get_shadow_color("hSeparator").get_color_info())
Ejemplo n.º 8
0
 def draw_item_mask(self, cr, x, y, width, height):
     draw_vlinear(cr, x, y, width, height,
                  app_theme.get_shadow_color("editlistItemPress").get_color_info())
Ejemplo n.º 9
0
 def draw_border_mask(self, widget, event):    
     cr = widget.window.cairo_create()
     rect = widget.allocation
     draw_vlinear(cr, rect.x + 8, rect.y + 6, rect.width - 16, rect.height - 16,
                  app_theme.get_shadow_color("linearBackground").get_color_info(),
                  4)
Ejemplo n.º 10
0
 def draw_item_mask(self, cr, x, y, width, height):    
     draw_vlinear(cr, x, y, width, height,
                  app_theme.get_shadow_color("editlistItemPress").get_color_info())        
Ejemplo n.º 11
0
def draw_item_mask(cr, x, y, width, height, name):
    draw_vlinear(cr, x, y, width, height,
                 app_theme.get_shadow_color(name).get_color_info())
Ejemplo n.º 12
0
def draw_separator(cr, x, y, width, height):
    draw_hlinear(cr, x, y, width, height,
                 app_theme.get_shadow_color("hSeparator").get_color_info())
Ejemplo n.º 13
0
def create_separator_box(padding_x=0, padding_y=0):
    separator_box = HSeparator(
        app_theme.get_shadow_color("hSeparator").get_color_info(), padding_x,
        padding_y)
    return separator_box