本文整理汇总了Python中widget.skin.app_theme.get_color函数的典型用法代码示例。如果您正苦于以下问题:Python get_color函数的具体用法?Python get_color怎么用?Python get_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, callback=None):
gtk.EventBox.__init__(self)
self.set_visible_window(False)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK |
gtk.gdk.BUTTON_RELEASE_MASK |
gtk.gdk.POINTER_MOTION_MASK |
gtk.gdk.ENTER_NOTIFY_MASK |
gtk.gdk.LEAVE_NOTIFY_MASK
)
self.connect("expose-event", self.on_expose_event)
lang = utils.get_system_lang()
if lang == "zh_CN":
prefix = "cn"
elif lang in ["zh_HK", "zh_TW"]:
prefix = "tw"
else:
prefix = "en"
self.failed_dpixbuf = app_theme.get_pixbuf("network/timeout_%s.png" % prefix)
self.connect("motion-notify-event", self.on_motion_notify)
self.connect("button-press-event", self.on_button_press)
self.normal_text_dcolor = app_theme.get_color("labelText")
self.hover_text_dcolor = app_theme.get_color("globalItemHighlight")
self.prompt_text = "点击此处刷新"
self.text_padding_y = 5
self.text_padding_x = 5
self.text_rect = None
self.is_hover = False
self.press_callback = callback
示例2: __init__
def __init__(
self,
fg_dpixbuf=app_theme.get_pixbuf("scalebar/fg.png"),
bg_dpixbuf=app_theme.get_pixbuf("scalebar/bg.png"),
point_normal_dpixbuf=app_theme.get_pixbuf("scalebar/point_normal.png"),
point_hover_dpixbuf=app_theme.get_pixbuf("scalebar/point_hover.png"),
point_press_dpixbuf=app_theme.get_pixbuf("scalebar/point_press.png"),
):
super(HScalebar, self).__init__()
self.set_draw_value(False)
self.set_range(0, 100)
self.fg_dpixbuf = fg_dpixbuf
self.bg_dpixbuf = bg_dpixbuf
self.point_normal_dpixbuf = point_normal_dpixbuf
self.point_hover_dpixbuf = point_hover_dpixbuf
self.point_press_dpixbuf = point_press_dpixbuf
self.bottom_side = 0
self.fg_cache_pixbuf = CachePixbuf()
self.bg_cache_pixbuf = CachePixbuf()
self.side_cache_pixbuf = CachePixbuf()
# Colors
self.fg_left_dcolor = app_theme.get_color("progressBarLeft")
self.fg_right_dcolor = app_theme.get_color("progressBarRight")
self.set_size_request(-1, self.bg_dpixbuf.get_pixbuf().get_height())
self.connect("expose-event", self.expose_h_scalebar)
self.connect("button-press-event", self.press_volume_progressbar)
示例3: 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)
示例4: render_title
def render_title(self, cr, rect):
# Draw select background.
# if self.is_select:
# draw_pixbuf(cr, self.hover_bg, rect.x, rect.y)
# text_color = app_theme.get_color("simpleItemSelect").get_color()
if self.is_hover:
text_color = app_theme.get_color("simpleItemHighlight").get_color()
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_CENTER)
示例5: render_title
def render_title(self, cr, rect, in_select, in_highlight):
rect.x += self.title_padding_x
rect.width -= self.title_padding_x * 2
if in_highlight:
color = app_theme.get_color("simpleSelectItem").get_color()
else:
color = app_theme.get_color("labelText").get_color()
# if error:
# color = "#ff0000"
content = utils.xmlescape(self.title)
draw_text(cr, content, rect.x, rect.y, rect.width, rect.height,
text_size=9, text_color=color, alignment=pango.ALIGN_LEFT)
示例6: expose_category_item
def expose_category_item(self, widget, event):
# Init.
cr = widget.window.cairo_create()
rect = widget.allocation
font_color = app_theme.get_color("labelText").get_color()
arrow_pixbuf = self.arrow_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_vlinear(cr, rect.x, rect.y, rect.width, rect.height,
app_theme.get_shadow_color("simpleItemPress").get_color_info())
font_color = app_theme.get_color("simpleSelectItem").get_color()
elif select_status == BUTTON_HOVER:
draw_vlinear(cr, rect.x, rect.y, rect.width, rect.height,
app_theme.get_shadow_color("simpleItemHover").get_color_info())
# Draw content.
draw_text(cr, self.content,
rect.x + self.padding_left,
rect.y,
rect.width - self.padding_left - self.arrow_width - self.padding_right,
rect.height,
self.font_size, font_color,
alignment=self.x_align)
# Draw pixbuf.
draw_pixbuf(cr, arrow_pixbuf, rect.x + rect.width - self.arrow_width - self.padding_right ,rect.y + (rect.height - arrow_pixbuf.get_height()) / 2)
propagate_expose(widget, event)
return True
示例7: 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)
示例8: render
def render(self, cr, rect):
if self.hover_flag or self.is_select:
color = app_theme.get_color("simpleItemHighlight").get_color()
else:
color = "#333333"
draw_text(cr, self.title, rect.x, rect.y, rect.width, rect.height,
text_color=color, underline=self.underline_flag)
示例9: 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)
示例10: on_expose_event
def on_expose_event(self, widget, event):
cr = widget.window.cairo_create()
rect = widget.allocation
draw_text(cr, self.text, rect.x, rect.y, rect.width, rect.height,
text_color=app_theme.get_color("labelText").get_color(),
alignment=pango.ALIGN_CENTER)
示例11: __init__
def __init__(self, draw_time_callback=None):
super(SongTimer, self).__init__()
self.label_time = Label("00:00", app_theme.get_color("labelText"), 8, enable_gaussian=True)
self.draw_time_callback = draw_time_callback
if draw_time_callback:
draw_time_callback(self.label_time.get_text())
self.bar = ProgressBar()
bar_align = gtk.Alignment()
bar_align.set_padding(0, 0, 1, 1)
bar_align.set(1, 1, 1, 1)
bar_align.add(self.bar)
self.bar.connect("button-press-event", self.on_bar_press)
self.bar.connect("button-release-event", self.on_bar_release)
self.__value_changed_id = self.bar.connect("value-changed", self.on_bar_value_changed)
self.pack_start(bar_align, True, True)
self.update_bar = 1
self.duration = 0
self.__idle_release_id = None
self.delete = False
self.__need_report = False
self.press_flag = False
Player.connect("instant-new-song", self.set_duration)
Player.connect("init-status", self.on_player_init_status)
Player.bin.connect("queue-running", self.on_queue_running)
Player.bin.connect("tick", self.on_tick)
Player.connect("seeked", self.on_seek)
Player.connect("stopped", self.set_duration)
if not Player.song:
self.bar.set_sensitive(False)
示例12: 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)
示例13: on_panel_expose_event
def on_panel_expose_event(self, widget, event):
if not self.items:
return
cr = widget.window.cairo_create()
rect = widget.allocation
draw_line(cr, (rect.x, rect.y + 1), (rect.x + rect.width, rect.y + 1), "#c7c7c7")
draw_line(cr, (rect.x + rect.width, rect.y), (rect.x + rect.width, rect.y + rect.height), "#c7c7c7")
draw_line(cr, (rect.x, rect.y + rect.height), (rect.x + rect.width, rect.y + rect.height), "#c7c7c7")
draw_line(cr, (rect.x + 1, rect.y + 32), (rect.x + 1, rect.y + rect.height), "#c7c7c7")
rect.y += self.block_height
start_x, start_y = self.padding_x, self.padding_y
for index, item in enumerate(self.items):
item_width, item_height = item.get_size()
if rect.width - start_x < item_width + self.separate_width:
start_y += item_height + self.item_interval_height
start_x = self.padding_x
item.render(cr, gtk.gdk.Rectangle(rect.x + start_x, rect.y + start_y,
item_width, item_height))
self.coords[index] = self.range(rect.x + start_x, rect.x + start_x + item_width,
rect.y + start_y, rect.y + start_y + item_height)
start_x += item_width
draw_text(cr, self.separate_text, rect.x + start_x, rect.y + start_y, self.separate_width,
self.separate_height, text_color=app_theme.get_color("labelText").get_color())
start_x += self.separate_width
return True
示例14: __init__
def __init__(self, title_name):
BaseBar.__init__(self, init_index=-1)
self.set_spacing(3)
self.child_box = gtk.VBox()
self.child_item_height = 22
self.current_page = 1
self.page_items_num = 0
self.items = []
title_item = SimpleLabel(
app_theme.get_pixbuf("filter/local_normal.png"),
title_name, 10, 25, 15, 10, 25, ALIGN_START)
self.pack_start(title_item, False, False)
self.pack_start(self.child_box, True, True)
self.child_box.connect("size-allocate", self.size_change_cb)
self.control_box = gtk.HBox()
self.control_box.set_spacing(15)
previous_align = self.create_simple_button("previous", self.update_current_page, "previous")
next_align = self.create_simple_button("next", self.update_current_page, "next")
self.info_label = Label("0/0", app_theme.get_color("labelText"), text_x_align=ALIGN_MIDDLE)
self.control_box.pack_start(previous_align, False, False)
self.control_box.pack_start(self.info_label, False, False)
self.control_box.pack_start(next_align, False, False)
self.control_box.set_no_show_all(True)
control_align = gtk.Alignment()
control_align.set(1, 1, 0.5, 0.5)
control_align.add(self.control_box)
self.pack_start(control_align, False, False)
示例15: __init__
def __init__(self):
super(MusicPlaylist, self).__init__()
self.listen_db_file = get_cache_file("baidumusic/local_listen.db")
self.status_db_file = get_cache_file("baidumusic/status.db")
# Init default items
self.default_list_item = MusicListItem("试听列表",
list_type=MusicListItem.DEFAULT_TYPE)
self.collect_list_item = MusicListItem("我的收藏",
list_type=MusicListItem.COLLECT_TYPE,
has_separator=True)
# Init category list.
self.category_list = CategoryView(enable_drag_drop=False, enable_multiple_select=True)
self.category_list.add_items([self.default_list_item, self.collect_list_item])
del self.category_list.keymap["Delete"]
self.category_list.draw_mask = self.draw_category_list_mask
self.category_list.set_size_request(CATEGROYLIST_WIDTH, -1)
self.category_list.connect("single-click-item", self.on_category_single_click)
self.category_list.connect("right-press-items", self.on_category_right_press)
self.category_list.set_highlight_item(self.default_list_item)
# View box
self.view_box = gtk.VBox()
self.view_box.connect("size-allocate", self.on_viewbox_size_allocate)
self.view_box.add(self.default_list_item.list_widget)
# bottom_box = gtk.HBox(spacing=45)
# bottom_box_align = gtk.Alignment()
# bottom_box_align.set(0.5, 0.5, 1, 1)
# bottom_box_align.set_padding(2, 2, 28, 0)
# bottom_box_align.set_size_request(-1, 22)
# bottom_box_align.add(bottom_box)
# bottom_box_align.connect("expose_event", self.on_bottombox_expose_event)
# self.search_button = create_toggle_button("toolbar/search", parent=bottom_box)
# self.person_button = create_button("combo/artist", parent=bottom_box, no_hover=True)
main_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
main_paned.pack1(self.category_list, True, True)
main_paned.pack2(self.view_box, True, False)
# events
event_manager.connect("login-success", self.on_event_login_success)
event_manager.connect("collect-songs", self.on_event_collect_songs)
event_manager.connect("add-songs", self.on_event_add_songs)
event_manager.connect("play-songs", self.on_event_play_songs)
event_manager.connect("save-listen-lists", self.on_event_save_listen_lists)
event_manager.connect("save-playlist-status", self.save_status)
# load playlists.
self.online_thread_id = 0
self.new_list_thread_id = 0
self.load()
self.load_online_lists()
self.load_status()
self.add(main_paned)