def listview1_test_on_draw_column_heade(e): if e.single_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1))) e.text_color = "#000000" elif e.motion_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#0000FF", 0.1))) e.text_color = "#0000FF" e.cr.set_source_rgba(0, 0, 1, 0.1) e.cr.rectangle(e.x, e.y, e.w, e.h) e.fill() else: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.text_color = "#FF00FF" e.cr.rectangle(e.x, e.y, e.w, e.h) e.cr.stroke() if listview1.columns[len(listview1.columns)-1] == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.cr.rectangle(e.x + e.w, e.y, listview1.allocation.width - e.x, e.h) e.cr.stroke() # 画标题栏文本. draw_text(e.cr, e.text, e.x, e.y, e.w, e.h, text_color=e.text_color, alignment=Text.CENTER)
def __on_draw_column_heade_hd(self, e): if e.single_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1))) e.text_color = "#000000" elif e.motion_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#0000FF", 0.1))) e.text_color = "#0000FF" else: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.text_color = "#FF00FF" e.cr.rectangle(e.x, e.y, e.w, e.h) e.cr.stroke() if self.columns[len(self.columns) - 1] == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.cr.rectangle(e.x + e.w, e.y, self.allocation.width - e.x, e.h) e.cr.stroke() # 画标题栏文本. draw_text(e.cr, e.text, e.x, e.y, e.w, e.h, text_color=e.text_color, alignment=Text.CENTER)
def listview1_test_on_draw_column_heade(e): if e.single_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1))) e.text_color = "#000000" elif e.motion_columns == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#0000FF", 0.1))) e.text_color = "#0000FF" e.cr.set_source_rgba(0, 0, 1, 0.1) e.cr.rectangle(e.x, e.y, e.w, e.h) e.fill() else: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.text_color = "#FF00FF" e.cr.rectangle(e.x, e.y, e.w, e.h) e.cr.stroke() if listview1.columns[len(listview1.columns) - 1] == e.column: e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#FF00FF", 0.1))) e.cr.rectangle(e.x + e.w, e.y, listview1.allocation.width - e.x, e.h) e.cr.stroke() # 画标题栏文本. draw_text(e.cr, e.text, e.x, e.y, e.w, e.h, text_color=e.text_color, alignment=Text.CENTER)
def __title_expose_event(self, widget, event, show_check): cr = widget.window.cairo_create() rect = widget.allocation # draw background. if show_check: bg_color = "#272727" else: bg_color = "#1b1b1b" cr.set_source_rgba(*alpha_color_hex_to_cairo((bg_color, 1.0))) cr.rectangle(rect.x, rect.y, rect.width + 1, rect.height) cr.fill() # draw title name. text = widget.get_label() import pango if show_check: text_color = "#FFFFFF" else: text_color = "#A9A9A9" draw_text(cr, text, rect.x, rect.y, rect.width, rect.height, text_color=text_color, text_size=9, alignment=pango.ALIGN_CENTER)
def __paint_top_window(self, e): if e.window == self.top_window: top_rect = self.top_window.get_size() cr = self.top_window.cairo_create() cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1))) cr.rectangle(0, 0, top_rect[0], top_rect[1]) cr.fill() return False
def __on_draw_item_hd(self, e): #print "__on_draw_item_hd...", e.drag_rect e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#272727",1.0))) e.cr.rectangle(*e.rect) e.cr.fill() if e.drag_rect[0] != None: drag_pixbuf = app_theme.get_pixbuf("listview/drag_line.png").get_pixbuf() drag_pixbuf = drag_pixbuf.scale_simple(e.drag_rect[2], 5, gtk.gdk.INTERP_BILINEAR) draw_pixbuf(e.cr, drag_pixbuf, 0, e.drag_rect[0] * e.drag_rect[1])
def search_ali_expose_event(self, widget, event): cr = widget.window.cairo_create() rect = widget.allocation # bg_color = "#272727" cr.set_source_rgba(*alpha_color_hex_to_cairo((bg_color,1.0))) cr.rectangle(rect.x, rect.y, rect.width + 1, rect.height) cr.fill() # propagate_expose(widget, event) return True
def search_ali_expose_event(self, widget, event): cr = widget.window.cairo_create() rect = widget.allocation # bg_color = "#272727" cr.set_source_rgba(*alpha_color_hex_to_cairo((bg_color, 1.0))) cr.rectangle(rect.x, rect.y, rect.width + 1, rect.height) cr.fill() # propagate_expose(widget, event) return True
def tooltip_btn_expose_event(self, widget, event): cr = widget.window.cairo_create() rect = widget.allocation # cr.set_source_rgba(*alpha_color_hex_to_cairo(("#fffacc", 1.0))) cr.rectangle(*rect) cr.fill() # text = widget.get_label() size = get_text_size(text) import pango draw_text(cr, text, rect.x - 1, rect.y, rect.width, rect.height, text_color="#000000", alignment=pango.ALIGN_CENTER) cr.set_source_rgba(*alpha_color_hex_to_cairo(("#e7e77c", 1.0))) cr.rectangle(*rect) cr.stroke() return True
def __on_draw_item_hd(self, e): #print "__on_draw_item_hd...", e.drag_rect e.cr.set_source_rgba(*alpha_color_hex_to_cairo(("#272727", 1.0))) e.cr.rectangle(*e.rect) e.cr.fill() if e.drag_rect[0] != None: drag_pixbuf = app_theme.get_pixbuf( "listview/drag_line.png").get_pixbuf() drag_pixbuf = drag_pixbuf.scale_simple(e.drag_rect[2], 5, gtk.gdk.INTERP_BILINEAR) draw_pixbuf(e.cr, drag_pixbuf, 0, e.drag_rect[0] * e.drag_rect[1])
def compute_shadow(self, w, h): # sahow. cairo_popover(self, self.surface_cr, self.trayicon_x, self.trayicon_y, w, h, self.radius, self.arrow_width, self.arrow_height, self.offset, pos_type=self.tray_pos_type) gaussian_blur(self.surface, SAHOW_VALUE) self.surface_cr.set_source_rgba( # set sahow color. *alpha_color_hex_to_cairo((self.sahow_color))) self.surface_cr.fill_preserve() gaussian_blur(self.surface, SAHOW_VALUE) # border. # out border. self.surface_cr.clip() cairo_popover(self, self.surface_cr, self.trayicon_x + self.trayicon_border, self.trayicon_y + self.trayicon_border, w, h + 1, self.radius, self.arrow_width, self.arrow_height, self.offset, pos_type=self.tray_pos_type) self.surface_cr.set_source_rgba( # set out border color. *alpha_color_hex_to_cairo(self.border_out_color)) self.surface_cr.set_line_width(self.border_width) self.surface_cr.fill() # in border. self.surface_cr.reset_clip() padding_h = 0.7 cairo_popover(self, self.surface_cr, self.trayicon_x + self.trayicon_border, self.trayicon_y + self.trayicon_border, w, h + padding_h, self.radius, self.arrow_width, self.arrow_height, self.offset, self.tray_pos_type) self.surface_cr.set_source_rgba(1, 1, 1, 1.0) # set in border color. self.surface_cr.set_line_width(self.border_width) self.surface_cr.fill()
def __compute_shadow(self, w, h): # sahow. cairo_popover_rectangle(self, self.surface_cr, self.trayicon_x, self.trayicon_y, w, h, self.radius) self.surface_cr.set_source_rgba( # set sahow color. *alpha_color_hex_to_cairo((self.sahow_color))) self.surface_cr.fill_preserve() gaussian_blur(self.surface, SAHOW_VALUE) # border. if self.draw_rectangle_bool: # out border. self.surface_cr.clip() cairo_popover_rectangle(self, self.surface_cr, self.trayicon_x + self.trayicon_border, self.trayicon_y + self.trayicon_border, w, h + 1, self.radius) self.surface_cr.set_source_rgba( # set out border color. *alpha_color_hex_to_cairo(self.border_out_color)) self.surface_cr.set_line_width(self.border_width) self.surface_cr.fill() self.draw_in_border(w, h)
def __paint_handle(self, e): cr = self.window.cairo_create() # if self.__child2_move_width != 0: cr.set_source_rgba(*alpha_color_hex_to_cairo(("#393939", 1.0))) cr.rectangle(self.__handle_pos_x - 1, 0, 1, self.allocation.height) cr.fill() # if self.show_check: if self.get_move_width() == 0: pixbuf = self.out_pixbuf else: pixbuf = self.in_pixbuf self.__handle_pos_h = pixbuf.get_height() x = self.__handle_pos_x - self.__handle_pos_w - 1 y = 0 + self.allocation.height/2 - self.__handle_pos_h/2 # cr.set_source_pixbuf(pixbuf, int(x), int(y)) cr.paint_with_alpha(self.handle_alpha)
def __paint_handle(self, e): cr = self.window.cairo_create() # if self.__child2_move_width != 0: cr.set_source_rgba(*alpha_color_hex_to_cairo(("#393939", 1.0))) cr.rectangle(self.__handle_pos_x - 1, 0, 1, self.allocation.height) cr.fill() # if self.show_check: if self.get_move_width() == 0: pixbuf = self.out_pixbuf else: pixbuf = self.in_pixbuf self.__handle_pos_h = pixbuf.get_height() x = self.__handle_pos_x - self.__handle_pos_w - 1 y = 0 + self.allocation.height / 2 - self.__handle_pos_h / 2 # cr.set_source_pixbuf(pixbuf, int(x), int(y)) cr.paint_with_alpha(self.handle_alpha)
def __title_expose_event(self, widget, event, show_check): cr = widget.window.cairo_create() rect = widget.allocation # draw background. if show_check: bg_color = "#272727" else: bg_color = "#1b1b1b" cr.set_source_rgba(*alpha_color_hex_to_cairo((bg_color,1.0))) cr.rectangle(rect.x, rect.y, rect.width + 1, rect.height) cr.fill() # draw title name. text = widget.get_label() import pango if show_check: text_color = "#FFFFFF" else: text_color = "#A9A9A9" draw_text(cr, text, rect.x, rect.y, rect.width, rect.height, text_color=text_color, text_size=9, alignment=pango.ALIGN_CENTER)
def __paint_bottom_window(self, e): bottom_rect = self.bottom_window.get_size() cr = self.bottom_window.cairo_create() cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1))) cr.rectangle(0, 0, bottom_rect[0], bottom_rect[1]) cr.fill()
def __paint_nodes_background(self, cr, x, y, w, h): cr.set_source_rgba(*alpha_color_hex_to_cairo(("#272727",1.0))) cr.rectangle(x, y, w, h) cr.fill()
def __paint_nodes_background(self, cr, x, y, w, h): cr.set_source_rgba(*alpha_color_hex_to_cairo(("#272727", 1.0))) cr.rectangle(x, y, w, h) cr.fill()
def paint_bg(self, cr, rect): cr.set_source_rgba(*alpha_color_hex_to_cairo(("#202020", 1.0))) cr.rectangle(*rect) cr.fill()