本文整理汇总了Python中dtk.ui.button.ImageButton类的典型用法代码示例。如果您正苦于以下问题:Python ImageButton类的具体用法?Python ImageButton怎么用?Python ImageButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __create_button
def __create_button(self, name, tip_msg=None):
button = ImageButton(
app_theme.get_pixbuf("lyric/%s_normal.png" % name),
app_theme.get_pixbuf("lyric/%s_hover.png" % name),
app_theme.get_pixbuf("lyric/%s_press.png" % name)
)
button.connect("clicked", self.player_control, name)
return button
示例2: __create_simple_button
def __create_simple_button(self, name, callback):
button = ImageButton(
app_theme.get_pixbuf("jobs/%s_normal.png" % name),
app_theme.get_pixbuf("jobs/%s_hover.png" % name),
app_theme.get_pixbuf("jobs/%s_hover.png" % name),
)
if callback:
button.connect("clicked", callback)
return button
示例3: __create_button
def __create_button(self, name, tip_msg=None):
button = ImageButton(
app_theme.get_pixbuf("action/%s_normal.png" % name),
app_theme.get_pixbuf("action/%s_hover.png" % name),
app_theme.get_pixbuf("action/%s_press.png" % name),
)
button.connect("clicked", self.player_control, name)
if tip_msg:
Tooltip.text(button, tip_msg)
return button
示例4: __create_simple_button
def __create_simple_button(self, name, callback, tip_msg=""):
button = ImageButton(
app_theme.get_pixbuf("toolbar/%s_normal.png" % name),
app_theme.get_pixbuf("toolbar/%s_hover.png" % name),
app_theme.get_pixbuf("toolbar/%s_press.png" % name),
)
button.connect("button-press-event", callback)
if tip_msg:
Tooltip.text(button, tip_msg)
self.toolbar_box.pack_start(button, False, False)
return button
示例5: create_simple_button
def create_simple_button(self, name, callback, *args):
button = ImageButton(
app_theme.get_pixbuf("filter/%s_normal.png" % name),
app_theme.get_pixbuf("filter/%s_hover.png" % name),
app_theme.get_pixbuf("filter/%s_press.png" % name)
)
if callback:
button.connect("clicked", callback, *args)
align = gtk.Alignment()
align.set(0.5, 0.5, 0, 0)
align.add(button)
return align
示例6: create_color_button
def create_color_button(self, box, name):
'''
create color button
@param box: a gtk.HBox
@param name: the button's name
'''
button = ImageButton(
app_theme.get_pixbuf("color/" + name + ".png"),
app_theme.get_pixbuf("color/" + name + "_hover.png"),
app_theme.get_pixbuf("color/" + name + "_hover.png"))
button.connect('pressed', lambda w:self._color_button_pressed(name))
box.pack_start(button)
示例7: __create_zoom_button
def __create_zoom_button(self, name, msg=None):
button = ImageButton(
app_theme.get_pixbuf("lyric/%s_normal.png" % name),
app_theme.get_pixbuf("lyric/%s_hover.png" % name),
app_theme.get_pixbuf("lyric/%s_press.png" % name)
)
button.connect("clicked", self.change_font_size, name)
if msg:
Tooltip.text(button, msg)
align = gtk.Alignment()
align.set(0.5, 0.5, 0, 0)
align.add(button)
return align
示例8: create_button
def create_button(name, callback=None, tip_msg=None, parent=None, no_hover=False):
hover = "press" if no_hover else "hover"
button = ImageButton(
app_theme.get_pixbuf("%s_normal.png" % name),
app_theme.get_pixbuf("%s_%s.png" % (name, hover)),
app_theme.get_pixbuf("%s_press.png" % name),
)
if callback:
button.connect("button-press-event", callback)
if tip_msg:
Tooltip.text(button, tip_msg)
if parent:
parent.pack_start(button, False, False)
return button
示例9: __create_simple_button
def __create_simple_button(self, name, callback, tip_msg=None, has_event=False):
button = ImageButton(
app_theme.get_pixbuf("lyric/%s_normal.png" % name),
app_theme.get_pixbuf("lyric/%s_hover.png" % name),
app_theme.get_pixbuf("lyric/%s_press.png" % name)
)
if has_event:
button.connect("button-press-event", callback)
else:
button.connect("clicked", callback)
if tip_msg:
Tooltip.text(button, tip_msg)
button_align = gtk.Alignment()
button_align.set(0.5, 0.5, 0, 0)
button_align.add(button)
return button_align
示例10: handle_pkg_status
def handle_pkg_status(self, *reply):
container_remove_all(self.left_action_box)
install_status = reply
if install_status[0][0]:
if not self.data_manager.get_pkg_desktop_info(self.pkg_name):
status_label = Label(_("Successfully installed"))
self.left_action_box.pack_start(status_label)
else:
action_button = ImageButton(
app_theme.get_pixbuf("button/start_normal.png"),
app_theme.get_pixbuf("button/start_hover.png"),
app_theme.get_pixbuf("button/start_press.png"),
)
action_button.connect("button-press-event", self.button_press_start_button)
self.left_action_box.pack_start(action_button)
else:
action_button = ImageButton(
app_theme.get_pixbuf("button/install_normal.png"),
app_theme.get_pixbuf("button/install_hover.png"),
app_theme.get_pixbuf("button/install_press.png"),
)
action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
self.left_action_box.pack_start(action_button)
self.left_action_box.show_all()
global_event.emit('update-current-status-pkg-page', self)
示例11: handle_pkg_status
def handle_pkg_status(self, reply, success):
container_remove_all(self.left_action_box)
if success:
install_status = str(reply)
print install_status
if install_status == "installed":
if not self.data_manager.get_pkg_desktop_info(self.pkg_name):
status_label = Label(_("Successfully installed"))
self.left_action_box.pack_start(status_label)
else:
action_button = ImageButton(
app_theme.get_pixbuf("button/start_normal.png"),
app_theme.get_pixbuf("button/start_hover.png"),
app_theme.get_pixbuf("button/start_press.png"),
)
action_button.connect("button-press-event", self.button_press_start_button)
self.left_action_box.pack_start(action_button)
elif install_status == "unknown":
status_label = Label(_("Not found"))
self.left_action_box.pack_start(status_label)
else:
action_button = ImageButton(
app_theme.get_pixbuf("button/install_normal.png"),
app_theme.get_pixbuf("button/install_hover.png"),
app_theme.get_pixbuf("button/install_press.png"),
)
action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
self.left_action_box.pack_start(action_button)
self.left_action_box.show_all()
global_event.emit('update-current-status-pkg-page', self)
else:
global_logger.logerror("get_pkg_installed handle_dbus_error")
global_logger.logerror(reply)
示例12: add_new_box
def add_new_box(self):
table = gtk.Table()
#hbox.set_size_request(-1, 30)
name_label = Label(_("Name:"), enable_select=False)
name_label.set_can_focus(False)
exec_label = Label(_("Exec:"), enable_select=False)
exec_label.set_can_focus(False)
desc_label = Label(_("Comment:"), enable_select=False)
desc_label.set_can_focus(False)
self.name_entry = InputEntry()
self.exec_entry = InputEntry()
self.desc_entry = InputEntry()
self.name_entry.set_size(200, 22)
self.exec_entry.set_size(200, 22)
self.desc_entry.set_size(200, 22)
name_label_align = self.wrap_with_align(name_label)
exec_label_align = self.wrap_with_align(exec_label)
desc_label_align = self.wrap_with_align(desc_label)
name_align = style.wrap_with_align(self.name_entry)
exec_align = style.wrap_with_align(self.exec_entry)
desc_align = style.wrap_with_align(self.desc_entry)
table = gtk.Table(3, 4)
self.table_add(table, [name_label_align, exec_label_align, desc_label_align], 0)
self.table_add(table, [name_align, exec_align, desc_align], 1)
open_folder = ImageButton(self.icon_pixbuf, self.icon_pixbuf, self.icon_pixbuf)
open_folder.connect("clicked", lambda w: OpenFileDialog("Choose file", self, ok_callback=self.ok_callback))
table.attach(style.wrap_with_align(open_folder), 2, 3, 1, 2)
align = gtk.Alignment(0.5, 0, 0, 0)
style.set_table(table)
align.add(table)
return align
示例13: create_button
def create_button(self, name, text=''):
'''
make a button
@param name: the button's name, a string
@param text: the button's tooltip text, a string
'''
button = ImageButton(
app_theme.get_pixbuf("action/" + name + "_normal.png"),
app_theme.get_pixbuf("action/" + name + "_hover.png"),
app_theme.get_pixbuf("action/" + name + "_press.png"))
button.connect("enter-notify-event", self._show_tooltip, text)
button.connect("clicked", self._button_clicked, name)
button.set_name(name)
#button.set_size_request(28, 28)
self.toolbox.pack_start(button)
return button
示例14: handle_pkg_status
def handle_pkg_status(self, reply, success):
container_remove_all(self.left_action_box)
if success:
install_status = str(reply)
if install_status == "uninstalled":
action_button = ImageButton(
app_theme.get_pixbuf("button/install_normal.png"),
app_theme.get_pixbuf("button/install_hover.png"),
app_theme.get_pixbuf("button/install_press.png"),
)
action_button.connect("clicked", lambda w: global_event.emit("install-pkg", [self.pkg_name]))
self.left_action_box.pack_start(action_button)
elif install_status == "unknown":
status_label = Label(_("Not found"))
self.left_action_box.pack_start(status_label)
else:
try:
desktops = json.loads(install_status)
if not desktops:
status_label = Label(_("Successfully installed"))
self.left_action_box.pack_start(status_label)
else:
action_button = ImageButton(
app_theme.get_pixbuf("button/start_normal.png"),
app_theme.get_pixbuf("button/start_hover.png"),
app_theme.get_pixbuf("button/start_press.png"),
)
action_button.connect("button-press-event", lambda w, e:self.button_press_start_button(w, e, desktops))
self.left_action_box.pack_start(action_button)
except:
logging.error("detail install status: %s = %s" % (self.pkg_name, install_status))
self.left_action_box.show_all()
global_event.emit('update-current-status-pkg-page', self)
else:
global_logger.logerror("get_pkg_installed handle_dbus_error")
global_logger.logerror(reply)
示例15: __init__
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()
self.left_homepage_box = gtk.HBox()
self.left_homepage_box_align = gtk.Alignment()
self.left_homepage_box_align.set(0.0, 0.5, 0, 0)
self.left_homepage_box_align.add(self.left_homepage_box)
self.left_recommend_box = gtk.VBox()
self.left_recommend_box_align = gtk.Alignment()
self.left_recommend_box_align.set(0.0, 0.0, 0, 0)
self.left_recommend_box_align.set_padding(30, 0, 14, 0)
self.left_recommend_box_align.add(self.left_recommend_box)
self.left_recommend_label = Label(_("Popular recommendations"))
self.right_info_box = gtk.VBox()
self.scrolled_window = ScrolledWindow(0, 0)
self.right_view_box = gtk.VBox()
self.right_top_box = gtk.HBox()
self.right_top_box.set_size_request(-1, self.RIGHT_TITLE_BOX_HEIGHT)
self.right_desc_box = gtk.VBox()
self.right_slide_box = gtk.VBox()
self.right_comment_box = gtk.VBox()
self.right_title_box = gtk.VBox()
self.return_button = ImageButton(
app_theme.get_pixbuf("detail/normal.png"),
app_theme.get_pixbuf("detail/hover.png"),
app_theme.get_pixbuf("detail/press.png"),
)
self.return_align = gtk.Alignment()
self.return_align.set(0.5, 0.5, 1, 1)
self.return_align.set_padding(self.ALIAS_NAME_PADDING_Y, 0, 0, self.RIGHT_INFO_PADDING_X)
self.return_align.add(self.return_button)
self.return_button.connect("clicked", lambda w: global_event.emit("switch-from-detail-page"))
self.right_top_box.pack_start(self.right_title_box, True, True)
self.right_top_box.pack_start(self.return_align, False, False)
self.right_view_box.pack_start(self.right_top_box, False, False)
self.right_view_box.pack_start(self.right_desc_box, False, False)
self.right_view_box.pack_start(self.right_slide_box, False, False)
self.right_view_box.pack_start(self.right_comment_box, False, False)
self.scrolled_window.add_child(self.right_view_box)
self.left_view_box.pack_start(self.left_logo_box, False, False)
self.left_view_box.pack_start(self.star_align, False, False)
self.left_view_box.pack_start(self.left_action_align, False, False)
#.........这里部分代码省略.........