本文整理汇总了Python中widget.ui_utils.draw_single_mask函数的典型用法代码示例。如果您正苦于以下问题:Python draw_single_mask函数的具体用法?Python draw_single_mask怎么用?Python draw_single_mask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_single_mask函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_webcast_icon
def render_webcast_icon(self, cr, rect):
# Draw select background.
if self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.w, rect.h, "simpleItemHighlight")
draw_pixbuf(cr, self.webcast_icon, rect.x + self.side_padding,
rect.y + (rect.height - self.webcast_icon.get_height()) / 2)
示例2: render_text
def render_text(self, cr, rect):
if self.is_hover:
# Draw background.
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemSelect")
# Set font color.
font_color = "#FFFFFF"
# Don't highlight when select.
# text = self.text
else:
# Set font color.
font_color = app_theme.get_color("labelText").get_color()
# Highilght match string.
# (text_pre, text_post) = self.text.split(self.search_string)
# text = "%s<span foreground=\"#00AAFF\">%s</span>%s" % (text_pre, self.search_string, text_post)
draw_text(cr,
self.text,
rect.x + self.padding_x,
rect.y,
rect.width - self.padding_x * 2,
rect.height,
text_color=font_color)
示例3: render_title
def render_title(self, cr, rect):
# Draw select background.
if self.is_select:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHighlight")
elif self.is_hover:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHover")
if self.is_select:
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
if self.is_select:
icon_pixbuf = self.press_dpixbuf.get_pixbuf()
else:
icon_pixbuf = self.normal_dpixbuf.get_pixbuf()
rect.x += self.padding_x
rect.width -= self.padding_x * 2
icon_y = rect.y + (rect.height - icon_pixbuf.get_height()) / 2
draw_pixbuf(cr,icon_pixbuf, rect.x, icon_y)
rect.x += self.icon_width + self.padding_x
rect.width -= self.icon_width
draw_text(cr, self.title, rect.x,
rect.y, rect.width,
rect.height, text_size=10,
text_color = text_color,
alignment=pango.ALIGN_LEFT)
示例4: render_stop
def render_stop(self, cr, rect):
if self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
icon_x = rect.x + (rect.width - self.stop_pixbuf.get_width()) / 2
icon_y = rect.y + (rect.height - self.stop_pixbuf.get_height()) / 2
draw_pixbuf(cr, self.stop_pixbuf, icon_x, icon_y)
示例5: render_title
def render_title(self, cr, rect):
# Draw select background.
if self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
elif self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
if self.is_select:
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
# draw arrow
if self.is_expand:
if self.is_select:
arrow_pixbuf = self.down_press_dpixbuf.get_pixbuf()
else:
arrow_pixbuf = self.down_normal_dpixbuf.get_pixbuf()
else:
if self.is_select:
arrow_pixbuf = self.right_press_dpixbuf.get_pixbuf()
else:
arrow_pixbuf = self.right_normal_dpixbuf.get_pixbuf()
arrow_x = rect.x + self.arrow_padding_x
arrow_y = rect.y + (rect.height - arrow_pixbuf.get_height()) / 2
draw_pixbuf(cr, arrow_pixbuf, arrow_x, arrow_y)
draw_text(cr, self.title, rect.x + self.title_padding_x, rect.y,
rect.width - self.title_padding_x, rect.height, text_size=10,
text_color = text_color,
alignment=pango.ALIGN_LEFT)
示例6: render_content
def render_content(self, cr, rect):
if self.is_highlight:
if not self.is_double_click:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHighlight")
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
elif self.is_hover:
text_color = app_theme.get_color("labelText").get_color()
draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHover")
else:
text_color = app_theme.get_color("labelText").get_color()
if not self.is_highlight:
self.entry_buffer.move_to_start()
self.entry_buffer.set_text_color(text_color)
width, height = self.entry_buffer.get_content_size()
offset_y = (self.item_height - height) / 2
# offset_x = (self.item_height - width) / 2
rect.y += offset_y
rect.x += 10
# rect.x += offset_x
if self.entry and self.entry.allocation.width == self.get_column_widths()[0]-4:
self.entry.calculate()
self.entry_buffer.set_text_color("#000000")
self.entry_buffer.render(cr, rect, self.entry.im)
else:
self.entry_buffer.render(cr, rect)
示例7: render_progressbar
def render_progressbar(self, cr, rect):
if self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
self.progress_buffer.render(cr,
gtk.gdk.Rectangle(rect.x + (rect.width - self.progressbar_width) / 2,
rect.y + (rect.height - self.progressbar_height)/ 2,
self.progressbar_width, self.progressbar_height))
示例8: render_artist
def render_artist(self, cr, rect):
'''Render artist.'''
if self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
elif self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
rect.x += self.artist_padding_x
rect.width -= self.artist_padding_x * 2
render_item_text(cr, self.artist, rect, self.is_select, self.is_highlight)
示例9: expose_simple_item
def expose_simple_item(self, widget, event):
# Init.
cr = widget.window.cairo_create()
rect = widget.allocation
rect.x += 1
rect.width -= 2
font_color = app_theme.get_color("labelText").get_color()
item_pixbuf = self.normal_dpixbuf.get_pixbuf()
select_index = self.get_index()
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_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
# font_color = app_theme.get_color("simpleSelectItem").get_color()
font_color = "#FFFFFF"
item_pixbuf = self.press_dpixbuf.get_pixbuf()
elif select_status == BUTTON_HOVER:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
# Draw pixbuf.
draw_pixbuf(cr, item_pixbuf, rect.x + self.padding_left, rect.y + (rect.height - item_pixbuf.get_height()) / 2)
# Draw content.
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,
alignment=self.x_align)
propagate_expose(widget, event)
return True
示例10: render_info
def render_info(self, cr, rect):
if self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
if self.icon_pixbuf is None:
self.icon_pixbuf = CoverManager.get_pixbuf_from_song(self.song, 37, 38, try_web=False)
icon_width = self.icon_pixbuf.get_width()
icon_height = self.icon_pixbuf.get_height()
icon_x = rect.x + self.info_padding_x
icon_y = rect.y + (rect.height - icon_height) / 2
# Draw shadow.
drop_shadow_padding = 3
drop_shadow_radious = 3
draw_shadow(
cr,
icon_x,
icon_y,
icon_width + drop_shadow_padding,
icon_height + drop_shadow_padding,
drop_shadow_radious,
app_theme.get_shadow_color("window_shadow")
)
outside_shadow_padding = 2
outside_shadow_radious = 3
draw_shadow(
cr,
icon_x - outside_shadow_padding,
icon_y - outside_shadow_padding,
icon_width + outside_shadow_padding * 2,
icon_height + outside_shadow_padding * 2,
outside_shadow_radious,
app_theme.get_shadow_color("window_shadow")
)
# Draw wallpaper.
draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y)
rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x
rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width()
_width, _height = get_content_size("%s" % self.song.get_str("title"))
draw_text(cr, "<b>%s</b>" % self.song.get_str("title"), rect.x, icon_y, rect.width, _height,
text_size=10)
rect.y = icon_y + icon_width - _height
_width, _height = get_content_size(self.status_text)
draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
示例11: render_enabled
def render_enabled(self, cr, rect):
if self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
elif self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
if self.enabled:
pixbuf = self.enabled_press_dpixbuf.get_pixbuf()
else:
pixbuf = self.enabled_normal_dpixbuf.get_pixbuf()
icon_x = rect.x + (rect.width - pixbuf.get_width()) / 2
icon_y = rect.y + (rect.height - pixbuf.get_height()) / 2
draw_pixbuf(cr, pixbuf, icon_x, icon_y)
示例12: render_version
def render_version(self, cr, rect):
if self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
elif self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
if self.is_select:
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
draw_text(cr, self.pluginfo["Version"], rect.x + self.draw_padding_x,
rect.y, rect.width - self.draw_padding_x * 2,
rect.height, text_size=10,
text_color = text_color,
alignment=pango.ALIGN_LEFT)
示例13: render_title
def render_title(self, cr, rect):
if self.is_highlight:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 3, rect.height, "globalItemHighlight")
elif self.is_hover:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 3, rect.height, "globalItemHover")
if self.is_highlight:
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
rect.x += self.text_padding
rect.width -= self.text_padding * 2
draw_text(cr, self.title, rect.x, rect.y, rect.width, rect.height, text_size=9,
text_color = text_color,
alignment=pango.ALIGN_LEFT)
示例14: render_title
def render_title(self, cr, rect):
# Draw select background.
rect.y += self.padding_y + 2
# draw separator.
if self.has_separator:
draw_separator(cr, rect.x,
rect.y,
rect.width, 1
)
rect.y += self.padding_y + self.separator_height - 2
rect.height -= self.separator_height
if self.is_highlight:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHighlight")
elif self.is_hover:
draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHover")
rect.x += self.padding_x
rect.width -= self.padding_x * 2
if self.is_highlight:
pixbuf = self.press_pixbuf
else:
pixbuf = self.normal_pixbuf
if pixbuf:
icon_y = rect.y + (rect.height - self.normal_pixbuf.get_height()) / 2
draw_pixbuf(cr, pixbuf, rect.x, icon_y)
rect.x += self.icon_width + self.padding_x
rect.width -= self.icon_width - self.padding_x
if self.is_highlight:
text_color = "#FFFFFF"
else:
text_color = app_theme.get_color("labelText").get_color()
draw_text(cr, self.title, rect.x,
rect.y, rect.width,
rect.height, text_size=10,
text_color = text_color,
alignment=pango.ALIGN_LEFT)
示例15: render_album
def render_album(self, cr, rect):
"""Render album."""
if self.is_highlight:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
elif self.is_select:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
elif self.is_hover:
draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
rect.width -= self.album_padding_x * 2
render_item_text(cr, self.album, rect, self.is_select, self.is_highlight, error=self.song_error)