Python PyQt5.QtWidgets.QMessageBox.critical() Examples
The following are 30
code examples of PyQt5.QtWidgets.QMessageBox.critical().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets.QMessageBox
, or try the search function
.
Example #1
Source File: FacePoints.py From PyQt with GNU General Public License v3.0 | 7 votes |
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()
Example #2
Source File: __main__.py From VirtScreen with GNU General Public License v3.0 | 6 votes |
def main_gui(args: argparse.Namespace): QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(sys.argv) loop = QEventLoop(app) asyncio.set_event_loop(loop) # Check environment first from PyQt5.QtWidgets import QMessageBox, QSystemTrayIcon def dialog(message: str) -> None: QMessageBox.critical(None, "VirtScreen", message) if not QSystemTrayIcon.isSystemTrayAvailable(): dialog("Cannot detect system tray on this system.") sys.exit(1) check_env(args, dialog) app.setApplicationName("VirtScreen") app.setWindowIcon(QIcon(ICON_PATH)) os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material" # Register the Python type. Its URI is 'People', it's v1.0 and the type # will be called 'Person' in QML. qmlRegisterType(DisplayProperty, 'VirtScreen.DisplayProperty', 1, 0, 'DisplayProperty') qmlRegisterType(Backend, 'VirtScreen.Backend', 1, 0, 'Backend') qmlRegisterType(Cursor, 'VirtScreen.Cursor', 1, 0, 'Cursor') qmlRegisterType(Network, 'VirtScreen.Network', 1, 0, 'Network') # Create a component factory and load the QML script. engine = QQmlApplicationEngine() engine.load(QUrl(MAIN_QML_PATH)) if not engine.rootObjects(): dialog("Failed to load QML") sys.exit(1) sys.exit(app.exec_()) with loop: loop.run_forever()
Example #3
Source File: BatchProcessing.py From tierpsy-tracker with MIT License | 6 votes |
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)
Example #4
Source File: ProtocolTreeModel.py From urh with GNU General Public License v3.0 | 6 votes |
def delete_group(self, group_item: ProtocolTreeItem): if self.rootItem.childCount() == 1: QMessageBox.critical(self.controller, self.tr("Group not deletable"), self.tr( "You can't delete the last group. Think about the children, they would be homeless!")) return group_id = self.rootItem.index_of(group_item) if group_id == 0: new_group_index = 1 else: new_group_index = group_id - 1 new_group = self.rootItem.children[new_group_index] for i in reversed(range(group_item.childCount())): new_group.appendChild(group_item.children[i]) self.removeRow(group_id, QModelIndex()) self.group_deleted.emit(group_id, new_group_index)
Example #5
Source File: videoservice.py From vidcutter with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: fgoGui.py From FGO-py with MIT License | 6 votes |
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()
Example #7
Source File: main.py From Yugioh-bot with MIT License | 6 votes |
def setup_runtime(uconfig): from bot.duel_links_runtime import DuelLinkRunTime from bot import logger from bot.providers import get_provider os.makedirs(uconfig.get('locations', 'log'), exist_ok=True) setup_logging() scheduler = BackgroundScheduler() dlRuntime = DuelLinkRunTime(uconfig, scheduler) dlRuntime.stop = False # Need to Ensure that it runs scheduler.start() try: dlRuntime.set_provider(get_provider(uconfig.get('bot', 'provider'))(scheduler, uconfig, dlRuntime)) except Exception as e: logger.critical("Could not get a provider, take a look at your config file") logger.critical(e) logger.debug(traceback.format_exc()) sys.exit(1) try: dlRuntime.get_provider().sleep_factor = uconfig.getint('bot', 'sleep_factor') except Exception as e: logger.critical("Could not set sleep factor, take a look at your config file") logger.critical(e) sys.exit(1) return dlRuntime
Example #8
Source File: io.py From picasso with MIT License | 6 votes |
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
Example #9
Source File: flash_dialog.py From uPyLoader with MIT License | 6 votes |
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
Example #10
Source File: SignalFrame.py From urh with GNU General Public License v3.0 | 6 votes |
def export_demodulated(self): try: initial_name = self.signal.name + "-demodulated.complex" except Exception as e: logger.exception(e) initial_name = "demodulated.complex" filename = FileOperator.get_save_file_name(initial_name) if filename: try: self.setCursor(Qt.WaitCursor) data = self.signal.qad if filename.endswith(".wav"): data = self.signal.qad.astype(np.float32) data /= np.max(np.abs(data)) FileOperator.save_data(IQArray(data, skip_conversion=True), filename, self.signal.sample_rate, num_channels=1) self.unsetCursor() except Exception as e: QMessageBox.critical(self, self.tr("Error exporting demodulated data"), e.args[0])
Example #11
Source File: MainController.py From urh with GNU General Public License v3.0 | 6 votes |
def add_signalfile(self, filename: str, group_id=0, enforce_sample_rate=None): if not os.path.exists(filename): QMessageBox.critical(self, self.tr("File not Found"), self.tr("The file {0} could not be found. Was it moved or renamed?").format( filename)) return sig_name = os.path.splitext(os.path.basename(filename))[0] # Use default sample rate for signal # Sample rate will be overridden in case of a project later if enforce_sample_rate is not None: sample_rate = enforce_sample_rate else: sample_rate = self.project_manager.device_conf["sample_rate"] signal = Signal(filename, sig_name, sample_rate=sample_rate) self.file_proxy_model.open_files.add(filename) self.add_signal(signal, group_id)
Example #12
Source File: Errors.py From urh with GNU General Public License v3.0 | 6 votes |
def hackrf_not_found(): w = QWidget() if sys.platform == "win32": msg = "Could not connect to HackRF. Try these solutions:" \ "<br/><br/> 1. Ensure HackRF is plugged in." \ "<br/> 2. <b>Install HackRF USB driver</b> with <a href='http://zadig.akeo.ie/'>Zadig</a>." else: msg = "Could not connect to HackRF. Try these solutions:" \ "<br/><br/> 1. Ensure HackRF is plugged in." \ "<br/> 2. Run the command <b>hackrf_info</b> in terminal as root." \ "<br/> 3. If 2. works for you, follow the instructions " \ "<a href='https://github.com/mossmann/hackrf/wiki/FAQ'>here</a>." QMessageBox.critical(w, w.tr("HackRF not found"), w.tr(msg))
Example #13
Source File: seistomopy_gui.py From SeisTomoPy_V3 with GNU General Public License v3.0 | 6 votes |
def on_saveoutput_corr_released(self): selected_directory8 = QFileDialog.getExistingDirectory() if not selected_directory8: return if os.path.isdir(str(selected_directory8) + '/output_corr'): QMessageBox.critical(None, "Message", "This directory already exists in this directory") else: shutil.copytree(DIR2 + '/output_files_corr', str(selected_directory8) + '/output_corr') path = DIR2 + '/output_files_corr' dirs = os.listdir(path) os.chdir(DIR2 + '/output_files_corr') for i in range(len(dirs)): os.remove(dirs[i]) os.chdir(DIR) ################################################################ # UPDATES ################################################################
Example #14
Source File: MWTrackerViewer.py From tierpsy-tracker with MIT License | 6 votes |
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()
Example #15
Source File: seistomopy_gui.py From SeisTomoPy_V3 with GNU General Public License v3.0 | 6 votes |
def on_saveoutput_spec_released(self): dep_spec = int(self.ui.depth_spec.value()) selected_directory7 = QFileDialog.getExistingDirectory() if not selected_directory7: return if os.path.isdir(str(selected_directory7) + '/output_spectre_' + \ str(dep_spec) + 'km'): QMessageBox.critical(None, "Message", "This directory already exists") else: shutil.copytree(DIR2 + '/output_files_spectre', str(selected_directory7) + '/output_spectre_' + \ str(dep_spec) + 'km') path = DIR2 + "/output_files_spectre" dirs = os.listdir(path) os.chdir(DIR2 + '/output_files_spectre') for i in range(len(dirs)): os.remove(dirs[i]) os.chdir(DIR)
Example #16
Source File: v2config.py From v2net with GNU General Public License v3.0 | 6 votes |
def __init__(self, file): class MyConfig(configparser.ConfigParser): def __init__(self): configparser.ConfigParser.__init__(self, defaults=None) def optionxform(self, optionstr): return optionstr self.config = MyConfig() self.file = file try: self.config.read(file, encoding='UTF-8') except Exception as e: QMessageBox.critical(QWidget(), 'Critical', repr(e)) subprocess.run(["open", file]) sys.exit(1)
Example #17
Source File: scriptpage.py From autokey with GNU General Public License v3.0 | 6 votes |
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
Example #18
Source File: phrasepage.py From autokey with GNU General Public License v3.0 | 6 votes |
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)
Example #19
Source File: todopw_z6.py From python101 with MIT License | 6 votes |
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
Example #20
Source File: todopw_z6.py From python101 with MIT License | 6 votes |
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)
Example #21
Source File: todopw_z4.py From python101 with MIT License | 6 votes |
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
Example #22
Source File: todopw_z5.py From python101 with MIT License | 6 votes |
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
Example #23
Source File: todopw_z5.py From python101 with MIT License | 6 votes |
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)
Example #24
Source File: todopw_z3.py From python101 with MIT License | 6 votes |
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()
Example #25
Source File: todopw_z2.py From python101 with MIT License | 6 votes |
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)
Example #26
Source File: Errors.py From urh with GNU General Public License v3.0 | 5 votes |
def gnuradio_not_installed(): w = QWidget() QMessageBox.critical(w, w.tr("GNU Radio not found"), w.tr("You need to install GNU Radio for this " "feature."))
Example #27
Source File: Errors.py From urh with GNU General Public License v3.0 | 5 votes |
def empty_selection(): w = QWidget() QMessageBox.critical(w, w.tr("No selection"), w.tr("Your selection is empty!"))
Example #28
Source File: seistomopy_gui.py From SeisTomoPy_V3 with GNU General Public License v3.0 | 5 votes |
def on_saveoutput_cross_released(self): lati = int(self.ui.midpt_latitude.value()) longi = int(self.ui.midpt_longitude.value()) azi_cross = int(self.ui.azimuth.value()) selected_directory2 = QFileDialog.getExistingDirectory() if not selected_directory2: return if os.path.isdir(str(selected_directory2) + '/output_crosssection_' +\ str(lati) + '_' + str(longi) + '_' + str(azi_cross)): QMessageBox.critical(None, "Message", "This directory already exists in this directory") else: os.mkdir(str(selected_directory2) + '/output_crosssection_' + str(lati) + '_' + str(longi) + '_' + str(azi_cross)) files_to_copy1 = set(glob.glob(DIR2 + 'output_files_cross/output_cross_*')) for _files in files_to_copy1: shutil.copyfile( _files, \ str(selected_directory2) + '/output_crosssection_' + str(lati) + '_' + str(longi) + '_' + str(azi_cross)+ '/' + os.path.splitext(os.path.basename(_files))[0]+'.out') files_to_copy2 = set(glob.glob(DIR2 + 'output_files_cross/*.sph')) for _files in files_to_copy2: shutil.copyfile( _files, \ str(selected_directory2) + '/output_crosssection_' + str(lati) + '_' + str(longi) + '_' + str(azi_cross) + '/' + os.path.splitext(os.path.basename(_files))[0] +'.sph') path = DIR2 + "/output_files_cross" dirs = os.listdir(path) os.chdir(DIR2 + '/output_files_cross') for i in range(len(dirs)): os.remove(dirs[i]) os.chdir(DIR) ################################################################ # TOOLS FOR MAP ################################################################
Example #29
Source File: Errors.py From urh with GNU General Public License v3.0 | 5 votes |
def generic_error(title: str, msg: str, detailed_msg: str = None): w = QWidget() if detailed_msg: msg = "Error: <b>" + msg.replace("\n", "<br>") + "</b>" + "<br><br>----------<br><br>" + detailed_msg.replace( "\n", "<br>") QMessageBox.critical(w, title, msg)
Example #30
Source File: Errors.py From urh with GNU General Public License v3.0 | 5 votes |
def rtlsdr_sdr_driver(): if sys.platform == "win32": w = QWidget() QMessageBox.critical(w, w.tr("Could not access RTL-SDR device"), w.tr("You may need to reinstall the driver with Zadig for 'Composite' device.<br>" "See <a href='https://github.com/jopohl/urh/issues/389'>here</a> " "for more information."))