def __on_delete(self, widget):
     if self.delete_view.is_deletable():
         dlg = ConfirmDialog(_("Delete Wallpaper"),
                             _("Are you sure delete wallpaper?"), 300, 100,
                             lambda: self.__delete_confirm(), None, True,
                             CONTENT_FONT_SIZE)
         dlg.show_all()
 def on_theme_delete(self, item):
     dlg = ConfirmDialog(_("Delete Theme"), 
                         _("Are you sure you want to delete the theme %s?") % item.theme.get_name(), 
                         300, 
                         100, 
                         lambda : self.delete_theme(item), 
                         None, 
                         True, 
                         CONTENT_FONT_SIZE)
     dlg.show_all()
 def __on_delete(self, widget):
     dlg = ConfirmDialog(_("Delete Wallpaper"),
                         _("Are you sure delete wallpaper?"), 
                         300,                                                
                         100,                                                
                         lambda : self.__delete_confirm(),
                         None,                                               
                         True, 
                         CONTENT_FONT_SIZE)                                               
     dlg.show_all()
    def on_toolbar_delete_clicked(self, widget):
        def on_ok_clicked():
            for row in self.listview.select_rows:
                db.remove(self.listview.visible_items[row].id)
            db.commit()

            self.listview.delete_items([self.listview.visible_items[row] for row in self.listview.select_rows])
            self.refresh_view()

        dialog = ConfirmDialog(
                _("Delete Item(s)"),
                _("Are you sure you want to delete the selected items?"),
                confirm_callback = on_ok_clicked)
        dialog.show_all()
            def on_delete_all_record():
                def on_ok_clicked():
                    def _remove_all():
                        for item in self.items:
                            db.remove(item.id)
                        db.commit()
                        widget.get_toplevel().refresh_view()                        
                    Thread(target=_remove_all).run()

                dialog = ConfirmDialog(
                    _("Delete Item(s)"),
                    _("Are you sure delete all items?"),
                    confirm_callback = on_ok_clicked)
                dialog.show_all()
 def on_delete_selected_record():
     def on_ok_clicked():
         def _remove_selected():
             for item in select_items:
                 db.remove(item.id)
             db.commit()
             widget.delete_items(select_items)
             widget.get_toplevel()._init_data()
         Thread(target=_remove_selected).run()
     
     dialog = ConfirmDialog(
         _("Delete Item(s)"),
         _("Are you sure you want to delete the selected item(s)?"),
         confirm_callback = on_ok_clicked)
     dialog.show_all()
예제 #7
0
 def __run_check(self, ajob):            
     if ajob.exists_prompt and not ajob.skip_flag:
         ConfirmDialog(_("Prompt"), _("Target file already exitsts, do you want to overwrite it?"),
                       confirm_callback=lambda : ajob.start(),
                       cancel_callback=lambda :self.start_new_job(ajob)
                       ).show_window()
     else:    
         ajob.start()
    def del_online_list(self, item):
        def bplayer_del_list():
            bplayer.del_list(item.list_id)
            if self.current_item == item:
                self.switch_view(self.default_list_item)
            self.category_list.delete_items([item])

        ConfirmDialog("提示",
                      "您确定要删除【%s】歌单吗?" % item.title,
                      confirm_callback=bplayer_del_list).show_all()
    def del_listen_list(self, item):
        def del_list():
            if self.current_item == item:
                self.switch_view(self.default_list_item)
            self.category_list.delete_items([item])
            self.save()

        ConfirmDialog("提示",
                      "您确定要删除【%s】列表吗?" % item.title,
                      confirm_callback=del_list).show_all()
예제 #10
0
 def share_button_clicked(self, button, text_view):
     '''share_button_clicked callback'''
     # file is not exist.
     if not exists(self.upload_image):
         d = ConfirmDialog(_("Error"), "%s." % ( _("Picture does not exist.")))
         d.show_all()
         d.set_transient_for(self.window)
         return False
     has_share_web = False
     for weibo in self.to_share_weibo:
         if self.to_share_weibo[weibo]:
             has_share_web = True
             break
     # have no web selected
     if not has_share_web:
         d = ConfirmDialog(_("Error"), _("Please choose at least one platform to share on"))
         d.show_all()
         d.set_transient_for(self.window)
         return False
     # at first, set widget insensitive
     button.set_sensitive(False)
     text_view.set_editable(False)
     #self.window.left_button_box.set_sensitive(False)
     # set weibo checkbutton sensitive
     for check in self.__weibo_check_button_list:
         check.set_sensitive(False)
     # disconnect weibo ico button clicked function
     for img in self.__weibo_image_button_list:
         try:
             img.disconnect_by_func(self.weibo_login)
         except:
             pass
     button.set_label(_("Uploading"))
     t = threading.Thread(target=self.share_to_weibo_thread, args=(text_view, ))
     t.setDaemon(True)
     t.start()
    def volume_added_callback(self, volume_monitor, volume):
        print "volume added"
        
        def confirm_cb():
            if not volume.get_mount():
                self._ask_confirmed = True
                volume.mount(self.op, self.cancall_opeartion, flags=gio.MOUNT_MOUNT_NONE)
            
        auto = get_auto_mount()
        if auto == "mount" or auto == "mount_and_open":
            if not volume.get_mount():
                volume.mount(self.op, self.cancall_opeartion, flags=gio.MOUNT_MOUNT_NONE)
        elif auto == "ask":
            ConfirmDialog(_("Storage Device"), 
                          _("Mount and open device \"%s\"?") % volume.get_name(),
                          confirm_callback=confirm_cb).show_all()

        self.__load_monitor()
예제 #12
0
 def try_move_trash(self):
     ConfirmDialog(
         _("Prompt"),
         _("Are you sure to delete?"),
         confirm_callback=lambda: self.remove_songs(True)).show_all()
예제 #13
0
 def try_move_trash(self):
     ConfirmDialog(
         _("Prompt"),
         _("Are you sure you want to delete them?"),
         confirm_callback=lambda: self.move_to_trash()).show_all()
 def __init__(self, title, message, confirm_cb, cancel_cb):
     ConfirmDialog.__init__(self, title, message, 
                            confirm_callback=confirm_cb, 
                            cancel_callback=cancel_cb)
예제 #15
0
 def try_move_trash(self, item):
     ConfirmDialog(_("Prompt"),
                   _("Are you sure to delete?"),
                   confirm_callback=lambda: self.real_remove_item(
                       item, True)).show_all()
예제 #16
0
from dtk.ui.application import Application
from dtk.ui.button import ToggleButton
from dtk.ui.theme import ui_theme
from dtk.ui.dialog import ConfirmDialog
import gtk

if __name__ == "__main__":
    application = Application()
    application.set_default_size(600, 450)
    application.add_titlebar(title="ToggleButton example!")

    toggle_button = ToggleButton(
        inactive_normal_dpixbuf=ui_theme.get_pixbuf("switchbutton/off.png"),
        active_normal_dpixbuf=ui_theme.get_pixbuf("switchbutton/on.png"),
        button_label="This is toggle button",
        padding_x=5,
    )
    toggle_button.connect(
        "toggled", lambda w: ConfirmDialog(
            "反馈对话框",
            "按钮开启" if w.get_active() else "按钮关闭",
        ).show_all())

    toggle_button_align = gtk.Alignment()
    toggle_button_align.set(0.5, 0.5, 0, 0)

    toggle_button_align.add(toggle_button)
    application.main_box.add(toggle_button_align)

    application.run()
예제 #17
0
 def share_button_clicked(self, button, text_view):
     '''share_button_clicked callback'''
     # file is not exist.
     if not exists(self.upload_image):
         d = ConfirmDialog(_("Error"),
                           "%s." % (_("Picture does not exist.")))
         d.show_all()
         d.set_transient_for(self.window)
         return False
     has_share_web = False
     for weibo in self.to_share_weibo:
         if self.to_share_weibo[weibo]:
             has_share_web = True
             break
     # have no web selected
     if not has_share_web:
         d = ConfirmDialog(
             _("Error"),
             _("Please choose at least one platform to share on"))
         d.show_all()
         d.set_transient_for(self.window)
         return False
     # at first, set widget insensitive
     button.set_sensitive(False)
     text_view.set_editable(False)
     #self.window.left_button_box.set_sensitive(False)
     # set weibo checkbutton sensitive
     for check in self.__weibo_check_button_list:
         check.set_sensitive(False)
     # disconnect weibo ico button clicked function
     for img in self.__weibo_image_button_list:
         try:
             img.disconnect_by_func(self.weibo_login)
         except:
             pass
     button.set_label(_("Uploading"))
     t = threading.Thread(target=self.share_to_weibo_thread,
                          args=(text_view, ))
     t.setDaemon(True)
     t.start()
from dtk.ui.button import ImageButton
from dtk.ui.dialog import ConfirmDialog
import gtk

if __name__ == "__main__":
    application = Application()
    application.set_default_size(600, 450)
    application.add_titlebar(title="ImageButton example!")

    image_button = ImageButton(
        normal_dpixbuf=app_theme.get_pixbuf("action/play_normal.png"),
        hover_dpixbuf=app_theme.get_pixbuf("action/play_hover.png"),
        press_dpixbuf=app_theme.get_pixbuf("action/play_press.png"),
        insensitive_dpixbuf=None,
        scale_x=False,
        content=None,
    )
    image_button.connect(
        "clicked", lambda w: ConfirmDialog(
            title="反馈对忽框",
            message="点击播放按钮",
        ).show_all())

    image_button_align = gtk.Alignment()
    image_button_align.set(0.5, 0.5, 0, 0)

    image_button_align.add(image_button)
    application.main_box.add(image_button_align)

    application.run()
        session.transfer["filename"] = filename
        session.transfer["filepath"] = local_path
        session.transfer["total"] = total_bytes
        session.transfer["cancelled"] = False

        session.transfer["address"] = info["BluetoothAddress"]
        session.transfer["name"] = name

        def confirm_clicked():
            session.Accept()
            session.Transfer["accept"] = True

        session.transfer["confirm_dialog"] = ConfirmDialog(
            _("Incoming file from %s" % name),
            _("Accept incoming file %s?") % filename,
            confirm_callback=lambda: session.Accept(),
            cancel_callback=lambda: session.Reject())
        session.transfer["confirm_dialog"].confirm_button.set_label(
            _("Accept"))
        session.transfer["confirm_dialog"].cancel_button.set_label(_("Reject"))
        session.transfer["confirm_dialog"].set_keep_above(True)
        session.transfer["confirm_dialog"].show_all()

    def transfer_progress(self, session, bytes_transferred):
        print bytes_transferred / float(session.transfer["total"])
        session.transfer["progress_dialog"].cancel_cb = lambda: session.Cancel(
        )
        session.transfer["progress_dialog"].set_message(
            _("Receiving file from %s") % session.transfer["name"])
        session.transfer["progress_dialog"].set_progress(