示例#1
0
    def expose_left_logo_box(self, widget, event):
        if self.pkg_name != None:
            # Init.
            cr = widget.window.cairo_create()
            rect = widget.allocation

            # Draw pkg icon.
            self.pkg_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
                    get_icon_pixbuf_path(
                        utils.get_origin_name(self.pkg_name)), self.ICON_SIZE, self.ICON_SIZE)
            draw_pixbuf(cr,
                        self.pkg_pixbuf,
                        rect.x + self.ICON_PADDING_X + (self.ICON_SIZE - self.pkg_pixbuf.get_width()) / 2,
                        rect.y + self.PADDING_Y)
示例#2
0
    def expose_left_logo_box(self, widget, event):
        if self.pkg_name != None:
            # Init.
            cr = widget.window.cairo_create()
            rect = widget.allocation

            # Draw pkg icon.
            self.pkg_pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
                get_icon_pixbuf_path(utils.get_origin_name(self.pkg_name)),
                self.ICON_SIZE, self.ICON_SIZE)
            draw_pixbuf(
                cr, self.pkg_pixbuf, rect.x + self.ICON_PADDING_X +
                (self.ICON_SIZE - self.pkg_pixbuf.get_width()) / 2,
                rect.y + self.PADDING_Y)
    def render_info(self, cr, rect):
        if self.row_index % 2 == 1:
            cr.set_source_rgba(1, 1, 1, 0.5)
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.fill()
        
        # Render icon.
        if self.icon_pixbuf == None:
            self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(
                    get_icon_pixbuf_path(utils.get_origin_name(self.pkg_name)))
            
        render_pkg_icon(cr, rect, self.icon_pixbuf)

        # Render name.
        render_pkg_name(cr, rect, get_match_context(self.alias_name, self.keywords), rect.width)
        
        # Render search result.
        with cairo_state(cr):
            text_padding_left = ITEM_PADDING_X + ICON_SIZE + ITEM_PADDING_MIDDLE
            text_padding_right = 10
            text_padding_y = ITEM_PADDING_Y + DEFAULT_FONT_SIZE * 2
            text_width = rect.width - text_padding_left - text_padding_right
            text_height = 30
            
            cr.rectangle(rect.x, rect.y + text_padding_y, rect.width, text_height)
            cr.clip()
            
            draw_text(
                cr, 
                self.highlight_string,
                rect.x + text_padding_left,
                rect.y + text_padding_y,
                text_width,
                text_height,
                text_size=DEFAULT_FONT_SIZE,
                wrap_width=text_width,
                )
示例#4
0
    def render_info(self, cr, rect):
        if self.row_index % 2 == 1:
            cr.set_source_rgba(1, 1, 1, 0.5)
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.fill()

        # Render icon.
        if self.icon_pixbuf == None:
            self.icon_pixbuf = gtk.gdk.pixbuf_new_from_file(
                    get_icon_pixbuf_path(utils.get_origin_name(self.pkg_name)))

        render_pkg_icon(cr, rect, self.icon_pixbuf)

        # Render name.
        render_pkg_name(cr, rect, get_match_context(self.alias_name, self.keywords), rect.width)

        # Render search result.
        with cairo_state(cr):
            text_padding_left = ITEM_PADDING_X + ICON_SIZE + ITEM_PADDING_MIDDLE
            text_padding_right = 10
            text_padding_y = ITEM_PADDING_Y + DEFAULT_FONT_SIZE * 2
            text_width = rect.width - text_padding_left - text_padding_right
            text_height = 30

            cr.rectangle(rect.x, rect.y + text_padding_y, rect.width, text_height)
            cr.clip()

            draw_text(
                cr,
                self.highlight_string,
                rect.x + text_padding_left,
                rect.y + text_padding_y,
                text_width,
                text_height,
                text_size=DEFAULT_FONT_SIZE,
                wrap_width=text_width,
                )