本文整理汇总了Python中theme.ui_theme.get_shadow_color函数的典型用法代码示例。如果您正苦于以下问题:Python get_shadow_color函数的具体用法?Python get_shadow_color怎么用?Python get_shadow_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_shadow_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_mask_multiple_page
def draw_mask_multiple_page(self, cr, x, y, w, h):
'''
Internal render function for DIALOG_MASK_MULTIPLE_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.
'''
titlebar_height = self.titlebar.get_allocation().height
button_box_height = self.right_button_box.get_allocation().height
dominant_color = skin_config.dominant_color
draw_vlinear(
cr, x, y + titlebar_height, w, h - titlebar_height,
ui_theme.get_shadow_color("mask_single_page_bottom").get_color_info(),
)
draw_vlinear(
cr, x, y + h - button_box_height, w, button_box_height,
[(0, (dominant_color, 1.0)),
(1, (dominant_color, 1.0))])
draw_vlinear(
cr, x, y + h - button_box_height, w, button_box_height,
ui_theme.get_shadow_color("mask_multiple_page").get_color_info(),
)
示例2: 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
示例3: 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
示例4: draw_mask_glass_page
def draw_mask_glass_page(self, cr, x, y, w, h):
'''Draw make for glass page type.'''
top_height = 70
draw_vlinear(
cr, x, y, w, top_height,
ui_theme.get_shadow_color("mask_glass_page_top").get_color_info(),
)
draw_vlinear(
cr, x, y + top_height, w, h - top_height,
ui_theme.get_shadow_color("mask_glass_page_bottom").get_color_info(),
)
示例5: 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()
示例6: 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
示例7: __init__
def __init__(self,
items,
font_size=DEFAULT_FONT_SIZE,
padding_left=20,
padding_middle=10,
padding_right=25):
'''
Initialize Categorybar class.
@param items: A list of category item, format: (icon_dpixbuf, content, click_callback)
'''
# Init event box.
super(Categorybar, self).__init__()
self.category_index = 0
self.connect(
"expose-event",
lambda w, e:
expose_linear_background(w, e, ui_theme.get_shadow_color("categorybar_background").get_color_info()))
# Init category box.
self.category_item_box = gtk.VBox()
self.add(self.category_item_box)
# Init item.
if items:
icon_width = self.get_icon_width(items)
for (index, item) in enumerate(items):
category_item = CategoryItem(item, index, font_size, icon_width, padding_left, padding_middle, padding_right,
self.set_index, self.get_index)
self.category_item_box.pack_start(category_item)
# Show.
self.show_all()
示例8: render
def render(self, cr, rect):
"""
Render icon and name of DirItem.
"""
# Draw select background.
if self.is_button_press == True:
draw_vlinear(
cr,
rect.x,
rect.y,
rect.width,
rect.height,
ui_theme.get_shadow_color("listview_select").get_color_info(),
)
# Draw directory icon.
draw_pixbuf(cr, self.pixbuf, rect.x + self.icon_size / 2, rect.y + (rect.height - self.icon_size) / 2)
# Draw directory name.
draw_text(
cr,
self.name,
rect.x,
rect.y + self.icon_size + ITEM_PADDING_Y * 2,
rect.width,
DEFAULT_FONT_SIZE,
DEFAULT_FONT_SIZE,
alignment=pango.ALIGN_CENTER,
)
示例9: render_size
def render_size(self, cr, rect):
'''
Render size of DirItem.
'''
# Draw select background.
if self.is_select:
draw_vlinear(cr, rect.x ,rect.y, rect.width, rect.height,
ui_theme.get_shadow_color("listview_select").get_color_info())
# Draw directory size.
draw_text(cr, self.size_name,
rect.x,
rect.y,
rect.width,
rect.height,
alignment=pango.ALIGN_RIGHT,
)
# Draw drag line.
if self.drag_line:
with cairo_disable_antialias(cr):
cr.set_line_width(1)
if self.drag_line_at_bottom:
cr.rectangle(rect.x, rect.y + rect.height - 1, rect.width, 1)
else:
cr.rectangle(rect.x, rect.y, rect.width, 1)
cr.fill()
示例10: 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)
示例11: render_name
def render_name(self, cr, rect):
'''
Render icon and name of DirItem.
'''
# Draw select background.
if self.is_select:
draw_vlinear(cr, rect.x ,rect.y, rect.width, rect.height,
ui_theme.get_shadow_color("listview_select").get_color_info())
# Init.
expand_indicator_pixbuf = ui_theme.get_pixbuf("treeview/arrow_right.png").get_pixbuf()
# Draw directory icon.
draw_pixbuf(cr, self.pixbuf,
rect.x + COLUMN_OFFSET * self.column_index + INDICATOR_PADDING_LEFT + expand_indicator_pixbuf.get_width() + INDICATOR_PADDING_RIGHT + ICON_PADDING_LEFT,
rect.y + (rect.height - ICON_SIZE) / 2,
)
# Draw directory name.
draw_text(cr, self.name,
rect.x + COLUMN_OFFSET * self.column_index + INDICATOR_PADDING_LEFT + expand_indicator_pixbuf.get_width() + INDICATOR_PADDING_RIGHT + ICON_PADDING_LEFT + ICON_SIZE + ICON_PADDING_RIGHT,
rect.y,
rect.width, rect.height)
# Draw drag line.
if self.drag_line:
with cairo_disable_antialias(cr):
cr.set_line_width(1)
if self.drag_line_at_bottom:
cr.rectangle(rect.x, rect.y + rect.height - 1, rect.width, 1)
else:
cr.rectangle(rect.x, rect.y, rect.width, 1)
cr.fill()
示例12: create_separator_item
def create_separator_item(self):
'''Create separator item.'''
self.item_box = HSeparator(
ui_theme.get_shadow_color("h_separator").get_color_info(),
self.item_padding_left,
self.item_padding_y)
self.item_box_height = self.item_padding_y * 2 + 1
示例13: create_separator_item
def create_separator_item(self):
"""
Internal function to create separator item.
"""
self.item_box = HSeparator(
ui_theme.get_shadow_color("h_separator").get_color_info(), self.item_padding_x, self.item_padding_y
)
self.item_box_height = self.item_padding_y * 2 + 1
示例14: 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
示例15: draw_menu_mask
def draw_menu_mask(self, cr, x, y, w, h):
'''Draw mask.'''
# Draw background.
cr.set_source_rgba(*alpha_color_hex_to_cairo(ui_theme.get_alpha_color("menu_mask").get_color_info()))
cr.rectangle(x, y, w, h)
cr.fill()
# Draw left side.
draw_hlinear(cr, x + 1, y + 1, 16 + self.padding_x + self.padding_x * 2, h - 2,
ui_theme.get_shadow_color("menu_side").get_color_info())