当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QMessageBox方法代码示例

本文整理汇总了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 
开发者ID:jtomori,项目名称:batch_textures_convert,代码行数:27,代码来源:gui.py

示例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) 
开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:27,代码来源:except_hook.py

示例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_() 
开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:27,代码来源:application.py

示例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() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:26,代码来源:universal_tool_template_1115.py

示例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() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:24,代码来源:universal_tool_template_1112.py

示例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 
开发者ID:wiremas,项目名称:spore,代码行数:17,代码来源:message_utils.py

示例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_() 
开发者ID:wiremas,项目名称:spore,代码行数:13,代码来源:message_utils.py

示例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_() 
开发者ID:wiremas,项目名称:spore,代码行数:10,代码来源:message_utils.py

示例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) 
开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:13,代码来源:configuration.py

示例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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:34,代码来源:universal_tool_template_1116.py

示例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() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:13,代码来源:universal_tool_template_1020.py

示例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_() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:8,代码来源:UITranslator.py

示例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_() 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:12,代码来源:universal_tool_template_0803.py

示例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_() 
开发者ID:SanPen,项目名称:GridCal,代码行数:14,代码来源:messages.py

示例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_() 
开发者ID:SanPen,项目名称:GridCal,代码行数:14,代码来源:messages.py


注:本文中的PySide2.QtWidgets.QMessageBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。