本文整理匯總了Python中ubuntutweak.gui.dialogs.QuestionDialog.show_all方法的典型用法代碼示例。如果您正苦於以下問題:Python QuestionDialog.show_all方法的具體用法?Python QuestionDialog.show_all怎麽用?Python QuestionDialog.show_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ubuntutweak.gui.dialogs.QuestionDialog
的用法示例。
在下文中一共展示了QuestionDialog.show_all方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: on_purge_ppa_button_clicked
# 需要導入模塊: from ubuntutweak.gui.dialogs import QuestionDialog [as 別名]
# 或者: from ubuntutweak.gui.dialogs.QuestionDialog import show_all [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)