本文整理汇总了Python中dtk.ui.label.Label.set_clickable方法的典型用法代码示例。如果您正苦于以下问题:Python Label.set_clickable方法的具体用法?Python Label.set_clickable怎么用?Python Label.set_clickable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.label.Label
的用法示例。
在下文中一共展示了Label.set_clickable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from dtk.ui.label import Label [as 别名]
# 或者: from dtk.ui.label.Label import set_clickable [as 别名]
def __init__(self, detail_page, pkg_name, alias_name, star):
'''
init docs
'''
gtk.HBox.__init__(self)
self.star = star
self.pkg_name = pkg_name
v_box = gtk.VBox()
pkg_icon_image = gtk.image_new_from_pixbuf(
gtk.gdk.pixbuf_new_from_file_at_size(get_icon_pixbuf_path(pkg_name), 32, 32))
pkg_alias_label = Label(alias_name,
hover_color=app_theme.get_color("homepage_hover"))
pkg_alias_label.set_clickable()
pkg_alias_label.connect("button-press-event", lambda w, e: detail_page.update_pkg_info(pkg_name))
self.pkg_star_box = gtk.HBox()
self.pkg_star_view = StarView()
self.pkg_star_view.star_buffer.star_level = int(star)
self.pkg_star_view.connect("clicked", lambda w: self.grade_pkg())
self.pkg_star_mark = StarMark(self.star, self.MARK_SIZE, self.MARK_PADDING_X, self.MARK_PADDING_Y)
self.pack_start(pkg_icon_image, False, False)
self.pack_start(v_box, True, True, 8)
v_box.pack_start(pkg_alias_label, False, False, 2)
v_box.pack_start(self.pkg_star_box, False, False, 2)
self.pkg_star_box.pack_start(self.pkg_star_view, False, False)
self.pkg_star_box.pack_start(self.pkg_star_mark, False, False)
示例2: show_screenshot
# 需要导入模块: from dtk.ui.label import Label [as 别名]
# 或者: from dtk.ui.label.Label import set_clickable [as 别名]
def show_screenshot(self):
container_remove_all(self.right_slide_box)
screenshot_dir = os.path.join(SCREENSHOT_DOWNLOAD_DIR, self.pkg_name)
if os.path.exists(screenshot_dir):
screenshot_files = map(lambda filename: os.path.join(screenshot_dir, filename),
filter(lambda file_name: file_name.endswith(".png"), os.listdir(screenshot_dir)))
if len(screenshot_files) > 0:
slide_switcher = SlideSwitcher(
map(lambda screenshot_file: get_resize_pixbuf_with_height(screenshot_file, 290), screenshot_files),
pointer_offset_x=-370,
pointer_offset_y=-15,
horizontal_align=ALIGN_MIDDLE,
vertical_align=ALIGN_MIDDLE,
height_offset=60,
hover_switch=False,
auto_switch=False,
navigate_switch=True,
)
slide_align = gtk.Alignment()
slide_align.set(0.5, 0.5, 1, 1)
slide_align.add(slide_switcher)
slide_align.connect("expose-event", self.expose_resizable_label_background)
self.right_slide_box.pack_start(slide_align, True, True)
powered_link = Label(
_("Powered by UpYun.com"),
text_color=app_theme.get_color("homepage"),
hover_color=app_theme.get_color("homepage_hover"),
)
powered_link.set_clickable()
powered_link.connect("button-press-event", lambda w, e: run_command("xdg-open https://www.upyun.com/"))
powered_link_align = gtk.Alignment()
powered_link_align.set(1.0, 0.5, 0, 0)
powered_link_align.set_padding(0, 0, 0, 100)
powered_link_align.add(powered_link)
self.right_slide_box.pack_start(powered_link_align, False, False)
self.show_all()
else:
global_logger.logerror("%s haven't any screenshot from zip file" % self.pkg_name)
示例3: DetailPage
# 需要导入模块: from dtk.ui.label import Label [as 别名]
# 或者: from dtk.ui.label.Label import set_clickable [as 别名]
class DetailPage(gtk.HBox):
'''
class docs
'''
PADDING_Y = 20
ICON_SIZE = 64
ICON_PADDING_X = 50
STAR_PADDING_X = 36
STAR_PADDING_Y = 12
STAR_SIZE = 13
MARK_NUMBER_SIZE = 11
MARK_NUMBER_PADDING_X = 4
MARK_NUMBER_PADDING_Y = 10
INFO_RENDER_X = 10
INFO_RENDER_Y = 140
INFO_RENDER_HEIGHT = 18
INFO_CATEGORY_RENDER_Y = INFO_RENDER_Y + INFO_RENDER_HEIGHT
INFO_VERSION_RENDER_Y = INFO_RENDER_Y + INFO_RENDER_HEIGHT * 2
INFO_SIZE_RENDER_Y = INFO_RENDER_Y + INFO_RENDER_HEIGHT * 3
INFO_DOWNLOAD_RENDER_Y = INFO_RENDER_Y + INFO_RENDER_HEIGHT * 4
INFO_HOMEPAGE_RENDER_Y = INFO_RENDER_Y + INFO_RENDER_HEIGHT * 5
LEFT_INFO_PADDING_X = 18
LEFT_INFO_PADDING_Y = 50
LEFT_BUTTON_PADDING_Y = 50
LEFT_INFO_WIDTH = 164
RIGHT_INFO_PADDING_X = 30
RIGHT_TITLE_BOX_HEIGHT = 70
ALIAS_NAME_SIZE = 16
ALIAS_NAME_PADDING_Y = 20
LONG_DESC_PADDING_Y = 10
LONG_DESC_WRAP_WIDTH = 630
LONG_DESC_INIT_HEIGHT = 45
MARK_SIZE = 11
MARK_PADDING_X = 5
MARK_PADDING_Y = -3
def __init__(self, data_manager):
'''
init docs
'''
gtk.HBox.__init__(self)
self.data_manager = data_manager
self.pkg_name = None
self.alias_name = ""
self.pkg_pixbuf = None
self.pkg_star_view = None
self.left_view_box = gtk.VBox()
self.left_view_box.set_size_request(self.LEFT_INFO_WIDTH, - 1)
self.left_logo_box = gtk.VBox()
self.left_logo_box.set_size_request(-1, 90)
self.star_box = gtk.HBox()
self.star_align = gtk.Alignment(0.4, 0.5, 0, 0)
self.star_align.set_padding(0, 5, 0, 0)
self.star_align.add(self.star_box)
self.left_action_box = gtk.HBox()
self.left_action_align = gtk.Alignment()
self.left_action_align.set(0.5, 0.5, 0, 0)
self.left_action_align.set_padding(0, 30, 0, 0)
self.left_action_align.add(self.left_action_box)
self.left_label_table = gtk.Table(4, 1)
self.left_label_table.set_row_spacings(4)
self.left_label_align = gtk.Alignment()
self.left_label_align.set(0.0, 0.5, 0, 0)
self.left_label_align.set_padding(0, 0, 14, 0)
self.left_category_name_label = Label()
self.left_category_label = Label(hover_color=app_theme.get_color("homepage_hover"))
self.left_category_label.set_clickable()
self.left_category_label_align = gtk.Alignment()
self.left_category_label_align.set(0.0, 0.5, 0, 0)
self.left_category_label_align.add(self.left_category_label)
self.left_category_label_box = gtk.HBox()
self.left_category_label_box.pack_start(self.left_category_name_label, False, False)
self.left_category_label_box.pack_start(self.left_category_label_align, True, True)
self.left_category_box = gtk.VBox()
self.left_version_label = Label(label_width=136)
show_label_tooltip(self.left_version_label)
self.left_version_label.set_ellipsize(pango.ELLIPSIZE_END)
self.left_download_label = Label()
self.left_size_label = Label()
#.........这里部分代码省略.........
示例4: update_pkg_info
# 需要导入模块: from dtk.ui.label import Label [as 别名]
# 或者: from dtk.ui.label.Label import set_clickable [as 别名]
def update_pkg_info(self, pkg_name):
current_time = time.time()
if current_time - self.update_pkg_time < self.update_pkg_interval:
return False
else:
self.update_pkg_time = current_time
FetchPackageInfo(pkg_name, self.update_some_info).start()
self.pkg_name = pkg_name
detail_info = self.data_manager.get_pkg_detail_info(self.pkg_name)
self.category = detail_info['category']
self.long_desc = detail_info['long_desc']
self.version = detail_info['version']
self.homepage = detail_info['homepage']
self.alias_name = detail_info['alias_name']
self.recommend_pkgs = detail_info['recommend_pkgs']
self.pkg_star_view = StarView()
self.pkg_star_view.connect("clicked", lambda w: self.grade_pkg())
self.pkg_star_mark = StarMark(5.0, self.MARK_SIZE, self.MARK_PADDING_X, self.MARK_PADDING_Y)
container_remove_all(self.star_box)
self.star_box.pack_start(self.pkg_star_view, False, False)
self.star_box.pack_start(self.pkg_star_mark, False, False)
self.fetch_pkg_status()
container_remove_all(self.left_category_box)
if self.category != None:
self.left_category_name_label.set_text(_("Category: "))
self.left_category_label.set_text(get_category_name(self.category[1]))
self.left_category_box.add(self.left_category_label_box)
self.left_version_label.set_text(_("Version: %s") % self.version)
self.left_download_label.set_text(_("Download: 0"))
self.left_size_label.set_text(_("Size: calculating..."))
container_remove_all(self.left_homepage_box)
if self.homepage != "":
homepage_label = Label(_("Visit Homepage"),
text_color=app_theme.get_color("homepage"),
hover_color=app_theme.get_color("homepage_hover"))
homepage_label.set_clickable()
homepage_label.connect("button-press-event", lambda w, e: run_command("xdg-open %s" % self.homepage))
self.left_homepage_box.pack_start(homepage_label)
container_remove_all(self.left_recommend_box)
if len(self.recommend_pkgs) > 0:
self.left_recommend_box.pack_start(self.left_recommend_label, False, False, 8)
for (recommend_pkg_name, alias_name, star) in self.recommend_pkgs:
self.left_recommend_box.pack_start(RecommendPkgItem(self, recommend_pkg_name, alias_name, star), False, False, 4)
container_remove_all(self.right_desc_box)
resizable_label = ResizableLabel(self.long_desc.replace("&", "&").replace("<", "<").replace(">", ">"),
self.LONG_DESC_WRAP_WIDTH,
self.LONG_DESC_INIT_HEIGHT,
3)
resizable_align = gtk.Alignment()
resizable_align.set(0.5, 0.5, 1, 1)
resizable_align.set_padding(0, 0, self.RIGHT_INFO_PADDING_X, self.RIGHT_INFO_PADDING_X)
resizable_align.add(resizable_label)
resizable_align.connect("expose-event", self.expose_resizable_label_background)
self.right_desc_box.pack_start(resizable_align, False, False)
self.show_screenshot()
self.fetch_comment()
self.show_all()