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


Python QMessageBox.critical方法代码示例

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


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

示例1: _start

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def _start(self, flash, erase):
        self._flash_output = bytearray()
        self.outputEdit.setPlainText("")
        python_path = self.pythonPathEdit.text()
        if not python_path:
            QMessageBox.critical(self, "Error", "Python2 path was not set.")
            return
        firmware_file = None
        if flash:
            firmware_file = self.firmwarePathEdit.text()
            if not firmware_file:
                QMessageBox.critical(self, "Error", "Firmware file was not set.")
                return
        self._port = self._connection_scanner.port_list[self.portComboBox.currentIndex()]
        job_thread = Thread(target=self._flash_job, args=[python_path, firmware_file, erase])
        job_thread.setDaemon(True)
        job_thread.start()
        self.eraseButton.setEnabled(False)
        self.flashButton.setEnabled(False)
        self._flashing = True 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:22,代码来源:flash_dialog.py

示例2: runFunc

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def runFunc(self,func,*args,**kwargs):
        if self.serial is None:
            QMessageBox.critical(self,'Error','无设备连接',QMessageBox.Ok)
            return
        self.applyAll()
        def f():
            try:
                self.signalFuncBegin.emit()
                fgoFunc.suspendFlag=False
                fgoFunc.terminateFlag=False
                fgoFunc.fuse.reset()
                func(*args,**kwargs)
            except Exception as e:logger.exception(e)
            finally:
                self.signalFuncEnd.emit()
                playsound.playsound('sound/'+next(soundName))
        threading.Thread(target=f).start() 
开发者ID:hgjazhgj,项目名称:FGO-py,代码行数:19,代码来源:fgoGui.py

示例3: __init__

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def __init__(self, settings: QSettings, parent: QWidget):
        super(VideoService, self).__init__(parent)
        self.settings = settings
        self.parent = parent
        self.logger = logging.getLogger(__name__)
        try:
            self.backends = VideoService.findBackends(self.settings)
            self.proc = VideoService.initProc()
            if hasattr(self.proc, 'errorOccurred'):
                self.proc.errorOccurred.connect(self.cmdError)
            self.lastError = ''
            self.media, self.source = None, None
            self.chapter_metadata = None
            self.keyframes = []
            self.streams = Munch()
            self.mappings = []
        except ToolNotFoundException as e:
            self.logger.exception(e.msg, exc_info=True)
            QMessageBox.critical(getattr(self, 'parent', None), 'Missing libraries', e.msg) 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:21,代码来源:videoservice.py

示例4: load_info

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def load_info(path, qt_parent=None):
    path_base, path_extension = _ospath.splitext(path)
    filename = path_base + ".yaml"
    try:
        with open(filename, "r") as info_file:
            info = list(_yaml.load_all(info_file, Loader=_yaml.FullLoader))
    except FileNotFoundError as e:
        print(
            "\nAn error occured. Could not find metadata file:\n{}".format(
                filename
            )
        )
        if qt_parent is not None:
            _QMessageBox.critical(
                qt_parent,
                "An error occured",
                "Could not find metadata file:\n{}".format(filename),
            )
        raise NoMetadataFileError(e)
    return info 
开发者ID:jungmannlab,项目名称:picasso,代码行数:22,代码来源:io.py

示例5: updateTxtFileList

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def updateTxtFileList(self, videos_list):
        if videos_list:
            #test that it is a valid text file with a list of files inside of it.
            try:
                with open(videos_list, 'r') as fid:
                    first_line = fid.readline().strip()
                    if not os.path.exists(first_line):
                        raise FileNotFoundError
            except:
                QMessageBox.critical(
                        self,
                        "It is not a text file with a valid list of files.",
                        "The selected file does not seem to contain a list of valid files to process.\n"
                        "Plase make sure to select a text file that contains a list of existing files.",
                        QMessageBox.Ok)
                return


        self.videos_list = videos_list
        self.ui.p_videos_list.setText(videos_list) 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:22,代码来源:BatchProcessing.py

示例6: _h_tag_worm

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def _h_tag_worm(self, label_ind):
        if not self.worm_index_type == 'worm_index_manual':
            return

        worm_ind = self.current_worm_index

        if self.frame_data is None:
            return

        if not worm_ind in self.frame_data['worm_index_manual'].values:
            QMessageBox.critical(
                self,
                'The selected worm is not in this frame.',
                'Select a worm in the current frame to label.',
                QMessageBox.Ok)
            return

        good = self.trajectories_data['worm_index_manual'] == worm_ind
        self.trajectories_data.loc[good, 'worm_label'] = label_ind
        self.updateImage() 
开发者ID:ver228,项目名称:tierpsy-tracker,代码行数:22,代码来源:MWTrackerViewer.py

示例7: validate

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def validate(self):
        errors = []

        # Check script code
        code = str(self.scriptCodeEditor.text())
        if ui_common.EMPTY_FIELD_REGEX.match(code):
            errors.append("The script code can't be empty")  # TODO: i18n

        # Check settings
        errors += self.settingsWidget.validate()

        if errors:
            msg = PROBLEM_MSG_SECONDARY.format('\n'.join([str(e) for e in errors]))
            header = PROBLEM_MSG_PRIMARY
            QMessageBox.critical(self.window(), header, msg)

        return not bool(errors)

    # --- Signal handlers 
开发者ID:autokey,项目名称:autokey,代码行数:21,代码来源:scriptpage.py

示例8: validate

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def validate(self):
        errors = []

        # Check phrase content
        phrase = str(self.phraseText.toPlainText())
        if ui_common.EMPTY_FIELD_REGEX.match(phrase):
            errors.append("The phrase content can't be empty")  # TODO: i18n

        # Check settings
        errors += self.settingsWidget.validate()

        if errors:
            msg = PROBLEM_MSG_SECONDARY.format('\n'.join([str(e) for e in errors]))
            QMessageBox.critical(self.window(), PROBLEM_MSG_PRIMARY, msg)

        return not bool(errors) 
开发者ID:autokey,项目名称:autokey,代码行数:18,代码来源:phrasepage.py

示例9: dodaj

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def dodaj(self):
        """ Dodawanie nowego zadania """
        zadanie, ok = QInputDialog.getMultiLineText(self,
                                                    'Zadanie',
                                                    'Co jest do zrobienia?')
        if not ok or not zadanie.strip():
            QMessageBox.critical(self,
                                 'Błąd',
                                 'Zadanie nie może być puste.',
                                 QMessageBox.Ok)
            return

        zadanie = baza.dodajZadanie(self.osoba, zadanie)
        model.tabela.append(zadanie)
        model.layoutChanged.emit()  # wyemituj sygnał: zaszła zmiana!
        if len(model.tabela) == 1:  # jeżeli to pierwsze zadanie
            self.odswiezWidok()     # trzeba przekazać model do widoku 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:19,代码来源:todopw_z6.py

示例10: loguj

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def loguj(self):
        login, haslo, ok = LoginDialog.getLoginHaslo(self)
        if not ok:
            return

        if not login or not haslo:
            QMessageBox.warning(self, 'Błąd',
                                'Pusty login lub hasło!', QMessageBox.Ok)
            return

        self.osoba = baza.loguj(login, haslo)
        if self.osoba is None:
            QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
            return

        zadania = baza.czytajDane(self.osoba)
        model.aktualizuj(zadania)
        model.layoutChanged.emit()
        self.odswiezWidok()
        self.dodajBtn.setEnabled(True)
        self.zapiszBtn.setEnabled(True) 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:23,代码来源:todopw_z6.py

示例11: loguj

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def loguj(self):
        login, haslo, ok = LoginDialog.getLoginHaslo(self)
        if not ok:
            return

        if not login or not haslo:
            QMessageBox.warning(self, 'Błąd',
                                'Pusty login lub hasło!', QMessageBox.Ok)
            return

        self.osoba = baza.loguj(login, haslo)
        if self.osoba is None:
            QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
            return

        zadania = baza.czytajDane(self.osoba)
        model.aktualizuj(zadania)
        model.layoutChanged.emit()
        self.odswiezWidok()
        self.dodajBtn.setEnabled(True) 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:22,代码来源:todopw_z5.py

示例12: loguj

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def loguj(self):
        """ Logowanie użytkownika """
        login, haslo, ok = LoginDialog.getLoginHaslo(self)
        if not ok:
            return

        if not login or not haslo:
            QMessageBox.warning(self, 'Błąd',
                                'Pusty login lub hasło!', QMessageBox.Ok)
            return

        self.osoba = baza.loguj(login, haslo)
        if self.osoba is None:
            QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
            return

        zadania = baza.czytajDane(self.osoba)
        model.aktualizuj(zadania)
        model.layoutChanged.emit()
        self.odswiezWidok() 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:22,代码来源:todopw_z3.py

示例13: loguj

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def loguj(self):
        """ Logowanie użytkownika """
        login, haslo, ok = LoginDialog.getLoginHaslo(self)
        if not ok:
            return

        if not login or not haslo:
            QMessageBox.warning(self, 'Błąd',
                                'Pusty login lub hasło!', QMessageBox.Ok)
            return

        self.osoba = baza.loguj(login, haslo)
        if self.osoba is None:
            QMessageBox.critical(self, 'Błąd', 'Błędne hasło!', QMessageBox.Ok)
            return

        QMessageBox.information(self,
            'Dane logowania', 'Podano: ' + login + ' ' + haslo, QMessageBox.Ok) 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:20,代码来源:todopw_z2.py

示例14: __init__

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def __init__(self, *args, **kwargs):
        super(OpencvWidget, self).__init__(*args, **kwargs)
        self.httpRequestAborted = False
        self.fps = 24
        self.resize(800, 600)

        if not os.path.exists("Data/shape_predictor_68_face_landmarks.dat"):
            self.setText("正在下载数据文件。。。")
            self.outFile = QFile(
                "Data/shape_predictor_68_face_landmarks.dat.bz2")
            if not self.outFile.open(QIODevice.WriteOnly):
                QMessageBox.critical(self, '错误', '无法写入文件')
                return
            self.qnam = QNetworkAccessManager(self)
            self._reply = self.qnam.get(QNetworkRequest(QUrl(URL)))
            self._reply.finished.connect(self.httpFinished)
            self._reply.readyRead.connect(self.httpReadyRead)
            self._reply.downloadProgress.connect(self.updateDataReadProgress)
        else:
            self.startCapture() 
开发者ID:PyQt5,项目名称:PyQt,代码行数:22,代码来源:FacePoints.py

示例15: startCapture

# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import critical [as 别名]
def startCapture(self):
        self.setText("请稍候,正在初始化数据和摄像头。。。")
        try:
            # 检测相关
            self.detector = dlib.get_frontal_face_detector()
            self.predictor = dlib.shape_predictor(
                "Data/shape_predictor_68_face_landmarks.dat")
            cascade_fn = "Data/lbpcascades/lbpcascade_frontalface.xml"
            self.cascade = cv2.CascadeClassifier(cascade_fn)
            if not self.cascade:
                return QMessageBox.critical(self, "错误", cascade_fn + " 无法找到")
            self.cap = cv2.VideoCapture(0)
            if not self.cap or not self.cap.isOpened():
                return QMessageBox.critical(self, "错误", "打开摄像头失败")
            # 开启定时器定时捕获
            self.timer = QTimer(self, timeout=self.onCapture)
            self.timer.start(1000 / self.fps)
        except Exception as e:
            QMessageBox.critical(self, "错误", str(e)) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:21,代码来源:FacePoints.py


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