当前位置: 首页>>代码示例>>Python>>正文


Python ImageButton.connect方法代码示例

本文整理汇总了Python中dtk.ui.button.ImageButton.connect方法的典型用法代码示例。如果您正苦于以下问题:Python ImageButton.connect方法的具体用法?Python ImageButton.connect怎么用?Python ImageButton.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dtk.ui.button.ImageButton的用法示例。


在下文中一共展示了ImageButton.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_pkg_status

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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)
开发者ID:PeterDaveHello,项目名称:deepin-software-center,代码行数:35,代码来源:detail_page.py

示例2: handle_pkg_status

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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)
开发者ID:menghun3,项目名称:deepin-software-center-1,代码行数:27,代码来源:detail_page.py

示例3: __create_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:10,代码来源:lyrics_module.py

示例4: __create_simple_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:11,代码来源:jobs_manager.py

示例5: __create_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:12,代码来源:headerbar.py

示例6: create_color_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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)
开发者ID:ChanningBJ,项目名称:deepin-screenshot,代码行数:14,代码来源:toolbar.py

示例7: __create_simple_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
    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
开发者ID:linuxmint17,项目名称:deepin-music,代码行数:14,代码来源:playlist.py

示例8: create_simple_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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 
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:14,代码来源:outlookbar.py

示例9: __create_zoom_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:15,代码来源:lyrics_module.py

示例10: create_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
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
开发者ID:WilliamRen,项目名称:dmusic-plugin-baidumusic,代码行数:17,代码来源:music_ui.py

示例11: create_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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
开发者ID:BZZYTGTD,项目名称:deepin-screenshot,代码行数:18,代码来源:toolbar.py

示例12: __create_simple_button

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 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
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:20,代码来源:lyrics_module.py

示例13: handle_pkg_status

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
    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)
开发者ID:kissthink,项目名称:deepin-store,代码行数:39,代码来源:detail_page.py

示例14: add_new_box

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
    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
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:39,代码来源:widget.py

示例15: get_user_info

# 需要导入模块: from dtk.ui.button import ImageButton [as 别名]
# 或者: from dtk.ui.button.ImageButton import connect [as 别名]
 def get_user_info(self, weibo):
     '''get weibo user info'''
     info = weibo.get_user_name()
     gtk.gdk.threads_enter()
     #self.get_user_error_text = ""
     weibo_hbox = weibo.get_box()
     hbox = gtk.HBox(False)
     vbox = gtk.VBox(False)
     weibo_hbox.pack_start(vbox, False, False)
     vbox.pack_start(hbox)
     #print weibo.t_type, info
     if info:
         self.is_get_user_info[weibo] = 1
         label = Label(text=info, label_width=70, enable_select=False)
         check = CheckButton()
         #check = gtk.CheckButton()
         check.connect("toggled", self.weibo_check_toggle, weibo)
         check.set_active(True)
         check_vbox = gtk.VBox(False)
         check_align = gtk.Alignment(0.5, 0.5, 0, 0)
         check_align.add(check_vbox)
         check_vbox.pack_start(check, False, False)
         button = ImageButton(
             app_theme.get_pixbuf("share/" + weibo.t_type + ".png"),
             app_theme.get_pixbuf("share/" + weibo.t_type + ".png"),
             app_theme.get_pixbuf("share/" + weibo.t_type + ".png"))
         utils.set_clickable_cursor(button)
         button.connect("enter-notify-event", self.show_tooltip, _("Click to switch user"))
         hbox.pack_start(check_align, False, False)
         hbox.pack_start(button, False, False, 5)
         hbox.pack_start(label, False, False)
     else:
         self.is_get_user_info[weibo] = 0
         check = CheckButton()
         #check = gtk.CheckButton()
         check.set_sensitive(False)
         check_vbox = gtk.VBox(False)
         check_align = gtk.Alignment(0.5, 0.5, 0, 0)
         check_align.add(check_vbox)
         check_vbox.pack_start(check, False, False)
         button = ImageButton(
             app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"),
             app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"),
             app_theme.get_pixbuf("share/" + weibo.t_type + "_no.png"))
         utils.set_clickable_cursor(button)
         button.connect("enter-notify-event", self.show_tooltip, _("Click to login"))
         hbox.pack_start(check_align, False, False)
         hbox.pack_start(button, False, False, 5)
         # curl time out
         info_error = weibo.get_curl_error()
         if info_error:
             #self.get_user_error_text += "%s:%s." % (weibo.t_type, _(info_error))
             hbox.pack_start(
                 Label(text="(%s)" % _(info_error), label_width=70,enable_select=False,
                 text_color = app_theme.get_color("left_char_num1")), False, False)
         
     button.connect("clicked", self.weibo_login, weibo)
     self.__weibo_check_button_list.append(check)
     self.__weibo_image_button_list.append(button)
     gtk.gdk.threads_leave()
     return weibo_hbox
开发者ID:jaycococ,项目名称:deepin-screenshot,代码行数:63,代码来源:share.py


注:本文中的dtk.ui.button.ImageButton.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。