def render_text(self, cr, rect): if self.is_hover or self.is_select: # Draw background. draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, ui_theme.get_shadow_color("menu_item_select").get_color_info()) # Set font color. font_color = ui_theme.get_color("menu_select_font").get_color() # Don't highlight when select. text = self.text else: # Set font color. font_color = ui_theme.get_color("menu_font").get_color() # Highilght match string. r = self.text.partition(self.search_string.lower()) text = "%s<span foreground=\"#00AAFF\">%s</span>%s" % (r[0], r[1], r[2]) draw_text(cr, text, rect.x + self.padding_x, rect.y, rect.width - self.padding_x * 2, rect.height, text_color=font_color)
def render_text(self, cr, rect): if self.is_hover or self.is_select: # Draw background. draw_vlinear( cr, rect.x, rect.y, rect.width, rect.height, ui_theme.get_shadow_color("menu_item_select").get_color_info()) # Set font color. font_color = ui_theme.get_color("menu_select_font").get_color() # Don't highlight when select. text = self.text else: # Set font color. font_color = ui_theme.get_color("menu_font").get_color() # Highilght match string. r = self.text.partition(self.search_string.lower()) text = "%s<span foreground=\"#00AAFF\">%s</span>%s" % (r[0], r[1], r[2]) draw_text(cr, text, rect.x + self.padding_x, rect.y, rect.width - self.padding_x * 2, rect.height, text_color=font_color)
def draw_fg(self, cr, rect): # fg. 前景 渐变颜色. color = ui_theme.get_shadow_color("menu_item_select").get_color_info()[0][1][0] shadow_color = [(0.0, (color, 1.0)), (0.7, (color, 0.7)), (1.0, (color, 0.2))] draw_hlinear(cr, rect.x, rect.y, int(float(self.value) / self.max * rect.width), rect.height, shadow_color )
def draw_mask_single_page(self, cr, x, y, w, h): ''' Internal render function for DIALOG_MASK_SINGLE_PAGE type. @param cr: Cairo context. @param x: X coordinate of draw area. @param y: Y coordinate of draw area. @param w: Width of draw area. @param h: Height of draw area. ''' top_height = 70 draw_vlinear( cr, x, y, w, top_height, ui_theme.get_shadow_color("mask_single_page_top").get_color_info(), ) draw_vlinear( cr, x, y + top_height, w, h - top_height, ui_theme.get_shadow_color("mask_single_page_bottom").get_color_info(), )
def render(self, cr, rect): # Init. x, y, w, h = rect.x, rect.y, rect.width, rect.height # Draw background frame. with cairo_state(cr): cr.rectangle(x, y + 1, w, h - 2) cr.rectangle(x + 1, y, w - 2, h) cr.clip() cr.set_source_rgb(*color_hex_to_cairo( ui_theme.get_color( "progressbar_background_frame").get_color())) cr.rectangle(x, y, w, h) cr.set_line_width(1) cr.stroke() # Draw background. with cairo_state(cr): cr.rectangle(x + 1, y + 1, w - 2, h - 2) cr.clip() draw_vlinear( cr, x + 1, y + 1, w - 2, h - 2, ui_theme.get_shadow_color( "progressbar_background").get_color_info(), ) cache_pixbuf_object = CachePixbuf() if self.progress > 0 and self.progress < 100: cache_pixbuf_object.scale( self.percentage_dpixbuf[int(self.progress / 10)].get_pixbuf(), w, h) if self.progress == 100: cache_pixbuf_object.scale( self.percentage_dpixbuf[9].get_pixbuf(), w, h) draw_pixbuf(cr, cache_pixbuf_object.get_cache(), x, y) # Draw light. with cairo_disable_antialias(cr): cr.set_source_rgba(1, 1, 1, 0.5) cr.rectangle(x + 1, y + 1, w - 2, 1) cr.fill()
def __render_name(self, cr, rect): font_color = ui_theme.get_color("menu_font").get_color() ''' cr.set_source_rgb(1, 1, 1) cr.rectangle(rect.x, rect.y, rect.width, rect.height) cr.fill() ''' if self.is_hover: # Draw background. draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, ui_theme.get_shadow_color("menu_item_select").get_color_info()) font_color = ui_theme.get_color("menu_select_font").get_color() draw_text(cr, self.name, rect.x + 10, rect.y, self.ITEM_WIDTH, rect.height, text_color=font_color)
def __render_name(self, cr, rect): font_color = ui_theme.get_color("menu_font").get_color() ''' cr.set_source_rgb(1, 1, 1) cr.rectangle(rect.x, rect.y, rect.width, rect.height) cr.fill() ''' if self.is_hover: # Draw background. draw_vlinear( cr, rect.x, rect.y, rect.width, rect.height, ui_theme.get_shadow_color("menu_item_select").get_color_info()) font_color = ui_theme.get_color("menu_select_font").get_color() draw_text(cr, self.name, rect.x + 10, rect.y, self.ITEM_WIDTH, rect.height, text_color=font_color)
def render(self, cr, rect): # Init. x, y, w, h = rect.x, rect.y, rect.width, rect.height # Draw background frame. with cairo_state(cr): cr.rectangle(x, y + 1, w, h - 2) cr.rectangle(x + 1, y, w - 2, h) cr.clip() cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("progressbar_background_frame").get_color())) cr.rectangle(x, y, w, h) cr.set_line_width(1) cr.stroke() # Draw background. with cairo_state(cr): cr.rectangle(x + 1, y + 1, w - 2, h - 2) cr.clip() draw_vlinear(cr, x + 1, y + 1, w - 2, h - 2, ui_theme.get_shadow_color("progressbar_background").get_color_info(), ) cache_pixbuf_object = CachePixbuf() if self.progress > 0 and self.progress < 100: cache_pixbuf_object.scale(self.percentage_dpixbuf[int(self.progress / 10)].get_pixbuf(), w, h) if self.progress == 100: cache_pixbuf_object.scale(self.percentage_dpixbuf[9].get_pixbuf(), w, h) draw_pixbuf(cr, cache_pixbuf_object.get_cache(), x, y) # Draw light. with cairo_disable_antialias(cr): cr.set_source_rgba(1, 1, 1, 0.5) cr.rectangle(x + 1, y + 1, w - 2, 1) cr.fill()
def render_background(self, item, cr, rect): draw_vlinear(cr, rect.x ,rect.y, rect.width, rect.height, ui_theme.get_shadow_color("listview_select").get_color_info())
def render_background(self, item, cr, rect): draw_vlinear( cr, rect.x, rect.y, rect.width, rect.height, ui_theme.get_shadow_color("listview_select").get_color_info())
def create_separator_box(padding_x=0, padding_y=0): separator_box = HSeparator( ui_theme.get_shadow_color("h_separator").get_color_info(), padding_x, padding_y) return separator_box