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


Python QMessageBox.critical方法代码示例

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


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

示例1: on_saveButton_clicked

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import critical [as 别名]
 def on_saveButton_clicked(self):
     '''
     Saves the current document. This method is called if the C{save button}
     was clicked.
     '''
     saved, errors, msg = self.tabWidget.currentWidget().save(True)
     if errors:
         QMessageBox.critical(self, "Error", msg)
         self.tabWidget.setTabIcon(self.tabWidget.currentIndex(), self._error_icon)
         self.tabWidget.setTabToolTip(self.tabWidget.currentIndex(), msg)
     elif saved:
         self.tabWidget.setTabIcon(self.tabWidget.currentIndex(), self._empty_icon)
         self.tabWidget.setTabToolTip(self.tabWidget.currentIndex(), '')
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:15,代码来源:editor.py

示例2: focusInEvent

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import critical [as 别名]
 def focusInEvent(self, event):
     # check for file changes
     try:
         if self.filename and self.file_info:
             if self.file_info.lastModified() != QFileInfo(self.filename).lastModified():
                 self.file_info = QFileInfo(self.filename)
                 result = QMessageBox.question(self, "File changed", "File was changed, reload?", QMessageBox.Yes | QMessageBox.No)
                 if result == QMessageBox.Yes:
                     f = QFile(self.filename)
                     if f.open(QIODevice.ReadOnly | QIODevice.Text):
                         self.setText(unicode(f.readAll(), "utf-8"))
                         self.document().setModified(False)
                         self.textChanged.emit()
                     else:
                         QMessageBox.critical(self, "Error", "Cannot open launch file%s" % self.filename)
     except:
         pass
     QTextEdit.focusInEvent(self, event)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:20,代码来源:text_edit.py

示例3: msg_type_changed

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import critical [as 别名]
    def msg_type_changed(self, type_name):
        if not type_name:
            if hasattr(self, 'message_info'):
                self._widget.msg_type_combo_box.setEditText(self.message_info['type_name'])
            return    # initialization with empty string; just ignore
        if self._create_message_instance(type_name) is None:
            QMessageBox.critical(self._widget, 'Change Message Type', 
                    'Unrecognized message type', QMessageBox.Ok)
            if hasattr(self, 'message_info'):
                self._widget.msg_type_combo_box.setEditText(self.message_info['type_name'])
            else:
                self._widget.msg_type_combo_box.setEditText('')
            return
        if hasattr(self, 'message_info'):
            if self.message_info['type_name'] == type_name:
                return    # selected same type as current, just ignore

            answer = QMessageBox.question(self._widget, 'Change Message Type', 
                    'Are you sure you want to change current message type?\n'\
                    'All changes will be discarded!', QMessageBox.Ok, QMessageBox.Cancel)
            if answer != QMessageBox.Ok:
                self._widget.msg_type_combo_box.setEditText(self.message_info['type_name'])
                return
        
            self.clean_up_message()

        self.message_info = {
            'type_name': str(type_name),
            'instance': self._create_message_instance(str(type_name))
        }
        
        # Ask for filling the message with annotation's fields likely to be the same
        answer = QMessageBox.question(self._widget, "Fill Message's Fields", 
                "Do you want to copy matching fields from the annotation?\n" \
                "You can change the suggested values later", QMessageBox.Yes, QMessageBox.No)
        if answer == QMessageBox.Yes:
            self._set_message(self.message_info, self.annotation)
        else:
            self._set_message(self.message_info)
开发者ID:corot,项目名称:world_canvas_tools,代码行数:41,代码来源:msg_editor.py


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