Python PyQt5.QtWidgets.QMessageBox.Information() Examples
The following are 28
code examples of PyQt5.QtWidgets.QMessageBox.Information().
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: test_msgbox.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def test_finished_signal(qtbot): """Make sure we can pass a slot to be called when the dialog finished.""" signal_triggered = False def on_finished(): nonlocal signal_triggered signal_triggered = True box = msgbox.msgbox(parent=None, title='foo', text='foo', icon=QMessageBox.Information, on_finished=on_finished) qtbot.add_widget(box) with qtbot.waitSignal(box.finished): box.accept() assert signal_triggered
Example #2
Source File: test_panes.py From mu with GNU General Public License v3.0 | 6 votes |
def test_MuFileList_show_confirm_overwrite_dialog(qtapp): """ Ensure the user is notified of an existing file. """ mfl = mu.interface.panes.MuFileList() mock_qmb = mock.MagicMock() mock_qmb.setIcon = mock.MagicMock(return_value=None) mock_qmb.setText = mock.MagicMock(return_value=None) mock_qmb.setWindowTitle = mock.MagicMock(return_value=None) mock_qmb.exec_ = mock.MagicMock(return_value=QMessageBox.Ok) mock_qmb_class = mock.MagicMock(return_value=mock_qmb) mock_qmb_class.Ok = QMessageBox.Ok mock_qmb_class.Information = QMessageBox.Information with mock.patch("mu.interface.panes.QMessageBox", mock_qmb_class): assert mfl.show_confirm_overwrite_dialog() msg = "File already exists; overwrite it?" mock_qmb.setText.assert_called_once_with(msg) mock_qmb.setWindowTitle.assert_called_once_with("File already exists") mock_qmb.setIcon.assert_called_once_with(QMessageBox.Information)
Example #3
Source File: work_log.py From Awesome-Python-Scripts with MIT License | 6 votes |
def helper(self): """Display help.""" msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("This simple python script allows you to generate a " "worklog in rst format based on your repo commits.") msg.setInformativeText("You need to generated a token first.") msg.setWindowTitle("Help") msg.setWindowIcon(QIcon(ICON_PATH)) msg.setDetailedText("Simply generate a personnal access token and " "enter it in the first field of the window." "\r\n" "In order to generate this token, go to " "https://github.com/settings/tokens " "under \"Personal access tokens\".") msg.exec_()
Example #4
Source File: work_log.py From Awesome-Scripts with MIT License | 6 votes |
def helper(self): """Display help.""" msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("This simple python script allows you to generate a " "worklog in rst format based on your repo commits.") msg.setInformativeText("You need to generated a token first.") msg.setWindowTitle("Help") msg.setWindowIcon(QIcon(ICON_PATH)) msg.setDetailedText("Simply generate a personnal access token and " "enter it in the first field of the window." "\r\n" "In order to generate this token, go to " "https://github.com/settings/tokens " "under \"Personal access tokens\".") msg.exec_()
Example #5
Source File: main-2-after-start.py From python-examples with MIT License | 5 votes |
def show_message(self): msg = QMessageBox() msg.setWindowTitle('Initial information') msg.setText("Please use the 'Close (F6)' button to close the program.\n\n" "Closing it by pressing the red X button on the top will " "leave the autoclicker running until the key 'F6' is pressed.") msg.setIcon(QMessageBox.Information) msg.setStandardButtons(QMessageBox.Ok) msg.exec() # --- functions --- # --- main ---
Example #6
Source File: test_msgbox.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def test_plain_text(qtbot, plain_text, expected): box = msgbox.msgbox(parent=None, title='foo', text='foo', icon=QMessageBox.Information, plain_text=plain_text) qtbot.add_widget(box) assert box.textFormat() == expected
Example #7
Source File: main-3-after-start-with-delay.py From python-examples with MIT License | 5 votes |
def show_message(self): msg = QMessageBox() msg.setWindowTitle('Initial information') msg.setText("Please use the 'Close (F6)' button to close the program.\n\n" "Closing it by pressing the red X button on the top will " "leave the autoclicker running until the key 'F6' is pressed.") msg.setIcon(QMessageBox.Information) msg.setStandardButtons(QMessageBox.Ok) msg.exec() # --- functions --- # --- main ---
Example #8
Source File: main-1-before-start.py From python-examples with MIT License | 5 votes |
def show_message(): msg = QMessageBox() msg.setWindowTitle('Initial information') msg.setText("Please use the 'Close (F6)' button to close the program.\n\n" "Closing it by pressing the red X button on the top will " "leave the autoclicker running until the key 'F6' is pressed.") msg.setIcon(QMessageBox.Information) msg.setStandardButtons(QMessageBox.Ok) msg.exec() # --- main ---
Example #9
Source File: msg.py From gridsync with GNU General Public License v3.0 | 5 votes |
def info(parent, title, text): msg = QMessageBox(parent) msg.setIcon(QMessageBox.Information) msg.setWindowTitle(title) msg.setText(text) return msg.exec_()
Example #10
Source File: core.py From gridsync with GNU General Public License v3.0 | 5 votes |
def show_message(): message_settings = settings.get("message") if not message_settings: return if get_preference("message", "suppress") == "true": return logging.debug("Showing custom message to user...") msgbox = QMessageBox() icon_type = message_settings.get("type") if icon_type: icon_type = icon_type.lower() if icon_type == "information": msgbox.setIcon(QMessageBox.Information) elif icon_type == "warning": msgbox.setIcon(QMessageBox.Warning) elif icon_type == "critical": msgbox.setIcon(QMessageBox.Critical) if sys.platform == "darwin": msgbox.setText(message_settings.get("title")) msgbox.setInformativeText(message_settings.get("text")) else: msgbox.setWindowTitle(message_settings.get("title")) msgbox.setText(message_settings.get("text")) checkbox = QCheckBox("Do not show this message again") checkbox.stateChanged.connect( lambda state: set_preference( "message", "suppress", ("true" if state else "false") ) ) msgbox.setCheckBox(checkbox) msgbox.exec_() logging.debug("Custom message closed; proceeding with start...")
Example #11
Source File: misc.py From PIVX-SPMT with MIT License | 5 votes |
def myPopUp_sb(parentWindow, messType, messTitle, messText, singleButton=QMessageBox.Ok): if messType in QT_MESSAGE_TYPE: type = QT_MESSAGE_TYPE[messType] else: type = QMessageBox.Information mess = QMessageBox(type, messTitle, messText, singleButton, parent=parentWindow) mess.setStandardButtons(singleButton | singleButton) return mess.exec_()
Example #12
Source File: actions.py From IDArling with GNU General Public License v3.0 | 5 votes |
def file_uploaded(plugin, progress, _): progress.close() # Show a success dialog success = QMessageBox() success.setIcon(QMessageBox.Information) success.setStandardButtons(QMessageBox.Ok) success.setText("Database successfully uploaded!") success.setWindowTitle("Save to server") icon_path = plugin.plugin_resource("upload.png") success.setWindowIcon(QIcon(icon_path)) success.exec_() # Subscribe to the event stream plugin.core.join_session()
Example #13
Source File: widgets.py From Turing with MIT License | 5 votes |
def msg_box_info(text, *args, **kwargs): return msg_box(text, *args, **kwargs, buttons=QMessageBox.Yes, default=QMessageBox.Yes, type=QMessageBox.Information)
Example #14
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 #15
Source File: util.py From guppy-proxy with MIT License | 5 votes |
def display_info_box(msg, title="Message"): msgbox = QMessageBox() msgbox.setIcon(QMessageBox.Information) msgbox.setText(msg) msgbox.setWindowTitle(title) msgbox.setStandardButtons(QMessageBox.Ok) return msgbox.exec_()
Example #16
Source File: bomb.py From whatabomb with Apache License 2.0 | 5 votes |
def MYABOUT(self): box = QtWidgets.QMessageBox(self.obj) msg = """ This program is coded by <b>Gurkirat Singh (T3r@bYt3)</b>. <br><br><br> Thanks to : <b>Sameer Bhatt</b> (for giving me the implementation example) """ box.setStandardButtons(QMessageBox.Ok) box.setIcon(QMessageBox.Information) box.setWindowTitle("About") box.setText(msg) box.show() pass
Example #17
Source File: qmessagebox.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def dinformation(title, text, detailed_text, parent=None): """MessageBox with "Information" icon""" QDetailedMessageBox.dgeneric(title, text, detailed_text, QMessageBox.Information, parent)
Example #18
Source File: messagebox.py From Camelishing with MIT License | 5 votes |
def mess(self, text, inf, title): self.msg = QMessageBox() self.msg.setText('{}'.format(text)) self.msg.setInformativeText('{}'.format(inf)) self.msg.setWindowTitle('{}'.format(title)) self.msg.setIcon(QMessageBox.Information) self.execmsg = self.msg.exec_()
Example #19
Source File: start.py From Camelishing with MIT License | 5 votes |
def mess(self,text,inf,title): self.msg = QMessageBox() self.msg.setText('{}' .format(text)) self.msg.setSizeGripEnabled(True) self.msg.setInformativeText('{}'.format(inf)) self.msg.setWindowTitle('{}'.format(title)) self.msg.setIcon(QMessageBox.Information) self.execmsg = self.msg.exec_()
Example #20
Source File: smtp.py From Camelishing with MIT License | 5 votes |
def mess(self,text,inf,title): self.msg = QMessageBox() self.msg.setText('{}' .format(text)) self.msg.setSizeGripEnabled(True) self.msg.setInformativeText('{}'.format(inf)) self.msg.setWindowTitle('{}'.format(title)) self.msg.setIcon(QMessageBox.Information) self.execmsg = self.msg.exec_()
Example #21
Source File: qt_main.py From MDT with GNU Lesser General Public License v3.0 | 5 votes |
def _write_example_data(self): try: mdt.utils.get_example_data(self.outputFile.text()) msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText('The MDT example data has been written to {}.'.format(self.outputFile.text())) msg.setWindowTitle('Success') msg.exec_() except IOError as e: msg = QMessageBox() msg.setIcon(QMessageBox.Critical) msg.setText(str(e)) msg.setWindowTitle("File writing error") msg.exec_()
Example #22
Source File: main_dlg.py From dash-masternode-tool with MIT License | 5 votes |
def closeEvent(self, event): app_cache.save_window_size(self) self.finishing = True if self.dashd_intf: self.dashd_intf.disconnect() if self.app_config.is_modified(): if self.queryDlg('Configuration modified. Save?', buttons=QMessageBox.Yes | QMessageBox.No, default_button=QMessageBox.Yes, icon=QMessageBox.Information) == QMessageBox.Yes: self.save_configuration() self.app_config.close()
Example #23
Source File: msgbox.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def information(*args, **kwargs): """Display an information box. Args: *args: Passed to msgbox. **kwargs: Passed to msgbox. Return: A new QMessageBox. """ return msgbox(*args, icon=QMessageBox.Information, **kwargs)
Example #24
Source File: dataManage.py From face_recognition_py with GNU General Public License v3.0 | 4 votes |
def deleteUser(self): text = '从数据库中删除该用户,同时删除相应人脸数据,<font color=red>该操作不可逆!</font>' informativeText = '<b>是否继续?</b>' ret = DataManageUI.callDialog(QMessageBox.Warning, text, informativeText, QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if ret == QMessageBox.Yes: stu_id = self.stuIDLineEdit.text() conn = sqlite3.connect(self.database) cursor = conn.cursor() try: cursor.execute('DELETE FROM users WHERE stu_id=?', (stu_id,)) except Exception as e: cursor.close() logging.error('无法从数据库中删除{}'.format(stu_id)) self.deleteUserButton.setIcon(QIcon('./icons/error.png')) self.logQueue.put('Error:读写数据库异常,删除失败') else: cursor.close() conn.commit() if os.path.exists('{}/stu_{}'.format(self.datasets, stu_id)): try: shutil.rmtree('{}/stu_{}'.format(self.datasets, stu_id)) except Exception as e: logging.error('系统无法删除删除{}/stu_{}'.format(self.datasets, stu_id)) self.logQueue.put('Error:删除人脸数据失败,请手动删除{}/stu_{}目录'.format(self.datasets, stu_id)) text = '你已成功删除学号为 <font color=blue>{}</font> 的用户记录。'.format(stu_id) informativeText = '<b>请在右侧菜单重新训练人脸数据。</b>' DataManageUI.callDialog(QMessageBox.Information, text, informativeText, QMessageBox.Ok) self.stuIDLineEdit.clear() self.cnNameLineEdit.clear() self.faceIDLineEdit.clear() self.initDb() self.deleteUserButton.setIcon(QIcon('./icons/success.png')) self.deleteUserButton.setEnabled(False) self.queryUserButton.setIcon(QIcon()) finally: conn.close() # 检测人脸
Example #25
Source File: optimize5.py From pyxll-examples with The Unlicense | 4 votes |
def optimize5(): """ Trigger optimization of a spreadsheet model that takes the named range "Inputs" as inputs and produces output in the named range "Output". """ xl = xl_app() qt_app = get_qt_app() # pragma noqc # Get the initial values of the input cells msgBox = OpDialog() result = msgBox.exec_() if not result: # user cancelled return in_range = get_range(msgBox.in_range.text()) out_cell = get_range(msgBox.out_cell.text()) in_values = list(in_range.Value) X = np.array([x[0] for x in in_values]) orig_calc_mode = xl.Calculation try: # switch Excel to manual calculation # and disable screen updating xl.Calculation = constants.xlManual xl.ScreenUpdating = False # run the minimization routine xl_obj_func = partial(obj_func, xl, in_range, out_cell) print(f"X = {X}") result = minimize(xl_obj_func, X, method="nelder-mead") in_range.Value = [(float(x),) for x in result.x] xl.ScreenUpdating = True mbox = QMessageBox() mbox.setIcon(QMessageBox.Information) mbox.setText("Optimization results shown below." "\nMake changes permanent?") mbox.setWindowTitle("Optimization Complete") mbox.setInformativeText( "\n".join( [ "Successful: %s" % result.success, result.message, "After %d iterations" % result.nit, ] ) ) mbox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) yes_no = mbox.exec_() if yes_no != QMessageBox.Ok: in_range.Value = in_values else: in_range.Value = [(float(x),) for x in result.x] finally: # restore the original calculation # and screen updating mode xl.ScreenUpdating = True xl.Calculation = orig_calc_mode
Example #26
Source File: optimize4.py From pyxll-examples with The Unlicense | 4 votes |
def optimize4(): """ Trigger optimization of a spreadsheet model that takes the named range "Inputs" as inputs and produces output in the named range "Output". """ qt_app = get_qt_app() # pragma noqc xl = xl_app() # Get the initial values of the input cells in_values = list(xl.Range("Inputs").Value) X = np.array([x[0] for x in in_values]) orig_calc_mode = xl.Calculation try: # switch Excel to manual calculation # and disable screen updating xl.Calculation = constants.xlManual xl.ScreenUpdating = False # run the minimization routine xl_obj_func = partial(obj_func, xl) result = minimize(xl_obj_func, X, method="nelder-mead") xl.ScreenUpdating = True mbox = QMessageBox() mbox.setIcon(QMessageBox.Information) mbox.setText("Optimization results shown below." "\nMake changes permanent?") mbox.setWindowTitle("Optimization Complete") mbox.setInformativeText( "\n".join( [ "Successful: %s" % result.success, result.message, "After %d iterations" % result.nit, ] ) ) mbox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) yes_no = mbox.exec_() if yes_no != QMessageBox.Ok: xl.Range("Inputs").Value = in_values else: xl.Range("Inputs").Value = [(float(x),) for x in result.x] finally: # restore the original calculation # and screen updating mode xl.Calculation = orig_calc_mode
Example #27
Source File: dataRecord.py From face_recognition_py with GNU General Public License v3.0 | 4 votes |
def startFaceRecord(self, startFaceRecordButton): if startFaceRecordButton.text() == '开始采集人脸数据': if self.isFaceDetectEnabled: if self.isUserInfoReady: self.addOrUpdateUserInfoButton.setEnabled(False) if not self.enableFaceRecordButton.isEnabled(): self.enableFaceRecordButton.setEnabled(True) self.enableFaceRecordButton.setIcon(QIcon()) self.startFaceRecordButton.setIcon(QIcon('./icons/success.png')) self.startFaceRecordButton.setText('结束当前人脸采集') else: self.startFaceRecordButton.setIcon(QIcon('./icons/error.png')) self.startFaceRecordButton.setChecked(False) self.logQueue.put('Error:操作失败,系统未检测到有效的用户信息') else: self.startFaceRecordButton.setIcon(QIcon('./icons/error.png')) self.logQueue.put('Error:操作失败,请开启人脸检测') else: if self.faceRecordCount < self.minFaceRecordCount: text = '系统当前采集了 <font color=blue>{}</font> 帧图像,采集数据过少会导致较大的识别误差。'.format(self.faceRecordCount) informativeText = '<b>请至少采集 <font color=red>{}</font> 帧图像。</b>'.format(self.minFaceRecordCount) DataRecordUI.callDialog(QMessageBox.Information, text, informativeText, QMessageBox.Ok) else: text = '系统当前采集了 <font color=blue>{}</font> 帧图像,继续采集可以提高识别准确率。'.format(self.faceRecordCount) informativeText = '<b>你确定结束当前人脸采集吗?</b>' ret = DataRecordUI.callDialog(QMessageBox.Question, text, informativeText, QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if ret == QMessageBox.Yes: self.isFaceDataReady = True if self.isFaceRecordEnabled: self.isFaceRecordEnabled = False self.enableFaceRecordButton.setEnabled(False) self.enableFaceRecordButton.setIcon(QIcon()) self.startFaceRecordButton.setText('开始采集人脸数据') self.startFaceRecordButton.setEnabled(False) self.startFaceRecordButton.setIcon(QIcon()) self.migrateToDbButton.setEnabled(True) # 定时器,实时更新画面
Example #28
Source File: tabRewards.py From PIVX-SPMT with MIT License | 4 votes |
def FinishSend_int(self, serialized_tx, amount_to_send): if not self.txFinished: try: self.txFinished = True tx_hex = serialized_tx.hex() printDbg("Raw signed transaction: " + tx_hex) printDbg("Amount to send :" + amount_to_send) if len(tx_hex) > 90000: mess = "Transaction's length exceeds 90000 bytes. Select less UTXOs and try again." myPopUp_sb(self.caller, "crit", 'transaction Warning', mess) else: decodedTx = None try: decodedTx = ParseTx(tx_hex, self.caller.isTestnetRPC) destination = decodedTx.get("vout")[0].get("scriptPubKey").get("addresses")[0] amount = decodedTx.get("vout")[0].get("value") message = '<p>Broadcast signed transaction?</p><p>Destination address:<br><b>%s</b></p>' % destination message += '<p>Amount: <b>%s</b> PIV<br>' % str(round(amount / 1e8, 8)) message += 'Fees: <b>%s</b> PIV <br>Size: <b>%d</b> Bytes</p>' % (str(round(self.currFee / 1e8, 8) ), len(tx_hex)/2) except Exception as e: printException(getCallerName(), getFunctionName(), "decoding exception", str(e)) message = '<p>Unable to decode TX- Broadcast anyway?</p>' mess1 = QMessageBox(QMessageBox.Information, 'Send transaction', message, parent=self.caller) if decodedTx is not None: mess1.setDetailedText(json.dumps(decodedTx, indent=4, sort_keys=False)) mess1.setStandardButtons(QMessageBox.Yes | QMessageBox.No) reply = mess1.exec_() if reply == QMessageBox.Yes: txid = self.caller.rpcClient.sendRawTransaction(tx_hex, self.useSwiftX()) if txid is None: raise Exception("Unable to send TX - connection to RPC server lost.") printDbg("Transaction sent. ID: %s" % txid) mess2_text = "<p>Transaction successfully sent.</p>" mess2 = QMessageBox(QMessageBox.Information, 'transaction Sent', mess2_text, parent=self.caller) mess2.setDetailedText(txid) mess2.exec_() # remove spent rewards from DB self.removeSpentRewards() # reload utxos self.display_mn_utxos() self.onCancel() else: myPopUp_sb(self.caller, "warn", 'Transaction NOT sent', "Transaction NOT sent") self.onCancel() except Exception as e: err_msg = "Exception in FinishSend" printException(getCallerName(), getFunctionName(), err_msg, e.args) # Activated by signal sigTxabort from hwdevice