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


Python QMessageBox.critical方法代码示例

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


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

示例1: process_packages

# 需要导入模块: from winpython.qt.QtGui import QMessageBox [as 别名]
# 或者: from winpython.qt.QtGui.QMessageBox import critical [as 别名]
 def process_packages(self, action):
     """Install/uninstall packages"""
     if action == "install":
         text, table = "Installing", self.table
         if not self.get_packages_to_be_installed():
             return
     elif action == "uninstall":
         text, table = "Uninstalling", self.untable
     else:
         raise AssertionError
     packages = table.get_selected_packages()
     if not packages:
         return
     func = getattr(self.distribution, action)
     thread = Thread(self)
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(False)
     try:
         status = self.statusBar()
     except AttributeError:
         status = self.parent().statusBar()
     progress = QProgressDialog(self, Qt.FramelessWindowHint)
     progress.setMaximum(len(packages))  #  old vicious bug:len(packages)-1
     for index, package in enumerate(packages):
         progress.setValue(index)
         progress.setLabelText("%s %s %s..." % (text, package.name, package.version))
         QApplication.processEvents()
         if progress.wasCanceled():
             break
         if package in table.model.actions:
             try:
                 thread.callback = lambda: func(package)
                 thread.start()
                 while thread.isRunning():
                     QApplication.processEvents()
                     if progress.wasCanceled():
                         status.setEnabled(True)
                         status.showMessage("Cancelling operation...")
                 table.remove_package(package)
                 error = thread.error
             except Exception as error:
                 error = to_text_string(error)
             if error is not None:
                 pstr = package.name + " " + package.version
                 QMessageBox.critical(
                     self,
                     "Error",
                     "<b>Unable to %s <i>%s</i></b>" "<br><br>Error message:<br>%s" % (action, pstr, error),
                 )
     progress.setValue(progress.maximum())
     status.clearMessage()
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(True)
     thread = None
     for table in (self.table, self.untable):
         table.refresh_distribution(self.distribution)
开发者ID:psycow,项目名称:winpython,代码行数:60,代码来源:controlpanel.py


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