Python PyQt5.QtWidgets.QMessageBox.No() Examples
The following are 30
code examples of PyQt5.QtWidgets.QMessageBox.No().
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: widgets.py From Turing with MIT License | 9 votes |
def msg_box(text, title=None, icon=None, parent=None, buttons=QMessageBox.Yes | QMessageBox.No, default=QMessageBox.No, type=QMessageBox.Question): res = get_themed_box(parent) if title is not None: res.setWindowTitle(title) if icon is not None: res.setWindowIcon(icon) res.setIcon(type) res.setStandardButtons(buttons) res.setDefaultButton(default) res.setText(text) res.adjustSize() if parent: center_widget(res, parent) return res
Example #2
Source File: DMachineSetup.py From pyleecan with Apache License 2.0 | 7 votes |
def closeEvent(self, event): """Display a message before leaving Parameters ---------- self : DMachineSetup A DMachineSetup object event : The closing event """ if self.is_save_needed: quit_msg = self.tr( "Unsaved changes will be lost.\nDo you want to save the machine?" ) reply = QMessageBox.question( self, self.tr("Please save before closing"), quit_msg, QMessageBox.Yes, QMessageBox.No, ) if reply == QMessageBox.Yes: self.s_save()
Example #3
Source File: SignalFrame.py From urh with GNU General Public License v3.0 | 7 votes |
def my_close(self): not_show = settings.read('not_show_close_dialog', False, type=bool) if not not_show: cb = QCheckBox("Do not show this again.") msgbox = QMessageBox(QMessageBox.Question, "Confirm close", "Are you sure you want to close?") msgbox.addButton(QMessageBox.Yes) msgbox.addButton(QMessageBox.No) msgbox.setDefaultButton(QMessageBox.No) msgbox.setCheckBox(cb) reply = msgbox.exec() not_show_again = bool(cb.isChecked()) settings.write("not_show_close_dialog", not_show_again) self.not_show_again_changed.emit() if reply != QMessageBox.Yes: return self.closed.emit(self)
Example #4
Source File: tabMain.py From PIVX-SPMT with MIT License | 6 votes |
def onRemoveMN(self, data=None): if not data: target = self.ui.sender() masternode_alias = target.alias reply = myPopUp(self.caller, "warn", 'Confirm REMOVE', "Are you sure you want to remove\nmasternoode:'%s'" % masternode_alias, QMessageBox.No) if reply == QMessageBox.No: return for masternode in self.caller.masternode_list: if masternode['name'] == masternode_alias: # remove from cache, QListWidget and DB removeMNfromList(self.caller, masternode) break
Example #5
Source File: uiMainWindow.py From TradeSim with Apache License 2.0 | 6 votes |
def closeEvent(self, event): """关闭事件""" reply = QMessageBox.question(self, u'退出', u'确认退出?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: for widget in list(self.widgetDict.values()): widget.close() self.mainEngine.exit() event.accept() else: event.ignore() # ----------------------------------------------------------------------
Example #6
Source File: centralwidget.py From autokey with GNU General Public License v3.0 | 6 votes |
def promptToSave(self): if cm.ConfigManager.SETTINGS[cm.PROMPT_TO_SAVE]: # TODO: i18n result = QMessageBox.question( self.window(), "Save changes?", "There are unsaved changes. Would you like to save them?", QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel ) if result == QMessageBox.Yes: return self.on_save() elif result == QMessageBox.Cancel: return True else: return False else: # don't prompt, just save return self.on_save() # ---- Signal handlers
Example #7
Source File: pyeditor.py From Python_editor with The Unlicense | 6 votes |
def closeEvent(self, event): reply = QMessageBox.question(self, 'Exit', "Are you sure to quit?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: print dn os.chdir(dn) print dn os.chdir('../..') print dn print ''' ################################################### # Author Storm Shadow # # # # Follow me on twitter # # @zadow28 # ################################################### # Ida pro python Editor # ################################################### ''' event.accept() else: event.ignore()
Example #8
Source File: test_app.py From CQ-editor with Apache License 2.0 | 6 votes |
def test_check_for_updates(main,mocker): qtbot,win = main # patch requests import requests mocker.patch.object(requests.models.Response,'json', return_value=[{'tag_name' : '0.0.2','draft' : False}]) # stub QMessageBox about about_stub = mocker.stub() mocker.patch.object(QMessageBox, 'about', about_stub) import cadquery cadquery.__version__ = '0.0.1' win.check_for_cq_updates() assert(about_stub.call_args[0][1] == 'Updates available') cadquery.__version__ = '0.0.3' win.check_for_cq_updates() assert(about_stub.call_args[0][1] == 'No updates available')
Example #9
Source File: main_window.py From vorta with GNU General Public License v3.0 | 6 votes |
def closeEvent(self, event): # Save window state in SettingsModel SettingsModel.update({SettingsModel.str_value: str(self.frameGeometry().width())})\ .where(SettingsModel.key == 'previous_window_width')\ .execute() SettingsModel.update({SettingsModel.str_value: str(self.frameGeometry().height())})\ .where(SettingsModel.key == 'previous_window_height')\ .execute() if not is_system_tray_available(): run_in_background = QMessageBox.question(self, trans_late("MainWindow QMessagebox", "Quit"), trans_late("MainWindow QMessagebox", "Should Vorta continue to run in the background?"), QMessageBox.Yes | QMessageBox.No) if run_in_background == QMessageBox.No: self.app.quit() event.accept()
Example #10
Source File: utils.py From CQ-editor with Apache License 2.0 | 6 votes |
def check_gtihub_for_updates(parent, mod, github_org='cadquery', github_proj='cadquery'): url = f'https://api.github.com/repos/{github_org}/{github_proj}/releases' resp = requests.get(url).json() newer = [el['tag_name'] for el in resp if not el['draft'] and \ parse_version(el['tag_name']) > parse_version(mod.__version__)] if newer: title='Updates available' text=f'There are newer versions of {github_proj} ' \ f'available on github:\n' + '\n'.join(newer) else: title='No updates available' text=f'You are already using the latest version of {github_proj}' QtWidgets.QMessageBox.about(parent,title,text)
Example #11
Source File: CloudOutputDeviceManager.py From Cura with GNU Lesser General Public License v3.0 | 6 votes |
def _onRemovedPrintersMessageActionTriggered(self, removed_printers_message: Message, action: str) -> None: if action == "keep_printer_configurations_action": removed_printers_message.hide() elif action == "remove_printers_action": machine_manager = CuraApplication.getInstance().getMachineManager() remove_printers_ids = {self._um_cloud_printers[i].getId() for i in self.reported_device_ids} all_ids = {m.getId() for m in CuraApplication.getInstance().getContainerRegistry().findContainerStacks(type = "machine")} question_title = self.I18N_CATALOG.i18nc("@title:window", "Remove printers?") question_content = self.I18N_CATALOG.i18nc("@label", "You are about to remove {} printer(s) from Cura. This action cannot be undone. \nAre you sure you want to continue?".format(len(remove_printers_ids))) if remove_printers_ids == all_ids: question_content = self.I18N_CATALOG.i18nc("@label", "You are about to remove all printers from Cura. This action cannot be undone. \nAre you sure you want to continue?") result = QMessageBox.question(None, question_title, question_content) if result == QMessageBox.No: return for machine_cloud_id in self.reported_device_ids: machine_manager.setActiveMachine(self._um_cloud_printers[machine_cloud_id].getId()) machine_manager.removeMachine(self._um_cloud_printers[machine_cloud_id].getId()) removed_printers_message.hide()
Example #12
Source File: sparrowdialogs.py From sparrow-wifi with GNU General Public License v3.0 | 6 votes |
def getRemoteFile(self, agentIP, agentPort, filename): url = "http://" + agentIP + ":" + str(agentPort) + "/system/getrecording/" + filename dirname, runfilename = os.path.split(os.path.abspath(__file__)) recordingsDir = dirname + '/recordings' fullPath = recordingsDir + '/' + filename if os.path.isfile(fullPath): reply = QMessageBox.question(self, 'Question',"Local file by that name already exists. Overwrite?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.No: return try: # urllib.urlretrieve(url, fullPath) urlretrieve(url, fullPath) return 0, "" except: return 1, "Error downloading and saving file."
Example #13
Source File: main_dlg.py From dash-masternode-tool with MIT License | 6 votes |
def update_service(self): def on_mn_config_updated(masternode: MasternodeConfig): try: if self.cur_masternode == masternode: self.wdg_masternode.masternode_data_to_ui() if self.app_config.is_modified(): self.wdg_masternode.set_modified() else: self.save_configuration() except Exception as e: logging.exception(str(e)) if self.cur_masternode: upd_dlg = upd_mn_service_dlg.UpdMnServiceDlg( self, self.app_config, self.dashd_intf, self.cur_masternode, on_mn_config_updated_callback=on_mn_config_updated) upd_dlg.exec_() else: WndUtils.errorMsg('No masternode selected')
Example #14
Source File: main_dlg.py From dash-masternode-tool with MIT License | 6 votes |
def update_registrar(self, show_upd_payout: bool, show_upd_operator: bool, show_upd_voting: bool): def on_updtx_finished(masternode: MasternodeConfig): try: if self.cur_masternode == masternode: self.wdg_masternode.masternode_data_to_ui() if self.app_config.is_modified(): self.wdg_masternode.set_modified() else: self.save_configuration() except Exception as e: logging.exception(str(e)) if self.cur_masternode: upd_dlg = upd_mn_registrar_dlg.UpdMnRegistrarDlg( self, self.app_config, self.dashd_intf, self.cur_masternode, on_upd_success_callback=on_updtx_finished, show_upd_payout=show_upd_payout, show_upd_operator=show_upd_operator, show_upd_voting=show_upd_voting) upd_dlg.exec_() else: WndUtils.errorMsg('No masternode selected')
Example #15
Source File: main_dlg.py From dash-masternode-tool with MIT License | 6 votes |
def on_action_transfer_funds_for_cur_mn_triggered(self): """ Shows tranfser funds window with utxos related to current masternode. """ if self.cur_masternode: src_addresses = [] if not self.cur_masternode.collateralBip32Path: self.errorMsg("Enter the masternode collateral BIP32 path. You can use the 'right arrow' button " "on the right of the 'Collateral' edit box.") elif not self.cur_masternode.collateralAddress: self.errorMsg("Enter the masternode collateral Dash address. You can use the 'left arrow' " "button on the left of the 'BIP32 path' edit box.") else: src_addresses.append((self.cur_masternode.collateralAddress, self.cur_masternode.collateralBip32Path)) mn_index = self.app_config.masternodes.index(self.cur_masternode) self.show_wallet_window(mn_index) else: self.errorMsg('No masternode selected')
Example #16
Source File: tabRewards.py From PIVX-SPMT with MIT License | 6 votes |
def onToggleCollateral(self): if self.ui.rewardsList.box.collateralRow is not None: if not self.ui.collateralHidden: try: # If collateral row was selected, deselect it before hiding if self.ui.rewardsList.box.item(self.ui.rewardsList.box.collateralRow, 0).isSelected(): self.ui.rewardsList.box.selectRow(self.ui.rewardsList.box.collateralRow) except Exception as e: err_msg = "Error toggling collateral" printException(getCallerName(), getFunctionName(), err_msg, e.args) self.ui.rewardsList.box.hideRow(self.ui.rewardsList.box.collateralRow) self.ui.btn_toggleCollateral.setText("Show Collateral") self.ui.collateralHidden = True self.updateSelection() else: self.ui.rewardsList.box.showRow(self.ui.rewardsList.box.collateralRow) self.ui.btn_toggleCollateral.setText("Hide Collateral") self.ui.collateralHidden = False self.updateSelection() self.ui.rewardsList.box.resizeColumnsToContents() self.ui.rewardsList.box.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch) else: myPopUp_sb(self.caller, "warn", 'No Collateral', "No collateral selected")
Example #17
Source File: CompareFrameController.py From urh with GNU General Public License v3.0 | 6 votes |
def save_protocol(self): for msg in self.proto_analyzer.messages: if not msg.decoder.is_nrz: reply = QMessageBox.question(self, "Saving of protocol", "You want to save this protocol with an encoding different from NRZ.\n" "This may cause loss of information if you load it again.\n\n" "Save anyway?", QMessageBox.Yes | QMessageBox.No) if reply != QMessageBox.Yes: return else: break text = "protocol" filename = FileOperator.get_save_file_name("{0}.proto.xml".format(text), caption="Save protocol") if not filename: return if filename.endswith(".bin"): self.proto_analyzer.to_binary(filename, use_decoded=True) else: self.proto_analyzer.to_xml_file(filename=filename, decoders=self.decodings, participants=self.project_manager.participants, write_bits=True)
Example #18
Source File: ReceiveDialog.py From urh with GNU General Public License v3.0 | 6 votes |
def save_before_close(self): if not self.already_saved and self.device.current_index > 0: reply = QMessageBox.question(self, self.tr("Save data?"), self.tr("Do you want to save the data you have captured so far?"), QMessageBox.Yes | QMessageBox.No | QMessageBox.Abort) if reply == QMessageBox.Yes: self.on_save_clicked() elif reply == QMessageBox.Abort: return False try: sample_rate = self.device.sample_rate except: sample_rate = 1e6 self.files_recorded.emit(self.recorded_files, sample_rate) return True
Example #19
Source File: utils.py From v2rayL with GNU General Public License v3.0 | 5 votes |
def quitApp(self): # 退出程序 self.w.show() # w.hide() #设置退出时是否显示主窗口 re = QMessageBox.question(self.w, "提示", "确认退出?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if re == QMessageBox.Yes: self.tp.setVisible(False) # 隐藏托盘控件 qApp.quit() # 退出程序 self.w.v2rayL.disconnect()
Example #20
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def subreddit_not_valid(self, sub): text = '%s is not a valid subreddit. Would you like to remove this sub from the subreddit list?' % sub reply = message.information(self, 'Invalid Subreddit', text, message.Yes, message.No) return reply == message.Ok
Example #21
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def reddit_object_not_valid(self, name, type_): type_ = type_.lower() text = '%s is not a valid %s. Would you like to remove this %s from the %s list?' % (name, type_, type_, type_) reply = message.question(self, 'Invalid Object', text, message.Yes, message.No) return reply == message.Yes
Example #22
Source File: main.py From vip_video with GNU General Public License v3.0 | 5 votes |
def on_play_clicked(self): """ Slot documentation goes here. """ # TODO: not implemented yet if self.lineEdit.text(): self.url+=self.lineEdit.text() webbrowser.open(self.url) else: reply=QMessageBox.information(self, "警告","未输入有效url,继续输入点击yes,否则退出程序.",QMessageBox.Yes | QMessageBox.No) if reply == QMessageBox.No: sys.exit(1)
Example #23
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def no_users_downloaded(self): text = 'No users have been downloaded yet' reply = message.information(self, 'No Content', text, message.Ok) return reply == message.Ok
Example #24
Source File: __main__.py From Grabber with GNU General Public License v3.0 | 5 votes |
def main(): # Main loop while True: EXIT_CODE = 1 try: app = QApplication(sys.argv) program = GUI() EXIT_CODE = app.exec_() app = None # Required! Crashes on restart without. if EXIT_CODE == GUI.EXIT_CODE_REBOOT: continue # For when startup fails except (SettingsError, ProfileLoadError, json.decoder.JSONDecodeError) as e: if isinstance(e, ProfileLoadError): file = 'profiles file' else: file = 'settings file' warning = QMessageBox.warning(None, f'Corruption of {file}!', ''.join([str(e), '\nRestore to defaults?']), buttons=QMessageBox.Yes | QMessageBox.No) # If yes, do settings or profile reset. if warning == QMessageBox.Yes: filehandler = FileHandler() if isinstance(e, ProfileLoadError): filehandler.save_profiles({}) else: setting = filehandler.load_settings(reset=True) filehandler.save_settings(setting.settings_data) app = None # Ensures the app instance is properly removed! continue sys.exit(EXIT_CODE)
Example #25
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def no_imgur_client(self): text = 'No Imgur client is detected. You must have an Imgur client in order to download content from ' \ 'imgur.com. Please see settings menu and click on the "Imgur Client Information" in the top right for ' \ 'instuctions on how to obtain an imgur client and enter its credentials for use with this application' reply = message.information(self, 'No Imgur Client', text, message.Ok) return reply == message.Ok
Example #26
Source File: dataManage.py From face_recognition_py with GNU General Public License v3.0 | 5 votes |
def train(self): try: if not os.path.isdir(self.datasets): raise FileNotFoundError text = '系统将开始训练人脸数据,界面会暂停响应一段时间,完成后会弹出提示。' informativeText = '<b>训练过程请勿进行其它操作,是否继续?</b>' ret = DataManageUI.callDialog(QMessageBox.Question, text, informativeText, QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if ret == QMessageBox.Yes: face_recognizer = cv2.face.LBPHFaceRecognizer_create() if not os.path.exists('./recognizer'): os.makedirs('./recognizer') faces, labels = self.prepareTrainingData(self.datasets) face_recognizer.train(faces, np.array(labels)) face_recognizer.save('./recognizer/trainingData.yml') except FileNotFoundError: logging.error('系统找不到人脸数据目录{}'.format(self.datasets)) self.trainButton.setIcon(QIcon('./icons/error.png')) self.logQueue.put('未发现人脸数据目录{},你可能未进行人脸采集'.format(self.datasets)) except Exception as e: logging.error('遍历人脸库出现异常,训练人脸数据失败') self.trainButton.setIcon(QIcon('./icons/error.png')) self.logQueue.put('Error:遍历人脸库出现异常,训练失败') else: text = '<font color=green><b>Success!</b></font> 系统已生成./recognizer/trainingData.yml' informativeText = '<b>人脸数据训练完成!</b>' DataManageUI.callDialog(QMessageBox.Information, text, informativeText, QMessageBox.Ok) self.trainButton.setIcon(QIcon('./icons/success.png')) self.logQueue.put('Success:人脸数据训练完成') self.initDb() # 系统日志服务常驻,接收并处理系统日志
Example #27
Source File: tab_datasets.py From CvStudio with MIT License | 5 votes |
def btn_delete_dataset_on_slot(self, vo: DatasetVO): reply = QMessageBox.question(self, 'Confirmation', "Are you sure?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: self._ds_dao.delete(vo.id) usr_folder = FileUtilities.get_usr_folder() ds_folder = os.path.join(usr_folder, vo.folder) FileUtilities.delete_folder(ds_folder) self.load()
Example #28
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def unsaved_close_message(self): text = "Save changes to Downloader For Reddit?" reply = message.question(self, "Save Changes?", text, message.Yes | message.No | message.Cancel, message.Cancel) if reply == message.Yes: return "SAVE" elif reply == message.No: return "CLOSE" else: return "CANCEL"
Example #29
Source File: Message_Box.py From python with Apache License 2.0 | 5 votes |
def closeEvent(self, event): reply = QMessageBox.question(self, 'Message', "Are you sure to quit?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: event.accept() else: event.ignore()
Example #30
Source File: Messages.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def ffmpeg_warning(self): text = 'Ffmpeg not detected. Videos hosted by reddit will be downloaded as two separate files (video and ' \ 'audio) and cannot be merged without ffmpeg. See help menu for more information.\n\nThis dialog will ' \ 'not display again after save.\n\nDo you want to disable reddit video download?' reply = message.information(self, 'ffmpeg Not Installed', text, message.Yes, message.No) return reply == message.Yes