本文整理汇总了Python中PyQt5.QtWidgets.QMessageBox.No方法的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox.No方法的具体用法?Python QMessageBox.No怎么用?Python QMessageBox.No使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QMessageBox
的用法示例。
在下文中一共展示了QMessageBox.No方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: closeEvent
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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()
示例2: on_action_transfer_funds_for_cur_mn_triggered
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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')
示例3: update_registrar
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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')
示例4: update_service
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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')
示例5: _onRemovedPrintersMessageActionTriggered
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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()
示例6: check_gtihub_for_updates
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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)
示例7: test_check_for_updates
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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')
示例8: closeEvent
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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()
# ----------------------------------------------------------------------
示例9: profile_delete_action
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
def profile_delete_action(self):
if self.profileSelector.count() > 1:
to_delete = BackupProfileModel.get(id=self.profileSelector.currentData())
# Remove pending background jobs
to_delete_id = str(to_delete.id)
msg = self.tr("Are you sure you want to delete profile '{}'?".format(to_delete.name))
reply = QMessageBox.question(self, self.tr("Confirm deletion"),
msg, QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
if self.app.scheduler.get_job(to_delete_id):
self.app.scheduler.remove_job(to_delete_id)
to_delete.delete_instance(recursive=True)
self.profileSelector.removeItem(self.profileSelector.currentIndex())
self.profile_select_action(0)
示例10: closeEvent
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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()
示例11: getRemoteFile
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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."
示例12: msg_box
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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
示例13: promptToSave
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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
示例14: closeEvent
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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()
示例15: save_protocol
# 需要导入模块: from PyQt5.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt5.QtWidgets.QMessageBox import No [as 别名]
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)