本文整理匯總了Python中PySide2.QtWidgets.QMessageBox方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QMessageBox方法的具體用法?Python QtWidgets.QMessageBox怎麽用?Python QtWidgets.QMessageBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QMessageBox方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: confirmDialog
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def confirmDialog(tex_count):
"""
displays a confirmation dialog (with info about amount of found textures) for starting texture conversion process
"""
font = QtGui.QFont()
font.setBold( True )
dialog = QtWidgets.QMessageBox()
if in_hou:
dialog.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)
dialog.setProperty("houdiniStyle", True)
dialog.setFont(font)
dialog.setIcon(QtWidgets.QMessageBox.Information)
dialog.setWindowTitle("Proceed?")
dialog.setText("{} textures found, proceed?".format(tex_count))
dialog.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
dialog.setDefaultButton(QtWidgets.QMessageBox.Yes)
ret = dialog.exec_()
if ret == dialog.Ok:
return True
else:
return False
示例2: except_hook
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def except_hook(exception_type, exception_value, traceback_object):
notice = f'''Wild bug appears! <br>
Please copy this text and <a href="https://github.com/lightning-power-users/node-launcher/issues/new">open an issue on GitHub</a>.<br>
Node Launcher version {NODE_LAUNCHER_RELEASE}<br><br>
Error information:'''
traceback_io = StringIO()
traceback.print_tb(traceback_object, None, traceback_io)
traceback_io.seek(0)
traceback_info = traceback_io.read()
sections = [
notice,
str(exception_type),
str(exception_value),
traceback_info
]
msg = '<br>'.join(sections)
error_message = QMessageBox()
error_message.setTextFormat(Qt.RichText)
error_message.setTextInteractionFlags(Qt.TextSelectableByMouse)
error_message.setFixedWidth(800)
error_message.setText(msg)
error_message.exec_()
sys.exit(1)
示例3: check_version
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def check_version():
latest_version = LauncherSoftware().get_latest_release_version()
if latest_version is None:
return
latest_major, latest_minor, latest_bugfix = latest_version.split('.')
major, minor, bugfix = NODE_LAUNCHER_RELEASE.split('.')
major_upgrade = latest_major > major
minor_upgrade = (latest_major == major
and latest_minor > minor)
bugfix_upgrade = (latest_major == major
and latest_minor == minor
and latest_bugfix > bugfix)
if major_upgrade or minor_upgrade or bugfix_upgrade:
message_box = QMessageBox()
message_box.setTextFormat(Qt.RichText)
message_box.setText(UPGRADE)
message_box.setInformativeText(
f'Your version: {NODE_LAUNCHER_RELEASE}\n'
f'New version: {latest_version}'
)
message_box.exec_()
示例4: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例5: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例6: confirm_dialog
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def confirm_dialog(self, msg, title='Title'):
dialog = QtWidgets.QMessageBox()
dialog.setIcon(QtWidgets.QMessageBox.Question)
result = dialog.question(self.parent_wdg,
title,
msg,
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No
)
if result == QtWidgets.QMessageBox.Yes:
return True
else:
return False
示例7: warn_dialog
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def warn_dialog(self, msg, detail=None):
dialog = QtWidgets.QMessageBox()
dialog.setIcon(QtWidgets.QMessageBox.Warning)
# dialog.setModal(1)
dialog.setWindowTitle('Warning')
dialog.setText(msg)
if detail:
dialog.setDetailedText(detail)
dialog.exec_()
示例8: info_dialog
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def info_dialog(self, msg, title='Info'):
dialog = QtWidgets.QMessageBox()
dialog.setIcon(QtWidgets.QMessageBox.Information)
dialog.setWindowTitle(title)
dialog.setText(msg)
dialog.exec_()
示例9: handle_delete_action
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def handle_delete_action(self):
keys = []
for item in list(self.table.selectedItems()):
keys.append(self.table.item(item.row(), 1).text())
if keys:
self.delete_popup = QMessageBox()
self.delete_popup.setWindowTitle('Confirm deletion')
self.delete_popup.setText('Are you sure you want to delete ' + ', '.join(keys) + '?')
self.delete_popup.show()
self.delete_popup.buttonClicked.connect(self.handle_confirm_deletion)
示例10: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def quickMsg(self, msg, block=1, ask=0):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
if ask==0:
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
else:
tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
if block:
value = tmpMsg.exec_()
if value == QtWidgets.QMessageBox.Ok:
return 1
else:
return 0
else:
tmpMsg.show()
return 0
示例11: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例12: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def quickMsg(self, msg):
tmpMsg = QtWidgets.QMessageBox() # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
tmpMsg.setText(msg)
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
tmpMsg.exec_()
示例13: default_message
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def default_message(self, ui_name):
msgName = ui_name[:-7]+"_msg"
msg_txt = msgName + " is not defined in uiList."
if msgName in self.uiList:
msg_txt = self.uiList[msgName]
tmpMsg = QtWidgets.QMessageBox()
tmpMsg.setWindowTitle("Info")
tmpMsg.setText(msg_txt)
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
tmpMsg.exec_()
示例14: info_msg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def info_msg(text, title="Information"):
"""
Message box
:param text: Text to display
:param title: Name of the window
"""
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Information)
msg.setText(text)
msg.setWindowTitle(title)
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
return msg.exec_()
示例15: warning_msg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QMessageBox [as 別名]
def warning_msg(text, title="Warning"):
"""
Message box
:param text: Text to display
:param title: Name of the window
"""
msg = QtWidgets.QMessageBox()
msg.setIcon(QtWidgets.QMessageBox.Warning)
msg.setText(text)
msg.setWindowTitle(title)
msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
return msg.exec_()