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


Python QMessageBox.critical方法代码示例

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


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

示例1: _validate_monkeys

# 需要导入模块: from PyQt5.Qt import QMessageBox [as 别名]
# 或者: from PyQt5.Qt.QMessageBox import critical [as 别名]
 def _validate_monkeys(self):
     first_month = Monkey.unslash(self.ui.firstMonthEdit.text())
     last_month = Monkey.unslash(self.ui.lastMonthEdit.text())
     if not Monkey.is_valid_pair(first_month, last_month):
         msg = 'Invalid time frame: invalid month or first month after last month!'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.firstMonthEdit.setFocus()
         return None
     return TimeInterval(first_month=first_month, last_month=last_month)
开发者ID:joegillon,项目名称:allocat_effort,代码行数:11,代码来源:project_window.py

示例2: _save_clicked

# 需要导入模块: from PyQt5.Qt import QMessageBox [as 别名]
# 或者: from PyQt5.Qt.QMessageBox import critical [as 别名]
 def _save_clicked(self):
     rec = self._valid_emp()
     if rec:
         try:
             rec.save()
         except AllocatException as e:
             QMessageBox.critical(QMessageBox(), 'Input Error', e.msg)
             self.ui.nameEdit.setFocus()
             return
         Dataset.employees = Employee.get_all()
         self._load_list(Dataset.employees.keys(), rec.name)
     self.ui.addBtn.setEnabled(True)
开发者ID:joegillon,项目名称:allocat_effort,代码行数:14,代码来源:employee_window.py

示例3: load

# 需要导入模块: from PyQt5.Qt import QMessageBox [as 别名]
# 或者: from PyQt5.Qt.QMessageBox import critical [as 别名]
 def load(self, f):
     """Load file with name f. If succuss, return True. Otherwise, return False."""
     if not os.path.isfile(f):
         return False
     self.encoding = None
     try:
         data = open(f, encoding="utf_8").read()
         self.encoding = "utf_8"
     except:
         try:
             data = open(f, encoding="latin_1").read()
         except:
             pass
         self.encoding = "latin_1"
     if not self.encoding:
         s = "Failed to open {}. File is not UTF-8 or Latin-1.".format(f)
         QMessageBox.critical(self, "File Error", s)
         return False
     self.setPlainText(data)
     return True
开发者ID:TwoManyHats,项目名称:GuiScannos,代码行数:22,代码来源:textpane.py

示例4: _save_clicked

# 需要导入模块: from PyQt5.Qt import QMessageBox [as 别名]
# 或者: from PyQt5.Qt.QMessageBox import critical [as 别名]
 def _save_clicked(self):
     interval = self._validate_monkeys()
     if not interval:
         return
     rec = Project([
         self.current_rec_id,
         self.ui.nicknameEdit.text(),
         self.ui.nameEdit.text(),
         interval.first_month,
         interval.last_month,
         self.ui.notesEdit.toPlainText(),
         self.ui.billingEdit.toPlainText()
     ])
     try:
         rec.save()
     except AllocatException as e:
         QMessageBox.critical(QMessageBox(), 'Input Error', e.msg)
         self.ui.nameEdit.setFocus()
         return
     Dataset.projects = Project.get_all()
     self._load_list(Dataset.projects.keys(), rec.nickname)
     self.ui.addBtn.setEnabled(True)
开发者ID:joegillon,项目名称:allocat_effort,代码行数:24,代码来源:project_window.py

示例5: _valid_emp

# 需要导入模块: from PyQt5.Qt import QMessageBox [as 别名]
# 或者: from PyQt5.Qt.QMessageBox import critical [as 别名]
 def _valid_emp(self):
     name = self.ui.nameEdit.text()
     if not Employee.is_valid_name(name):
         msg = 'Employee name is invalid'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.nameEdit.setFocus()
         return None
     grade = self.ui.gradeEdit.text()
     if not Employee.is_valid_grade_step(grade):
         msg = 'Employee grade is invalid'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.gradeEdit.setFocus()
         return None
     step = self.ui.stepEdit.text()
     if not Employee.is_valid_grade_step(step):
         msg = 'Employee step is invalid'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.stepEdit.setFocus()
         return None
     fte = self.ui.fteEdit.text()
     if not Employee.is_valid_fte(fte):
         msg = 'Employee FTE is invalid'
         QMessageBox.critical(QMessageBox(), 'Input Error', msg)
         self.ui.fteEdit.setFocus()
         return None
     cp = '015' if self.ui.cp15Button.isChecked() else '016'
     investigator = self.ui.investigatorBox.isChecked()
     notes = self.ui.notesEdit.toPlainText()
     return Employee([
         self.cur_rec_id,
         name,
         int(grade),
         int(step),
         int(fte),
         cp,
         investigator,
         notes
     ])
开发者ID:joegillon,项目名称:allocat_effort,代码行数:40,代码来源:employee_window.py


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