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


Python QuestionDialog.destroy方法代码示例

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


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

示例1: on_reset_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_reset_button_clicked(self, widget):
        iter = self.backup_combobox.get_active_iter()
        model = self.backup_combobox.get_model()
        directory = self.dir_label.get_text()

        if directory.count('/') == 2:
            message = _('Would you like to reset settings for: <b>%s</b>?') % directory
        else:
            message = _('Would you like to reset all settings under: <b>%s</b>?') % directory

        addon_message = _('<b>NOTES</b>: Whilst resetting, your desktop may be unresponsive for a moment.')

        dialog = QuestionDialog(message=message + '\n\n' + addon_message)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.YES:
            stdout, stderr = do_reset_task(directory)

            if stderr:
                log.error(stderr)
                #TODO raise error or others
                return
            self._show_successful_dialog(title=_('Reset Successful!'),
                 message=_('You may need to restart your desktop for changes to take effect'))
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:27,代码来源:desktoprecovery.py

示例2: on_recover_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_recover_button_clicked(self, widget):
        model, iter = self.list_selection.get_selected()

        if iter:
            list_path = model[iter][0]
            list_name = model[iter][1]

            backup_iter = self.backup_combobox.get_active_iter()

            if backup_iter:
                backup_path = self.backup_model[backup_iter][0]
                backup_name = self.backup_model[backup_iter][1]

                dialog = QuestionDialog(message=_('Would you like to recover the '
                                        'backup "<b>%s</b>" for "<b>%s</b>"?') % (
                                backup_name, list_name))
                response = dialog.run()
                dialog.destroy()

                if response == Gtk.ResponseType.YES:
                    if proxy.restore_source(backup_path, list_path):
                        self.infobar.response(Gtk.ResponseType.CLOSE)
                    else:
                        ErrorDialog(title=_('Recovery Failed!'),
                                   message=_('You may need to check the permission '
                                             'of source list.')).launch()
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:28,代码来源:sourceeditor.py

示例3: on_recover_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_recover_button_clicked(self, widget):
        iter = self.backup_combobox.get_active_iter()
        model = self.backup_combobox.get_model()
        directory = self.dir_label.get_text()
        path = model.get_value(iter, 1)

        if directory.count('/') == 2:
            message = _('Would you like to recover the backup: <b>%s/%s</b>?') % (
                        directory, os.path.basename(path)[:-4])
        else:
            message = _('Would you like to recover the backup of all'
                        '<b>%s</b> settings named <b>%s</b>?') % (
                        directory, os.path.basename(path)[:-4])

        addon_message = _('<b>NOTES</b>: While recovering, your desktop may be unresponsive for a moment.')

        dialog = QuestionDialog(message=message + '\n\n' + addon_message)
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.YES:
            if directory.count('/') == 1:
                for line in open(path):
                    stdout, stderr = do_recover_task(line.strip())
            else:
                stdout, stderr = do_recover_task(path)

            if stderr:
                log.error(stderr)
                #TODO raise error or others
                return
            self._show_successful_dialog(title=_('Recovery Successful!'),
                 message=_('You may need to restart your desktop for changes to take effect'))
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:35,代码来源:desktoprecovery.py

示例4: on_rebuild_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
 def on_rebuild_clicked(self, widget):
     dialog = QuestionDialog(message=_('This will delete all disabled scripts.\nDo you wish to continue?'))
     if dialog.run() == Gtk.ResponseType.YES:
         self.default.remove()
         self.default.create()
         self.disable_scripts.update_model()
     dialog.destroy()
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:9,代码来源:scripts.py

示例5: on_redo_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_redo_button_clicked(self, widget):
        dialog = QuestionDialog(message=_('The current content will be lost after reloading!\nDo you wish to continue?'))
        if dialog.run() == Gtk.ResponseType.YES:
            self.textview.update_content()
            self.save_button.set_sensitive(False)
            self.redo_button.set_sensitive(False)

        dialog.destroy()
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:10,代码来源:sourceeditor.py

示例6: on_icon_reset_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_icon_reset_button_clicked(self, widget):
        dialog = QuestionDialog(title=_("Would you like to reset the launcher items?"),
                                message=_('If you continue, launcher will be set to default and all your current items will be lost.'))
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.YES:
            self.launcher_setting.set_value(self.launcher_setting.get_schema_value())
开发者ID:0x7E,项目名称:ubuntu-tweak,代码行数:10,代码来源:quicklists.py

示例7: on_backup_delete_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_backup_delete_button_clicked(self, widget):
        iter = self.backup_combobox.get_active_iter()
        path = self.backup_model[iter][0]

        dialog = QuestionDialog(message=_("Would you like to delete the backup:" "<b>%s</b>?") % os.path.basename(path))
        response = dialog.run()
        dialog.destroy()

        if response == Gtk.ResponseType.YES:
            proxy.delete_source(path)
            self.update_backup_model()
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:13,代码来源:sourceeditor.py

示例8: on_have_update

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_have_update(self, *args):
        if UPDATE_SETTING.get_value():
            dialog = QuestionDialog(_('New source data available, would you like to update?'))
            response = dialog.run()
            dialog.destroy()

            if response == Gtk.ResponseType.YES:
                dialog = FetchingDialog(get_source_data_url(),
                                        self.get_toplevel())
                dialog.connect('destroy', self.on_source_data_downloaded)
                dialog.run()
                dialog.destroy()
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:14,代码来源:sourcecenter.py

示例9: clean_cruft

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def clean_cruft(self, parent, cruft_list):
        set_busy(parent)

        # name_list is to display the name of PPA
        # url_list is to identify the ppa
        name_list = []
        url_list = []
        for cruft in cruft_list:
            name_list.append(ppa.get_short_name(cruft.get_uri()))
            url_list.append(cruft.get_uri())

        package_view = DowngradeView(self)
        package_view.update_model(url_list)
        sw = Gtk.ScrolledWindow(shadow_type=Gtk.ShadowType.IN)
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        select_pkgs = package_view.get_downgrade_packages()
        sw.add(package_view)

        #TODO the logic is a little ugly, need to improve the BaseMessageDialog
        if not select_pkgs:
            message = _("It's safe to purge the PPA, no packages need to be downgraded.")
            sw.hide()
        else:
            message = _("To safely purge the PPA, the following packages must be downgraded.")
            sw.show_all()
            sw.set_size_request(500, 100)

        dialog = QuestionDialog(message=message,
                                title=_("You're going to purge: %s") % ', '.join(name_list))
        dialog.set_resizable(True)
        dialog.get_content_area().pack_start(sw, True, True, 0)
        dialog.show()

        response = dialog.run()
        dialog.destroy()
        # Workflow
        # 1. Downgrade all the PPA packages to offical packages
        #TODO Maybe not official? Because anther ppa which is enabled may have newer packages then offical
        # 2. If succeed, disable PPA, or keep it

        if response == Gtk.ResponseType.YES:
            log.debug("The select pkgs is: %s", str(select_pkgs))
            dialog = CleanPpaDialog(parent, select_pkgs, url_list)
            dialog.run()
            dialog.destroy()
            if dialog.error:
                log.error("Error: %s" % dialog.error)
                ErrorDialog(dialog.error).launch()
        # TODO refresh source?

        self.emit('cleaned', True)
        unset_busy(parent)
开发者ID:juzerdana,项目名称:ubuntu-tweak,代码行数:54,代码来源:ppapurge_plugin.py

示例10: on_purge_ppa_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_purge_ppa_button_clicked(self, widget):
        # name_list is to display the name of PPA
        # url_list is to identify the ppa
        set_busy(self)
        name_list = []
        url_list = []
        log.debug("self.sourceview.to_purge: %s" % self.sourceview.to_purge)
        for url in self.sourceview.to_purge:
            name_list.append(ppa.get_short_name(url))
            url_list.append(url)

        log.debug("PPAs to purge: url_list: %s" % url_list)

        package_view = DowngradeView(self)
        package_view.update_downgrade_model(url_list)
        sw = Gtk.ScrolledWindow(shadow_type=Gtk.ShadowType.IN)
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        select_pkgs = package_view.get_downgrade_packages()
        sw.add(package_view)

        #TODO the logic is a little ugly, need to improve the BaseMessageDialog
        if not select_pkgs:
            message = _("It's safe to purge the PPA, no packages need to be downgraded.")
            sw.hide()
        else:
            message = _("To safely purge the PPA, the following packages must be downgraded.")
            sw.show_all()
            sw.set_size_request(500, 100)

        dialog = QuestionDialog(title=_("You're going to purge \"%s\":") % ', '.join(name_list),
                                message=message)
        dialog.set_resizable(True)
        dialog.get_content_area().pack_start(sw, True, True, 0)
        dialog.show_all()

        response = dialog.run()
        dialog.destroy()
        # Workflow
        # 1. Downgrade all the PPA packages to offical packages
        #TODO Maybe not official? Because anther ppa which is enabled may have newer packages then offical
        # 2. If succeed, disable PPA, or keep it

        if response == Gtk.ResponseType.YES:
            log.debug("The select pkgs is: %s", str(select_pkgs))
            worker = AptWorker(widget.get_toplevel(),
                               finish_handler=self.on_package_work_finished,
                               data={'parent': self,
                                     'url_list': url_list})
            worker.downgrade_packages(select_pkgs)
        else:
            unset_busy(self)
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:53,代码来源:sourcecenter.py

示例11: on_delete_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_delete_button_clicked(self, widget):
        if self.textview.get_path() ==  SOURCES_LIST:
            ErrorDialog(_('You can\'t delete sources.list!')).launch()
        else:
            dialog = QuestionDialog(message=_('The "%s" will be deleted!\nDo you wish to continue?') % self.textview.get_path())
            response = dialog.run()
            dialog.destroy()
            if response == Gtk.ResponseType.YES:
                model, iter = self.list_selection.get_selected()

                if iter:
                    list_path = model[iter][0]
                    proxy.delete_source(list_path)
                    self.update_source_model()
                    self.update_backup_model()
开发者ID:Thongor,项目名称:ubuntu-tweak,代码行数:17,代码来源:sourceeditor.py

示例12: upgrade_sources

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
 def upgrade_sources(self):
     dialog = QuestionDialog(_('After a successful distribution upgrade, '
         'any third-party sources you use will be disabled by default.\n'
         'Would you like to re-enable any sources disabled by Update Manager?'),
         title=_('Upgrade Third Party Sources'))
     response = dialog.run()
     dialog.destroy()
     if response == Gtk.ResponseType.YES:
         proxy.upgrade_sources(self.__get_disable_string(), UPGRADE_DICT)
         if not self.check_source_upgradable():
             InfoDialog(_('Upgrade Successful!')).launch()
         else:
             ErrorDialog(_('Upgrade Failed!')).launch()
         self.emit('call', 'ubuntutweak.modules.sourceeditor', 'update_source_combo', {})
         self.update_thirdparty()
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:17,代码来源:sourcecenter.py

示例13: on_redo_action_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_redo_action_button_clicked(self, widget):
        model, iter = self.icon_view.get_selection().get_selected()
        if iter:
            name = model[iter][self.DESKTOP_NAME]

            dialog = QuestionDialog(title=_('Would you like to reset "%s"?') % name,
                                    message=_('If you continue, the actions of %s will be set to default.') % name)
            response = dialog.run()
            dialog.destroy()

            if response == Gtk.ResponseType.YES:
                entry = model[iter][self.DESKTOP_ENTRY]
#                log.debug("Before reset the actions is: %s" % entry.get_actions())
                entry.reset()
                log.debug("After reset the actions is: %s" % entry.get_actions())
                self.on_icon_view_selection_changed(self.icon_view.get_selection())
开发者ID:0x7E,项目名称:ubuntu-tweak,代码行数:18,代码来源:quicklists.py

示例14: on_delete_button_clicked

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_delete_button_clicked(self, widget):
        def try_remove_record_in_root_backup(directory, path):
            rootpath = build_backup_prefix('/'.join(directory.split('/')[:2])) + \
                                           os.path.basename(path)
            if os.path.exists(rootpath):
                lines = open(rootpath).read().split()
                lines.remove(path)

                if len(lines) == 0:
                    os.remove(rootpath)
                else:
                    new = open(rootpath, 'w')
                    new.write('\n'.join(lines))
                    new.close()

        def try_remove_all_subback(path):
            for line in open(path):
                os.remove(line.strip())

        iter = self.backup_combobox.get_active_iter()
        model = self.backup_combobox.get_model()

        directory = self.dir_label.get_text()

        path = model.get_value(iter, 1)
        if directory.count('/') == 2:
            dialog = QuestionDialog(message=_('Would you like to delete the backup '
                                      '"<b>%s/%s</b>"?') %
                                      (directory, os.path.basename(path)[:-4]))
        else:
            dialog = QuestionDialog(message=_('Would you like to delete the backup of'
                                      ' all "<b>%(setting_name)s</b>" settings named "<b>%(backup_name)s</b>"?') % \
                                      {'setting_name': directory,
                                       'backup_name': os.path.basename(path)[:-4]})
        response = dialog.run()
        dialog.destroy()
        if response == Gtk.ResponseType.YES:
            if directory.count('/') == 2:
                try_remove_record_in_root_backup(directory, path)
            else:
                try_remove_all_subback(path)

            os.remove(path)
            self.update_backup_model(directory)
开发者ID:0x0001,项目名称:ubuntu-tweak,代码行数:46,代码来源:desktoprecovery.py

示例15: on_restore_directory

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import destroy [as 别名]
    def on_restore_directory(self, widget):
        model, iter = self.get_selection().get_selected()
        userdir = model.get_value(iter, self.COLUMN_DIR)

        dialog = QuestionDialog(message=_('Ubuntu Tweak will restore the selected '
            'directory to it\'s default location.\n'
            'However, you must move your files back into place manually.\n'
            'Do you wish to continue?'))

        if dialog.run() == Gtk.ResponseType.YES:
            newdir = os.path.join(os.getenv("HOME"), self.uf.get_restorename(userdir))
            self.uf.set_userdir(userdir, newdir)
            model.set_value(iter, self.COLUMN_PATH, newdir)

            if not os.path.exists(newdir):
                os.mkdir(newdir)
            elif os.path.isfile(newdir):
                os.remove(newdir)
                os.mkdir(newdir)

        dialog.destroy()
开发者ID:0tli4nitsa,项目名称:ubuntu-tweak,代码行数:23,代码来源:userdir.py


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