本文整理匯總了Python中PyQt5.QtWidgets.QMessageBox.Warning方法的典型用法代碼示例。如果您正苦於以下問題:Python QMessageBox.Warning方法的具體用法?Python QMessageBox.Warning怎麽用?Python QMessageBox.Warning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QMessageBox
的用法示例。
在下文中一共展示了QMessageBox.Warning方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: late_init
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def late_init(save_manager: savemanager.SaveManager) -> None:
"""Initialize the rest of the config after the QApplication is created."""
global _init_errors
if _init_errors is not None:
errbox = msgbox.msgbox(parent=None,
title="Error while reading config",
text=_init_errors.to_html(),
icon=QMessageBox.Warning,
plain_text=False)
errbox.exec_()
if _init_errors.fatal:
sys.exit(usertypes.Exit.err_init)
_init_errors = None
configtypes.FontBase.set_defaults(config.val.fonts.default_family,
config.val.fonts.default_size)
config.instance.changed.connect(_update_font_defaults)
config.instance.init_save_manager(save_manager)
configfiles.state.init_save_manager(save_manager)
示例2: on_btnEnDisPin_clicked
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def on_btnEnDisPin_clicked(self):
try:
if self.hw_session and self.hw_session.hw_client:
if self.pin_protection is True:
# disable
if self.queryDlg('Do you really want to disable PIN protection of your %s?' % self.main_ui.getHwName(),
buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
icon=QMessageBox.Warning) == QMessageBox.Yes:
hw_intf.change_pin(self.main_ui.hw_session, remove=True)
self.read_hw_features()
self.updateControlsState()
elif self.pin_protection is False:
# enable PIN
hw_intf.change_pin(self.main_ui.hw_session, remove=False)
self.read_hw_features()
self.updateControlsState()
except Exception as e:
self.errorMsg(str(e))
示例3: on_btnEnDisPass_clicked
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def on_btnEnDisPass_clicked(self):
try:
if self.hw_session and self.hw_session.hw_client:
if self.passphrase_protection is True:
# disable passphrase
if self.queryDlg('Do you really want to disable passphrase protection of your %s?' % self.main_ui.getHwName(),
buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
icon=QMessageBox.Warning) == QMessageBox.Yes:
hw_intf.enable_passphrase(self.hw_session, passphrase_enabled=False)
self.read_hw_features()
self.updateControlsState()
elif self.passphrase_protection is False:
# enable passphrase
if self.queryDlg('Do you really want to enable passphrase protection of your %s?' % self.main_ui.getHwName(),
buttons=QMessageBox.Yes | QMessageBox.Cancel, default_button=QMessageBox.Cancel,
icon=QMessageBox.Warning) == QMessageBox.Yes:
hw_intf.enable_passphrase(self.hw_session, passphrase_enabled=True)
self.read_hw_features()
self.updateControlsState()
except Exception as e:
self.errorMsg(str(e))
示例4: main
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def main():
QApplication.setApplicationName("Blender Version Manager")
QApplication.setApplicationVersion("1.6.1 Beta")
app = QApplication(sys.argv)
proc_count = len([proc for proc in psutil.process_iter()
if proc.name() == "Blender Version Manager.exe"])
if proc_count > 2:
msg = QMessageBox(QMessageBox.Warning, "Blender Version Manager",
"Another instance is already running!",
QMessageBox.Ok)
msg.setWindowIcon(QIcon(":/icons/app.svg"))
msg.exec_()
else:
window = BVMQMainWindow(app)
if not window.is_run_minimized:
window.show()
app.exec_()
示例5: warning
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def warning(self, warningstr):
warning = QMessageBox()
warning.setWindowTitle('Warning')
warning.setIcon(QMessageBox.Warning)
warning.setText(warningstr)
warning.setStandardButtons(QMessageBox.Ok)
return warning.exec_()
示例6: callBack
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def callBack(self, keys):
# do nothing if keys is empty
if not(keys):
return
# check that if shortcut used before.
if keys in self.shortcuts_list:
self.msgBox = QMessageBox()
self.msgBox.setText(QCoreApplication.translate("setting_src_ui_tr", "<b><center>This shortcut has been used before!\
Use another one!</center></b>"))
self.msgBox.setIcon(QMessageBox.Warning)
reply = self.msgBox.exec_()
# set new shortcut
else:
selected_row = self.shortcut_table.selectionModel().selectedRows()[0].row()
item = QTableWidgetItem(keys)
# align center
item.setTextAlignment(0x0004 | 0x0080)
# insert item in shortcut_table
self.shortcut_table.setItem(selected_row, 1, item)
# set keys in shortcuts_list
self.shortcuts_list[selected_row] = keys
# active color_comboBox only when user is select "Fusion" style.
示例7: DisplayErrorMessage
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def DisplayErrorMessage(self, message):
print(message)
self.alert.setText(message)
self.alert.setIcon(QMessageBox.Warning)
self.alert.exec_()
# Start the telemetry system for the selected spacecraft
示例8: generate_priv_key
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def generate_priv_key(self, pk_type:str, edit_control: QLineEdit, compressed: bool):
if edit_control.text():
if WndUtils.queryDlg(
f'This will overwrite the current {pk_type} private key value. Do you really want to proceed?',
buttons=QMessageBox.Yes | QMessageBox.Cancel,
default_button=QMessageBox.Yes, icon=QMessageBox.Warning) != QMessageBox.Yes:
return None
if pk_type == 'operator':
pk = dash_utils.generate_bls_privkey()
else:
pk = dash_utils.generate_wif_privkey(self.app_config.dash_network, compressed=compressed)
edit_control.setText(pk)
return pk
示例9: load_configuration_from_file
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def load_configuration_from_file(self, file_name: str, ask_save_changes = True,
update_current_file_name = True) -> None:
"""
Load configuration from a file.
:param file_name: A name of the configuration file to be loaded into the application.
"""
if self.app_config.is_modified() and ask_save_changes:
ret = self.queryDlg('Current configuration has been modified. Save?',
buttons=QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
default_button=QMessageBox.Yes, icon=QMessageBox.Warning)
if ret == QMessageBox.Yes:
self.save_configuration()
elif ret == QMessageBox.Cancel:
self.update_config_files_mru_menu_items()
return
try:
self.disconnect_hardware_wallet()
dash_network_sav = self.app_config.dash_network
self.app_config.read_from_file(hw_session=self.hw_session, file_name=file_name,
update_current_file_name=update_current_file_name)
self.editing_enabled = False
self.configuration_to_ui()
self.dashd_intf.reload_configuration()
self.app_config.modified = False
file_name = self.app_config.app_config_file_name
if file_name:
self.add_item_to_config_files_mru_list(file_name)
self.update_config_files_mru_menu_items()
if dash_network_sav != self.app_config.dash_network:
self.disconnect_hardware_wallet()
self.app_config.reset_network_dependent_dyn_params()
self.display_window_title()
except CancelException:
self.update_config_files_mru_menu_items()
示例10: on_action_clear_wallet_cache_triggered
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def on_action_clear_wallet_cache_triggered(self, checked):
if self.queryDlg('Do you really want to clear the wallet cache?',
buttons=QMessageBox.Yes | QMessageBox.Cancel,
default_button=QMessageBox.Cancel, icon=QMessageBox.Warning) == QMessageBox.Yes:
db_cursor = self.app_config.db_intf.get_cursor()
try:
db_cursor.execute('drop table address')
db_cursor.execute('drop table hd_tree')
db_cursor.execute('drop table tx_input')
db_cursor.execute('drop table tx_output')
db_cursor.execute('drop table tx')
self.app_config.db_intf.create_structures()
finally:
self.app_config.db_intf.release_cursor()
self.infoMsg('Wallet cache cleared.')
示例11: on_action_clear_proposals_cache_triggered
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def on_action_clear_proposals_cache_triggered(self, checked):
if self.queryDlg('Do you really want to clear the proposals cache?',
buttons=QMessageBox.Yes | QMessageBox.Cancel,
default_button=QMessageBox.Cancel, icon=QMessageBox.Warning) == QMessageBox.Yes:
db_cursor = self.app_config.db_intf.get_cursor()
try:
db_cursor.execute('drop table proposals')
db_cursor.execute('drop table voting_results')
self.app_config.db_intf.create_structures()
finally:
self.app_config.db_intf.release_cursor()
self.infoMsg('Proposals cache cleared.')
示例12: on_btnDeleteMn_clicked
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def on_btnDeleteMn_clicked(self):
if self.cur_masternode:
msg = QMessageBox()
msg.setIcon(QMessageBox.Warning)
msg.setText('Do you really want to delete current masternode configuration?')
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msg.setDefaultButton(QMessageBox.No)
retval = msg.exec_()
if retval == QMessageBox.No:
return
self.app_config.masternodes.remove(self.cur_masternode)
self.cboMasternodes.removeItem(self.cboMasternodes.currentIndex())
self.app_config.modified = True
self.update_edit_controls_state()
示例13: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def __init__(self, problems, *args):
super().__init__(*args)
self.setIcon(QMessageBox.Warning)
self.setWindowTitle("Insufficient protocol")
self.setText("The provided protocol is insufficient for this model.")
self.setInformativeText("The reported problems are: \n{}".format('\n'.join(' - ' + str(p) for p in problems)))
self._in_resize = False
示例14: dwarning
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def dwarning(title, text, detailed_text, parent=None):
"""MessageBox with "Warning" icon"""
QDetailedMessageBox.dgeneric(title,
text,
detailed_text,
QMessageBox.Warning,
parent)
示例15: display_error_box
# 需要導入模塊: from PyQt5.QtWidgets import QMessageBox [as 別名]
# 或者: from PyQt5.QtWidgets.QMessageBox import Warning [as 別名]
def display_error_box(msg, title="Error"):
msgbox = QMessageBox()
msgbox.setIcon(QMessageBox.Warning)
msgbox.setText(msg)
msgbox.setWindowTitle(title)
msgbox.setStandardButtons(QMessageBox.Ok)
return msgbox.exec_()