def draw_background(self, widget, event):
        cr = widget.window.cairo_create()
        x, y, w, h = widget.allocation
        cr.set_source_rgb(*color_hex_to_cairo(MODULE_BG_COLOR))
        cr.rectangle(x, y+1, w, h-1)
        cr.fill()

        cr.set_source_rgb(*color_hex_to_cairo(TREEVIEW_BORDER_COLOR))
        draw_line(cr, x, y + 1, x + w, y + 1)
    def __expose(self, widget, event):
        cr = widget.window.cairo_create()                                       
        rect = widget.allocation                                                
        
        cr.set_source_rgb(*color_hex_to_cairo(MODULE_BG_COLOR))                     
        cr.rectangle(rect.x, rect.y, rect.width, rect.height)                       
        cr.fill()

        cr.set_source_rgb(*color_hex_to_cairo(TREEVIEW_BORDER_COLOR))
        draw_line(cr, rect.x, rect.y + 1, rect.x + rect.width, rect.y + 1)
    def render_delete(self, cr, rect):
         
        self.render_background(cr, rect)
        if self.delete_hover:
            delete_icon = self.delete_pixbuf_out
            draw_pixbuf(cr, delete_icon.get_pixbuf(), rect.x + self.CHECK_LEFT_PADDING/2, rect.y + (rect.height - IMG_WIDTH)/2)
        else:
            delete_icon = self.delete_pixbuf_out

        BORDER_COLOR = color_hex_to_cairo("#d2d2d2")
        with cairo_disable_antialias(cr):
            cr.set_source_rgb(*BORDER_COLOR)
            cr.set_line_width(1)
            draw_line(cr, rect.x + rect.width, rect.y, rect.x + rect.width, rect.y + rect.height)
Esempio n. 4
0
    def expose_nav_separator(self, widget, event):
        """
        Internal callback for `expose-event` signal.
        """
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation

        # Draw separator.
        cr.set_source_rgba(1, 1, 1, 0.5)
        draw_line(cr, rect.x + 1, rect.y + 1, rect.x + rect.width - 1, rect.y + 1)

        cr.set_source_rgba(0, 0, 0, 0.5)
        draw_line(cr, rect.x + 1, rect.y + 2, rect.x + rect.width - 1, rect.y + 2)

        return True
Esempio n. 5
0
    def expose_titlebar_separator(self, widget, event):
        '''
        Expose the separation line between the titlebar and the body of the window.

        @param widget: A widget of type Gtk.Widget.
        @param event: Not used.
        @return: Always return True.
        '''
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation
    
        # Draw separator.
        cr.set_source_rgba(1, 1, 1, 0.5)
        draw_line(cr, rect.x + 1, rect.y + 2, rect.x + rect.width - 1, rect.y + 1)
    
        return True
    def draw_lines(w, event):
        cr = w.window.cairo_create()
        rect = w.allocation
        BORDER_COLOR = color_hex_to_cairo("#d2d2d2")
        cr.set_source_rgb(*BORDER_COLOR)
        cr.set_line_width(1)

        if direction is 0: # Top
            draw_line(cr, rect.x, rect.y, rect.x + rect.width, rect.y)

        elif direction is 1: #Bottom
            draw_line(cr, rect.x, rect.y + rect.height + 1, rect.x + rect.width, rect.y + rect.height +1)
        elif direction is 2: #left
            draw_line(cr, rect.x , rect.y , rect.x, rect.y + rect.height)
        else:
            draw_line(cr, rect.x + rect.width , rect.y + 29, rect.x + rect.width , rect.y + rect.height)
def draw_out_line(cr, rect, exclude=[]):
    with cairo_disable_antialias(cr):
        BORDER_COLOR = color_hex_to_cairo("#d2d2d2")
        cr.set_source_rgb(*BORDER_COLOR)
        cr.set_line_width(1)
        
        # Top
        if "top" not in exclude:
            draw_line(cr, rect.x, rect.y, rect.x + rect.width + 1, rect.y)
        # bottom
        if "bot" not in exclude:
            draw_line(cr, rect.x, rect.y + rect.height + 1, rect.x + rect.width +1, rect.y + rect.height +1)
        # left
        if "left" not in exclude:
            draw_line(cr, rect.x , rect.y , rect.x, rect.y + rect.height)
        # right
        if "right" not in exclude:
            draw_line(cr, rect.x + rect.width + 1, rect.y + 29, rect.x + rect.width , rect.y + rect.height)
    def __expose(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation

        cr.set_source_rgb(*color_hex_to_cairo(TREEVIEW_BORDER_COLOR))
        draw_line(cr, rect.x, rect.y + 1, rect.x + self.width, rect.y + 1)
 def expose_event(self, widget, event):
     cr = widget.window.cairo_create()
     rect = widget.child.allocation
     width, height = get_content_size(self.label_name)
     cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("link_text").get_color()))
     draw_line(cr, rect.x, rect.y + rect.height, rect.x + width, rect.y + rect.height)