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


Python QMessageBox.setWindowTitle方法代码示例

本文整理汇总了Python中qtpy.QtWidgets.QMessageBox.setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox.setWindowTitle方法的具体用法?Python QMessageBox.setWindowTitle怎么用?Python QMessageBox.setWindowTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtWidgets.QMessageBox的用法示例。


在下文中一共展示了QMessageBox.setWindowTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: validate_password

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
    def validate_password(self):
        """
        If the widget is ```passwordProtected```, this method will propmt
        the user for the correct password.

        Returns
        -------
        bool
            True in case the password was correct of if the widget is not
            password protected.
        """
        if not self._password_protected:
            return True

        pwd, ok = QInputDialog().getText(None, "Authentication", "Please enter your password:",
                                         QLineEdit.Password, "")
        pwd = str(pwd)
        if not ok or pwd == "":
            return False

        sha = hashlib.sha256()
        sha.update(pwd.encode())
        pwd_encrypted = sha.hexdigest()
        if pwd_encrypted != self._protected_password:
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Critical)
            msg.setText("Invalid password.")
            msg.setWindowTitle("Error")
            msg.setStandardButtons(QMessageBox.Ok)
            msg.setDefaultButton(QMessageBox.Ok)
            msg.setEscapeButton(QMessageBox.Ok)
            msg.exec_()
            return False
        return True
开发者ID:slaclab,项目名称:pydm,代码行数:36,代码来源:pushbutton.py

示例2: show_error_message

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
def show_error_message(message, title, parent=None):

    box = QMessageBox(parent=parent)
    box.setIcon(QMessageBox.Warning)
    box.setText(message)
    box.setWindowTitle(title)
    box.setStandardButtons(QMessageBox.Ok)
    box.exec_()
开发者ID:spacetelescope,项目名称:cube-tools,代码行数:10,代码来源:common.py

示例3: show_compatibility_message

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
 def show_compatibility_message(self, message):
     """Show compatibility message."""
     messageBox = QMessageBox(self)
     messageBox.setWindowModality(Qt.NonModal)
     messageBox.setAttribute(Qt.WA_DeleteOnClose)
     messageBox.setWindowTitle('Compatibility Check')
     messageBox.setText(message)
     messageBox.setStandardButtons(QMessageBox.Ok)
     messageBox.show()
开发者ID:cfanpc,项目名称:spyder,代码行数:11,代码来源:plugins.py

示例4: display_message_box

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
 def display_message_box(self, title, message, details):
     msg = QMessageBox(self)
     msg.setIcon(QMessageBox.Warning)
     msg.setText(message)
     msg.setWindowTitle(title)
     msg.setDetailedText(details)
     msg.setStandardButtons(QMessageBox.Ok)
     msg.setDefaultButton(QMessageBox.Ok)
     msg.setEscapeButton(QMessageBox.Ok)
     msg.exec_()
开发者ID:mantidproject,项目名称:mantid,代码行数:12,代码来源:errorreport.py

示例5: permission_box_to_prepend_import

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
def permission_box_to_prepend_import():
    msg_box = QMessageBox()
    msg_box.setWindowTitle("Mantid Workbench")
    msg_box.setWindowIcon(QIcon(':/images/MantidIcon.ico'))
    msg_box.setText("It looks like this python file uses a Mantid "
                    "algorithm but does not import the Mantid API.")
    msg_box.setInformativeText("Would you like to add a line to import "
                               "the Mantid API?")
    msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    msg_box.setDefaultButton(QMessageBox.Yes)
    permission = msg_box.exec_()
    if permission == QMessageBox.Yes:
        return True
    return False
开发者ID:mantidproject,项目名称:mantid,代码行数:16,代码来源:scriptcompatibility.py

示例6: show_mongo_query_help

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
    def show_mongo_query_help(self):
        "Launch a Message Box with instructions for custom queries."
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText("For advanced search capability, enter a valid Mongo query.")
        msg.setInformativeText("""
Examples:

{'plan_name': 'scan'}
{'proposal': 1234},
{'$and': ['proposal': 1234, 'sample_name': 'Ni']}
""")
        msg.setWindowTitle("Custom Mongo Query")
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()
开发者ID:CJ-Wright,项目名称:bluesky-browser,代码行数:17,代码来源:search.py

示例7: on_exception

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
    def on_exception(self, exception):
        """
        Called when the `QThread` runs into an exception.
        Parameters
        ----------
        exception : Exception
            The Exception that interrupted the `QThread`.
        """
        self.smooth_button.setEnabled(True)
        self.cancel_button.setEnabled(True)

        info_box = QMessageBox(parent=self)
        info_box.setWindowTitle("Smoothing Error")
        info_box.setIcon(QMessageBox.Critical)
        info_box.setText(str(exception))
        info_box.setStandardButtons(QMessageBox.Ok)
        info_box.show()
开发者ID:nmearl,项目名称:specviz,代码行数:19,代码来源:smoothing_dialog.py

示例8: MainWindow

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]

#.........这里部分代码省略.........
            self.ui.label_Ei_2.show()
            self.ui.comboBox_corrWS.show()
            self.ui.pushButton_refreshCorrWSList.show()

            # Search for table workspace
            self._searchTableWorkspaces()

        else:
            self.ui.label_Ei_2.hide()
            self.ui.comboBox_corrWS.hide()
            self.ui.pushButton_refreshCorrWSList.hide()

    def _searchTableWorkspaces(self):
        """ Search table workspaces and add to 'comboBox_corrWS'
        """
        wsnames = AnalysisDataService.getObjectNames()

        tablewsnames = []
        for wsname in wsnames:
            wksp = AnalysisDataService.retrieve(wsname)
            if isinstance(wksp, mantid.api.ITableWorkspace):
                tablewsnames.append(wsname)
        # ENDFOR

        self.ui.comboBox_corrWS.clear()
        if len(tablewsnames) > 0:
            self.ui.comboBox_corrWS.addItems(tablewsnames)

    def _setErrorMsg(self, errmsg):
        """ Clear error message
        """
        self._errMsgWindow = QMessageBox()
        self._errMsgWindow.setIcon(QMessageBox.Critical)
        self._errMsgWindow.setWindowTitle('Error')
        self._errMsgWindow.setStandardButtons(QMessageBox.Ok)
        self._errMsgWindow.setText(errmsg)
        result = self._errMsgWindow.exec_()

        return result

    def helpClicked(self):
        try:
            from pymantidplot.proxies import showCustomInterfaceHelp
            showCustomInterfaceHelp("Filter Events")
        except ImportError:
            url = ("http://docs.mantidproject.org/nightly/interfaces/{}.html"
                   "".format("Filter Events"))
            QDesktopServices.openUrl(QUrl(url))

    def _resetGUI(self, resetfilerun=False):
        """ Reset GUI including all text edits and etc.
        """
        if resetfilerun is True:
            self.ui.lineEdit.clear()

        # Plot related
        self.ui.lineEdit_3.clear()
        self.ui.lineEdit_4.clear()
        self.ui.horizontalSlider.setValue(0)
        self.ui.horizontalSlider_2.setValue(100)

        self.ui.lineEdit_outwsname.clear()
        self.ui.lineEdit_title.clear()

        # Filter by log value
        self.ui.lineEdit_5.clear()
开发者ID:mantidproject,项目名称:mantid,代码行数:70,代码来源:eventFilterGUI.py

示例9: AbortWindow

# 需要导入模块: from qtpy.QtWidgets import QMessageBox [as 别名]
# 或者: from qtpy.QtWidgets.QMessageBox import setWindowTitle [as 别名]
class AbortWindow(QDialog):
    """
    Displays busy message and provides abort button.
    The class serves SmoothCube, WorkerThread and SelectSmoothing.
    """

    def __init__(self, parent=None):
        """
        init abort or notification ui.
        Displays while smoothing freezes the application.
        Allows abort button to be added if needed.
        """
        super(AbortWindow, self).__init__(parent)
        self.setModal(False)
        self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)

        self.parent = parent

        self.label_a_1 = QLabel("Executing smoothing algorithm.")
        self.label_a_2 = QLabel("This may take several minutes.")

        self.abort_button = QPushButton("Abort")
        self.abort_button.clicked.connect(self.abort)

        self.pb = QProgressBar(self)
        self.pb_counter = 0

        self.abort_flag = False

        self.info_box = None

        # vbl is short for Vertical Box Layout
        vbl = QVBoxLayout()
        vbl.addWidget(self.label_a_1)
        vbl.addWidget(self.label_a_2)
        vbl.addWidget(self.pb)
        vbl.addWidget(self.abort_button)

        self.setLayout(vbl)

        self.show()

    def init_pb(self, start, end):
        """
        Init the progress bar
        :param start: Start Value
        :param end: End Value
        """
        self.pb.setRange(start, end)
        self.pb_counter = start

    def update_pb(self):
        """
        This function is called in the worker thread to
        update the progress bar and checks if the
        local class variable abort_flag is active.

        If the abort button is clicked, the main thread
        will set abort_flag to True. The next time the
        worker thread calls this function, a custom
        exception is raised terminating the calculation.
        The exception is handled by the WorkerThread class.
        :raises: AbortException: terminating smoothing calculation
        """
        if self.abort_flag:
            raise AbortException("Abort Calculation")
        self.pb_counter += 1
        self.pb.setValue(self.pb_counter)
        QApplication.processEvents()

    def abort(self):
        """Abort calculation"""
        self.abort_flag = True
        self.parent.clean_up()

    def show_error_message(self, message, title, parent=None):
        self.info_box = QMessageBox(parent=parent)
        self.info_box.setIcon(QMessageBox.Information)
        self.info_box.setText(message)
        self.info_box.setWindowTitle(title)
        self.info_box.setStandardButtons(QMessageBox.Ok)
        self.info_box.show()

    def smoothing_done(self, component_id=None):
        """Notify user success"""
        self.hide()
        if component_id is None:
            message = "The result has been added as a" \
                      " new component of the input Data." \
                      " The new component can be accessed" \
                      " in the viewer drop-downs."
        else:
            message = "The result has been added as" \
                      " \"{0}\" and can be selected" \
                      " in the viewer drop-down menu.".format(component_id)

        self.show_error_message(message, "Success", self)
        self.clean_up()

    def print_error(self, exception):
#.........这里部分代码省略.........
开发者ID:spacetelescope,项目名称:cube-tools,代码行数:103,代码来源:smoothing.py


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