• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ui_theme.get_color函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中theme.ui_theme.get_color函数的典型用法代码示例。如果您正苦于以下问题:Python get_color函数的具体用法?Python get_color怎么用?Python get_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: on_expose_combo_frame

    def on_expose_combo_frame(self, widget, event):
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation

        # Draw frame.
        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            if self.get_sensitive():
                cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("combo_entry_frame").get_color()))
            else:
                cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("disable_frame").get_color()))
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.stroke()

            if self.focus_flag:
                color = (ui_theme.get_color("combo_entry_select_background").get_color(), 0.9)
                cr.set_source_rgba(*alpha_color_hex_to_cairo(color))
                cr.rectangle(rect.x, rect.y, rect.width - 1 - self.drop_button_width, rect.height - 1)
                cr.fill()
                cr.set_source_rgba(*alpha_color_hex_to_cairo((ui_theme.get_color("combo_entry_background").get_color(), 0.9)))
                cr.rectangle(rect.x + rect.width - 1 - self.drop_button_width, rect.y, self.drop_button_width, rect.height - 1)
                cr.fill()
            else:
                cr.set_source_rgba(*alpha_color_hex_to_cairo((ui_theme.get_color("combo_entry_background").get_color(), 0.9)))
                cr.rectangle(rect.x, rect.y, rect.width - 1, rect.height - 1)
                cr.fill()

        # Propagate expose to children.
        propagate_expose(widget, event)

        return True
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:32,代码来源:combo.py


示例2: expose_spin_bg

    def expose_spin_bg(self, widget, event):
        '''
        Internal callback for `expose-event` signal.
        '''
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation
        x, y, w, h = rect.x, rect.y, rect.width, rect.height

        # Draw frame.
        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            if widget.state == gtk.STATE_INSENSITIVE:
                cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("disable_frame").get_color()))
            else:
                cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("combo_entry_frame").get_color()))
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.stroke()

            if widget.state == gtk.STATE_INSENSITIVE:
                cr.set_source_rgba(*alpha_color_hex_to_cairo((ui_theme.get_color("disable_background").get_color(), 0.9)))
            else:
                cr.set_source_rgba(*alpha_color_hex_to_cairo((ui_theme.get_color("combo_entry_background").get_color(), 0.9)))
            cr.rectangle(rect.x, rect.y, rect.width - 1, rect.height - 1)
            cr.fill()

        propagate_expose(widget, event)

        return False
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:29,代码来源:spin.py


示例3: render

    def render(self, cr, rect):
        '''
        IconView interface function.
        
        Render item.
        
        @param cr: Cairo context.
        @param rect: Render rectangle area.
        '''
        # Init.
        draw_x = rect.x + self.padding_x
        draw_y = rect.y + self.padding_y
        
        # Draw color.
        cr.set_source_rgb(*color_hex_to_cairo(self.color))
        cr.rectangle(draw_x, draw_y, self.width, self.height)
        cr.fill()
        
        if self.hover_flag:
            cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("color_item_hover").get_color()))
            cr.rectangle(draw_x, draw_y, self.width, self.height)
            cr.stroke()
        elif self.highlight_flag:
            cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("color_item_highlight").get_color()))
            cr.rectangle(draw_x, draw_y, self.width, self.height)
            cr.stroke()

        # Draw frame.
        with cairo_disable_antialias(cr):    
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("color_item_frame").get_color()))
            cr.rectangle(draw_x, draw_y, self.width, self.height)
            cr.stroke()
开发者ID:liuhuan520,项目名称:deepin-ui,代码行数:33,代码来源:color_selection.py


示例4: render

    def render(self, cr, rect):
        font_color = ui_theme.get_color("menu_font").get_color()
        if isinstance(self.icon_normal_dpixbuf, gtk.gdk.Pixbuf):
            icon_pixbuf = self.icon_normal_dpixbuf
        elif isinstance(self.icon_normal_dpixbuf, DynamicPixbuf):
            icon_pixbuf = self.icon_normal_dpixbuf.get_pixbuf()

        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())

            # Set icon pixbuf.
            if isinstance(self.icon_hover_dpixbuf, gtk.gdk.Pixbuf):
                icon_pixbuf = self.icon_hover_dpixbuf
            elif isinstance(self.icon_hover_dpixbuf, DynamicPixbuf):
                icon_pixbuf = self.icon_hover_dpixbuf.get_pixbuf()

            # Set font color.
            font_color = ui_theme.get_color("menu_select_font").get_color()

        draw_pixbuf(cr, icon_pixbuf,
                    rect.x + self.padding_x,
                    rect.y + (rect.height - icon_pixbuf.get_height()) / 2)

        draw_text(cr,
                  self.text,
                  rect.x + self.padding_x * 2 + self.icon_width,
                  rect.y,
                  rect.width - self.padding_x * 2,
                  rect.height,
                  text_color=font_color)
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:32,代码来源:poplist.py


示例5: expose_droplist_item

 def expose_droplist_item(self, widget, event, item_content):
     '''Expose droplist item.'''
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     font_color = ui_theme.get_color("menu_font").get_color()
     
     # Draw select effect.
     if self.subdroplist_active or widget.state in [gtk.STATE_PRELIGHT, gtk.STATE_ACTIVE]:
         # 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()
         
     # Draw item content.
     draw_text(cr, item_content, 
                 rect.x + self.item_padding_left,
                 rect.y,
                 rect.width,
                 rect.height,
                 self.font_size, font_color,
                 )
     
     # Propagate expose to children.
     propagate_expose(widget, event)
 
     return True
开发者ID:netphi,项目名称:deepin-ui,代码行数:29,代码来源:droplist.py


示例6: __init__

    def __init__(self,
                 monitor_widget,
                 text_font=DEFAULT_FONT,
                 text_size=18,
                 offset_x=0,
                 offset_y=0,
                 text_color=ui_theme.get_color("osd_tooltip_text"),
                 border_color=ui_theme.get_color("osd_tooltip_border"),
                 border_radious=1):
        '''
        Initialize OSDTooltip class.

        @param monitor_widget: Widget to monitor event.
        @param text_font: Text font, default is DEFAULT_FONT.
        @param text_size: Text size, default is 18.
        @param offset_x: Offset X coordinate relative to monitor widget.
        @param offset_y: Offset Y coordinate relative to monitor widget.
        @param text_color: Text color.
        @param border_color: Border color.
        @param border_radious: Border radious.
        '''
        # Init.
        gtk.Window.__init__(self, gtk.WINDOW_POPUP)
        self.monitor_widget = monitor_widget
        self.text = ""
        self.text_size = text_size
        self.text_font = text_font
        self.offset_x = offset_x
        self.offset_y = offset_y
        self.text_color = text_color
        self.border_color = border_color
        self.border_radious = border_radious
        self.monitor_window = None
        self.monitor_window_x = None
        self.monitor_window_y = None
        self.monitor_window_width = None
        self.monitor_window_height = None
        self.start_hide_delay = 5000 # milliseconds
        self.hide_time = 500         # milliseconds

        # Init callback id.
        self.configure_event_callback_id = None
        self.destroy_callback_id = None
        self.start_hide_callback_id = None
        self.focus_out_callback_id = None

        # Init window.
        self.set_decorated(False)
        self.set_skip_taskbar_hint(True)
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) # keeep above
        self.set_colormap(gtk.gdk.Screen().get_rgba_colormap())
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.set_accept_focus(False) # make Alt+Space menu can't response

        # Connect signal.
        self.connect("expose-event", self.expose_osd_tooltip)
        self.connect("realize", self.realize_osd_tooltip)
        self.connect("show", self.show_osd_tooltip)
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:58,代码来源:osd_tooltip.py


示例7: expose_menu_item

 def expose_menu_item(self, widget, event):
     '''Expose menu item.'''
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     font_color = ui_theme.get_color("menu_font").get_color()
     (item_icons, item_content, item_node) = self.item[0:3]
     
     # Draw select effect.
     if self.submenu_active or widget.state in [gtk.STATE_PRELIGHT, gtk.STATE_ACTIVE]:
         # Draw background.
         draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, 
                      ui_theme.get_shadow_color("menu_item_select").get_color_info(),
                      MENU_ITEM_RADIUS)
         
         # Set font color.
         font_color = ui_theme.get_color("menu_select_font").get_color()
         
     # Draw item icon.
     pixbuf = None
     pixbuf_width = 0
     if item_icons:
         (item_normal_dpixbuf, item_hover_dpixbuf) = item_icons
         if self.submenu_active or widget.state in [gtk.STATE_PRELIGHT, gtk.STATE_ACTIVE]:
             if item_hover_dpixbuf == None:
                 pixbuf = item_normal_dpixbuf.get_pixbuf()
             else:
                 pixbuf = item_hover_dpixbuf.get_pixbuf()
         else:
             pixbuf = item_normal_dpixbuf.get_pixbuf()
         pixbuf_width += pixbuf.get_width()
         draw_pixbuf(cr, pixbuf, rect.x + self.item_padding_x, rect.y + (rect.height - pixbuf.get_height()) / 2)
         
     # Draw item content.
     draw_text(cr, item_content, 
                 rect.x + self.item_padding_x * 2 + self.icon_width,
                 rect.y,
                 rect.width,
                 rect.height,
                 self.font_size, font_color,
                 )
     
     # Draw submenu arrow.
     if isinstance(item_node, Menu):
         if self.submenu_active or widget.state in [gtk.STATE_PRELIGHT, gtk.STATE_ACTIVE]:
             submenu_pixbuf = ui_theme.get_pixbuf("menu/arrow_hover.png").get_pixbuf()
         else:
             submenu_pixbuf = ui_theme.get_pixbuf("menu/arrow_normal.png").get_pixbuf()
         draw_pixbuf(cr, submenu_pixbuf,
                     rect.x + rect.width - self.item_padding_x - submenu_pixbuf.get_width() - self.arrow_padding_x,
                     rect.y + (rect.height - submenu_pixbuf.get_height()) / 2)
     
     # Propagate expose to children.
     propagate_expose(widget, event)
 
     return True
开发者ID:netphi,项目名称:deepin-ui,代码行数:56,代码来源:menu.py


示例8: expose_category_item

 def expose_category_item(self, widget, event):
     '''Expose navigate item.'''
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     select_index = self.get_index()
     font_color = ui_theme.get_color("category_item").get_color()
     
     # Draw background.
     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, 
                     ui_theme.get_shadow_color("category_item_press").get_color_info())
 
         font_color = ui_theme.get_color("category_select_item").get_color()
     elif select_status == BUTTON_HOVER:
         draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height, 
                     ui_theme.get_shadow_color("category_item_hover").get_color_info())
         
         font_color = ui_theme.get_color("category_select_item").get_color()
         
     # Draw navigate item.
     category_item_pixbuf = self.icon_dpixbuf.get_pixbuf()
     draw_pixbuf(
         cr, category_item_pixbuf, 
         rect.x + self.padding_left,
         rect.y + (rect.height - category_item_pixbuf.get_height()) / 2
         )
     
     # Draw font.
     draw_text(cr, self.content, 
                 rect.x + self.padding_left + self.font_offset,
                 rect.y,
                 rect.width - self.padding_left - self.font_offset - self.padding_right,
                 rect.height,
                 self.font_size, 
                 font_color,
                 )
     
     # Propagate expose to children.
     propagate_expose(widget, event)
 
     return True
开发者ID:netphi,项目名称:deepin-ui,代码行数:55,代码来源:categorybar.py


示例9: expose_button

 def expose_button(self, widget, event):
     '''Expose button.'''
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     x, y, w, h = rect.x, rect.y, rect.width, rect.height
     
     # Get color info.
     if widget.state == gtk.STATE_NORMAL:
         text_color = ui_theme.get_color("button_font").get_color()
         border_color = ui_theme.get_color("button_border_normal").get_color()
         background_color = ui_theme.get_shadow_color("button_background_normal").get_color_info()
     elif widget.state == gtk.STATE_PRELIGHT:
         text_color = ui_theme.get_color("button_font").get_color()
         border_color = ui_theme.get_color("button_border_prelight").get_color()
         background_color = ui_theme.get_shadow_color("button_background_prelight").get_color_info()
     elif widget.state == gtk.STATE_ACTIVE:
         text_color = ui_theme.get_color("button_font").get_color()
         border_color = ui_theme.get_color("button_border_active").get_color()
         background_color = ui_theme.get_shadow_color("button_background_active").get_color_info()
     elif widget.state == gtk.STATE_INSENSITIVE:
         text_color = ui_theme.get_color("disable_text").get_color()
         border_color = ui_theme.get_color("disable_frame").get_color()
         disable_background_color = ui_theme.get_color("disable_background").get_color()
         background_color = [(0, (disable_background_color, 1.0)),
                             (1, (disable_background_color, 1.0))]
         
     # Draw background.
     draw_vlinear(
         cr,
         x + 1, y + 1, w - 2, h - 2,
         background_color)
     
     # Draw border.
     cr.set_source_rgb(*color_hex_to_cairo(border_color))
     draw_line(cr, x + 2, y + 1, x + w - 2, y + 1) # top
     draw_line(cr, x + 2, y + h, x + w - 2, y + h) # bottom
     draw_line(cr, x + 1, y + 2, x + 1, y + h - 2) # left
     draw_line(cr, x + w, y + 2, x + w, y + h - 2) # right
     
     # Draw four point.
     if widget.state == gtk.STATE_INSENSITIVE:
         top_left_point = ui_theme.get_pixbuf("button/disable_corner.png").get_pixbuf()
     else:
         top_left_point = ui_theme.get_pixbuf("button/corner.png").get_pixbuf()
     top_right_point = top_left_point.rotate_simple(270)
     bottom_right_point = top_left_point.rotate_simple(180)
     bottom_left_point = top_left_point.rotate_simple(90)
     
     draw_pixbuf(cr, top_left_point, x, y)
     draw_pixbuf(cr, top_right_point, x + w - top_left_point.get_width(), y)
     draw_pixbuf(cr, bottom_left_point, x, y + h - top_left_point.get_height())
     draw_pixbuf(cr, bottom_right_point, x + w - top_left_point.get_width(), y + h - top_left_point.get_height())
     
     # Draw font.
     draw_text(cr, self.label, x, y, w, h, self.font_size, text_color,
                 alignment=pango.ALIGN_CENTER)
     
     return True
开发者ID:netphi,项目名称:deepin-ui,代码行数:59,代码来源:button.py


示例10: render_title

    def render_title(self, cr, rect):
        font_color = ui_theme.get_color("menu_font").get_color()

        if self.is_hover:
            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.title, rect.x + self.padding_x,
                  rect.y, rect.width - self.padding_x * 2,
                  rect.height, text_size=self.font_size,
                  text_color = font_color,
                  alignment=pango.ALIGN_LEFT)
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:12,代码来源:combo.py


示例11: render

 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(), 
                      )
         
     if self.progress > 0:    
         # Draw foreground 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_antialias(cairo.ANTIALIAS_NONE)
             cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("progressbar_foreground_frame").get_color()))
             cr.rectangle(x + 1, y + 1, int(w * self.progress / 100) - 1, h - 1)
             cr.set_line_width(1)
             cr.stroke()
             
         # Draw foreground.
         with cairo_state(cr):
             cr.rectangle(x + 1, y + 1, w - 2, h - 2)
             cr.clip()
             
             draw_vlinear(cr, x + 1, y + 1, int(w * self.progress / 100) - 2, h - 2,
                          ui_theme.get_shadow_color("progressbar_foreground").get_color_info(), 
                          )
         
     # 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()
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:51,代码来源:progressbar.py


示例12: __init__

 def __init__(self, can_close_tab=False):
     '''
     Initialize TabBox class.
     '''
     # Init.
     gtk.VBox.__init__(self)
     self.tab_height = 29
     self.tab_padding_x = 19
     self.tab_padding_y = 9
     self.tab_select_bg_color = ui_theme.get_color("tab_select_bg")
     self.tab_select_frame_color = ui_theme.get_color("tab_select_frame")
     self.tab_unselect_bg_color = ui_theme.get_color("tab_unselect_bg")
     self.tab_unselect_frame_color = ui_theme.get_color("tab_unselect_bg")
     self.can_close_tab = can_close_tab
     self.close_button_size = 6
     self.close_button_frame_size = 3
     self.close_button_padding_x = 4
     self.close_button_padding_y = 6
     self.close_button_select_background_color = "#EE0000"
     self.close_button_select_foreground_color = "#FFFFFF"
     self.close_button_color = "#666666"
     self.hover_close_button_index = None
     
     self.tab_title_box = gtk.DrawingArea()
     self.tab_title_box.add_events(gtk.gdk.ALL_EVENTS_MASK)
     self.tab_title_box.set_size_request(-1, self.tab_height)
     self.tab_title_align = gtk.Alignment()
     self.tab_title_align.set(0.0, 0.0, 1.0, 1.0)
     self.tab_title_align.set_padding(0, 0, 0, 0)
     self.tab_title_align.add(self.tab_title_box)
     self.tab_content_align = gtk.Alignment()
     self.tab_content_align.set(0.0, 0.0, 1.0, 1.0)
     self.tab_content_align.set_padding(0, 0, 0, 0)
     self.tab_content_box = gtk.VBox()
     self.tab_content_align.add(self.tab_content_box)
     
     self.tab_items = []
     self.tab_title_widths = []
     self.tab_index = -1
     
     self.default_widget = None
     
     self.pack_start(self.tab_title_align, False, False)
     self.pack_start(self.tab_content_align, True, True)
     
     self.tab_title_box.connect("button-press-event", self.press_tab_title_box)
     self.tab_title_box.connect("expose-event", self.expose_tab_title_box)
     self.tab_title_box.connect("motion-notify-event", self.motion_notify_tab_title_box)
     self.tab_content_align.connect("expose-event", self.expose_tab_content_align)
     self.tab_content_box.connect("expose-event", self.expose_tab_content_box)
开发者ID:liuhuan520,项目名称:deepin-ui,代码行数:50,代码来源:tab_window.py


示例13: __init__

 def __init__(self, 
              shrink_first,
              enable_animation=False,
              always_show_button=False,
              enable_drag=False,
              handle_color=ui_theme.get_color("paned_line")
              ):
     '''
     Initialize Paned class.
     '''
     gtk.Paned.__init__(self)
     self.shrink_first = shrink_first
     self.enable_animation = enable_animation
     self.always_show_button = always_show_button
     self.enable_drag = enable_drag
     self.handle_color = handle_color
     self.bheight = ui_theme.get_pixbuf("paned/paned_up_normal.png").get_pixbuf().get_width()
     self.saved_position = -1
     self.handle_size = PANED_HANDLE_SIZE - 1
     self.show_button = False
     self.init_button("normal")
     self.animation_delay = 20 # milliseconds
     self.animation_times = 10
     self.animation_position_frames = []
     self.press_coordinate = None
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:25,代码来源:paned.py


示例14: draw_background

    def draw_background(self, cr, rect):
        with cairo_disable_antialias(cr):
            # Draw frame.
            x, y, w, h = rect.x, rect.y, rect.width, rect.height
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo(
                self.frame_color.get_color()))
            cr.rectangle(x, y, w, h)
            cr.stroke()

            # Draw background.
            cr.set_source_rgba(*alpha_color_hex_to_cairo(
                (ui_theme.get_color("combo_entry_background").get_color(), 0.9)))
            cr.rectangle(x, y, w - 1, h - 1)
            cr.fill()

            # Draw mac dot.
            cr.set_source_rgba(0.5, 0.5, 0.5, 0.8)
            dot_distance = self.width / self.segment_number
            dot_bottom_padding = 18
            for index in range(0, self.last_segment_index):
                draw_text(cr,
                          self.segment_split_char,
                          x + dot_distance * (index + 1) - self.dot_size / 2,
                          y + h - dot_bottom_padding,
                          self.dot_size,
                          self.dot_size,
                          )
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:28,代码来源:net.py


示例15: __init__

    def __init__(self, tab_names, font_size=11, padding_x=0, padding_y=0):
        """
        Initialize TabSwitcher class.

        @param tab_names: The name of tabs.
        @param padding_x: The padding x around tab name, default is 0 pixel.
        @param padding_y: The padding y around tab name, default is 0 pixel.
        """
        EventBox.__init__(self)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.tab_names = tab_names
        self.tab_name_size = font_size
        self.tab_number = len(self.tab_names)
        tab_sizes = map(lambda tab_name: get_content_size(tab_name, self.tab_name_size), self.tab_names)
        self.tab_name_padding_x = 10
        self.tab_name_padding_y = 2
        self.tab_width = max(map(lambda (width, height): width, tab_sizes)) + self.tab_name_padding_x * 2
        self.tab_height = tab_sizes[0][1] + self.tab_name_padding_y * 2
        self.tab_line_height = 3
        self.tab_index = 0

        self.tab_animation_x = 0
        self.tab_animation_time = 200  # milliseconds

        self.padding_x = padding_x
        self.padding_y = padding_y
        self.in_animiation = False
        self.line_dcolor = ui_theme.get_color("globalItemHighlight")

        self.set_size_request(-1, self.tab_height + self.tab_line_height)

        self.connect("realize", self.realize_tab_switcher)
        self.connect("expose-event", self.expose_tab_switcher)
        self.connect("button-press-event", self.button_press_tab_switcher)
开发者ID:web3d,项目名称:deepin-ui,代码行数:34,代码来源:tab_switcher.py


示例16: __init__

 def __init__(self, text, link, enable_gaussian=True, 
              text_color=ui_theme.get_color("link_text")):
     '''Init link button.'''
     Label.__init__(self, text, text_color, enable_gaussian=enable_gaussian, text_size=9,
                    gaussian_radious=1, border_radious=0)
     
     self.connect("button-press-event", lambda w, e: run_command("xdg-open %s" % link))
     
     set_clickable_cursor(self)
开发者ID:netphi,项目名称:deepin-ui,代码行数:9,代码来源:button.py


示例17: expose_droplist_frame

    def expose_droplist_frame(self, widget, event):
        '''Expose droplist frame.'''
        cr = widget.window.cairo_create()        
        rect = widget.allocation

        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("droplist_frame").get_color()))
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.fill()
开发者ID:netphi,项目名称:deepin-ui,代码行数:10,代码来源:droplist.py


示例18: __init__

 def __init__(self, items, droplist_height=None, select_index=0, max_width=None):
     '''Init combo box.'''
     # Init.
     gtk.VBox.__init__(self)
     self.set_can_focus(True)
     self.items = items
     self.droplist_height = droplist_height
     self.select_index = select_index
     self.focus_flag = False
     
     self.droplist = Droplist(self.items, max_width=max_width)
     if self.droplist_height:
         self.droplist.set_size_request(-1, self.droplist_height)
     self.width = self.droplist.get_droplist_width() 
     self.height = 22
     self.label_padding_left = 6
     self.box = gtk.HBox()
     self.dropbutton_width = ui_theme.get_pixbuf("combo/dropbutton_normal.png").get_pixbuf().get_width()
     self.label = Label(self.items[select_index][0], 
                        label_width=self.width - self.dropbutton_width - 1 - self.label_padding_left,
                        enable_select=False,
                        enable_double_click=False)
     self.label.text_color = ui_theme.get_color("menu_font")
     self.dropbutton = DisableButton(
         (ui_theme.get_pixbuf("combo/dropbutton_normal.png"),
          ui_theme.get_pixbuf("combo/dropbutton_hover.png"),
          ui_theme.get_pixbuf("combo/dropbutton_press.png"),
          ui_theme.get_pixbuf("combo/dropbutton_disable.png")),
         )
             
     self.align = gtk.Alignment()
     self.align.set(0.5, 0.5, 0.0, 0.0)
     self.align.set_padding(1, 1, 1 + self.label_padding_left, 1)
     
     self.pack_start(self.align, False, False)
     self.align.add(self.box)
     self.box.pack_start(self.label, False, False)
     self.box.pack_start(self.dropbutton, False, False)
     
     self.align.connect("expose-event", self.expose_combobox_frame)
     self.label.connect("button-press-event", self.click_drop_button)
     self.dropbutton.connect("button-press-event", self.click_drop_button)
     self.droplist.connect("item-selected", self.update_select_content)
     self.droplist.connect("key-release", lambda dl, s, o, i: self.emit("key-release", s, o, i))
     self.connect("key-press-event", self.key_press_combo)
     self.connect("key-release-event", self.key_release_combo)
     self.connect("focus-in-event", self.focus_in_combo)
     self.connect("focus-out-event", self.focus_out_combo)
     
     self.keymap = {
         "Home" : self.select_first_item,
         "End" : self.select_last_item,
         "Up" : self.select_prev_item,
         "Down" : self.select_next_item}
开发者ID:netphi,项目名称:deepin-ui,代码行数:54,代码来源:combo.py


示例19: on_expose_alignment

    def on_expose_alignment(widget, event):
        '''Expose tooltip label.'''
        rect = widget.allocation
        cr = widget.window.cairo_create()

        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            cr.set_source_rgba(*color_hex_to_cairo(ui_theme.get_color("tooltip_frame").get_color()))
            cr.rectangle(rect.x + 1, rect.y + 1, rect.width - 1, rect.height - 1)
            cr.stroke()
        return True
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:11,代码来源:tooltip.py


示例20: expose_combo_list_frame

    def expose_combo_list_frame(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        cr.set_source_rgb(1, 1, 1)
        cr.rectangle(*rect)
        cr.fill()

        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            cr.set_source_rgb(*color_hex_to_cairo(ui_theme.get_color("droplist_frame").get_color()))
            cr.rectangle(rect.x + 1, rect.y + 1, rect.width - 1, rect.height - 1)
            cr.stroke()
开发者ID:chenzhiwei,项目名称:deepin-ui,代码行数:12,代码来源:combo.py



注:本文中的theme.ui_theme.get_color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui_theme.get_pixbuf函数代码示例发布时间:2022-05-27
下一篇:
Python shortcuts.render_to_response函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap