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


Python QuestionDialog.show方法代码示例

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


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

示例1: clean_cruft

# 需要导入模块: from ubuntutweak.gui.dialogs import QuestionDialog [as 别名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import show [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


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