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


Python QtGui.QMessageBox方法代码示例

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


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

示例1: run

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def run():
    sel = Gui.Selection.getSelectionEx()
    try:
        if len(sel) != 1:
            raise Exception("Select one face only.")
        try:
            App.ActiveDocument.openTransaction("Macro IsoCurve")
            selfobj = makeIsoCurveFeature()
            so = sel[0].SubObjects[0]
            p = sel[0].PickedPoints[0]
            poe = so.distToShape(Part.Vertex(p))
            par = poe[2][0][2]
            selfobj.Face = [sel[0].Object,sel[0].SubElementNames]
            selfobj.Parameter = par[0]
            selfobj.Proxy.execute(selfobj)
        finally:
            App.ActiveDocument.commitTransaction()
    except Exception as err:
        from PySide import QtGui
        mb = QtGui.QMessageBox()
        mb.setIcon(mb.Icon.Warning)
        mb.setText("{0}".format(err))
        mb.setWindowTitle("Macro IsoCurve")
        mb.exec_() 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:26,代码来源:IsoCurve2.py

示例2: version_check_done

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def version_check_done(self, version):
        self.version_thread.quit()

        if version and __version__ != version:
            version_box = QtGui.QMessageBox(self)
            version_box.setWindowTitle("New version available!")
            version_box.setText(
                "You have version '{}', but there's a new version available: '{}'.".format(__version__, version)
            )
            version_box.addButton("Download now", QtGui.QMessageBox.AcceptRole)
            version_box.addButton("Remind me later", QtGui.QMessageBox.RejectRole)
            ret = version_box.exec_()

            if ret == QtGui.QMessageBox.AcceptRole:
                QtGui.QDesktopServices.openUrl(
                    QtCore.QUrl("https://github.com/farshield/shortcircuit/releases/tag/{}".format(version))
                )

    # event: QCloseEvent 
开发者ID:farshield,项目名称:shortcircuit,代码行数:21,代码来源:app.py

示例3: confirmBox

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def confirmBox( text ):
    msgBox = QtGui.QMessageBox()
    msgBox.setWindowTitle('FreeCAD Warning')
    msgBox.setIcon(QtGui.QMessageBox.Warning)
    msgBox.setText(text)
    msgBox.setInformativeText('Are you sure you want to proceed ?')
    msgBox.setStandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)
    msgBox.setEscapeButton(QtGui.QMessageBox.Cancel)
    msgBox.setDefaultButton(QtGui.QMessageBox.Ok)
    retval = msgBox.exec_()
    # Cancel = 4194304
    # Ok = 1024
    if retval == 1024:
        # user confirmed
        return True
    # anything else than OK
    return False 
开发者ID:Zolko-123,项目名称:FreeCAD_Assembly4,代码行数:19,代码来源:libAsm4.py

示例4: quickMsg

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui 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 PySide import QtGui [as 别名]
# 或者: from PySide.QtGui 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: update_protocols

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def update_protocols(self):
        """
        If we change the protocol file, update the stored version in subject files
        """
        #
        # get list of protocol files
        protocols = os.listdir(prefs.PROTOCOLDIR)
        protocols = [p for p in protocols if p.endswith('.json')]


        subjects = self.list_subjects()
        for subject in subjects:
            if subject not in self.subjects.keys():
                self.subjects[subject] = Subject(subject)

            protocol_bool = [self.subjects[subject].protocol_name == p.rstrip('.json') for p in protocols]
            if any(protocol_bool):
                which_prot = np.where(protocol_bool)[0][0]
                protocol = protocols[which_prot]
                self.subjects[subject].assign_protocol(os.path.join(prefs.PROTOCOLDIR, protocol), step_n=self.subjects[subject].step)

        msgbox = QtGui.QMessageBox()
        msgbox.setText("Subject Protocols Updated")
        msgbox.exec_() 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:26,代码来源:terminal.py

示例7: calibrate_ports

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def calibrate_ports(self):

        calibrate_window = Calibrate_Water(self.pilots)
        calibrate_window.exec_()

        if calibrate_window.result() == 1:
            for pilot, p_widget in calibrate_window.pilot_widgets.items():
                p_results = p_widget.volumes
                # p_results are [port][dur] = {params} so running the same duration will
                # overwrite a previous run. unnest here so pi can keep a record
                unnested_results = {}
                for port, result in p_results.items():
                    unnested_results[port] = []
                    # result is [dur] = {params}
                    for dur, inner_result in result.items():
                        inner_result['dur'] = dur
                        unnested_results[port].append(inner_result)

                # send to pi
                self.node.send(to=pilot, key="CALIBRATE_RESULT",
                               value = unnested_results)

            msgbox = QtGui.QMessageBox()
            msgbox.setText("Calibration results sent!")
            msgbox.exec_() 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:27,代码来源:terminal.py

示例8: remove_subject

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def remove_subject(self):
        """
        Remove the currently selected subject in :py:attr:`Pilot_Panel.subject_list`,
        and calls the :py:meth:`Control_Panel.update_db` method.
        """

        current_subject = self.subject_list.currentItem().text()
        msgbox = QtGui.QMessageBox()
        msgbox.setText("\n(only removes from pilot_db.json, data will not be deleted)".format(current_subject))

        msgBox = QtGui.QMessageBox()
        msgBox.setText("Are you sure you would like to remove {}?".format(current_subject))
        msgBox.setInformativeText("'Yes' only removes from pilot_db.json, data will not be deleted")
        msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
        msgBox.setDefaultButton(QtGui.QMessageBox.No)
        ret = msgBox.exec_()

        if ret == QtGui.QMessageBox.Yes:

            self.subject_list.takeItem(self.subject_list.currentRow())
            # the drop fn updates the db
            self.subject_list.drop_fn() 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:24,代码来源:gui.py

示例9: save

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def save(self):
        """
        Select save file location for test results (csv) and then save them there

        """

        fileName, filtr = QtGui.QFileDialog.getSaveFileName(self,
                "Where should we save these results?",
                prefs.DATADIR,
                "CSV files (*.csv)", "")

        # make and save results df
        try:
            res_df = pd.DataFrame.from_records(self.results,
                                               columns=['rate', 'payload_size', 'message_size', 'n_messages', 'confirm',
                                                        'n_pilots', 'mean_delay', 'drop_rate',
                                                        'actual_rate', 'send_jitter', 'delay_jitter'])

            res_df.to_csv(fileName)
            reply = QtGui.QMessageBox.information(self,
                                                  "Results saved!", "Results saved to {}".format(fileName))

        except Exception as e:
            reply = QtGui.QMessageBox.critical(self, "Error saving",
                                               "Error while saving your results:\n{}".format(e)) 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:27,代码来源:gui.py

示例10: run

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def run():
    f = Gui.Selection.Filter("SELECT Part::Feature SUBELEMENT Face COUNT 1..1000")
    try:
        if not f.match():
            raise Exception("Select at least one face.")
        try:
            App.ActiveDocument.openTransaction("Macro IsoCurve")
            r = f.result()
            for e in r:
                for s in e:
                    for f in s.SubElementNames:
                        #App.ActiveDocument.openTransaction("Macro IsoCurve")
                        selfobj = makeIsoCurveFeature()
                        #so = sel[0].SubObjects[0]
                        #p = sel[0].PickedPoints[0]
                        #poe = so.distToShape(Part.Vertex(p))
                        #par = poe[2][0][2]
                        #selfobj.Face = [sel[0].Object,sel[0].SubElementNames]
                        selfobj.Face = [s.Object,f]
                        #selfobj.Parameter = par[0]
                        selfobj.Proxy.execute(selfobj)
        finally:
            App.ActiveDocument.commitTransaction()
    except Exception as err:
        from PySide import QtGui
        mb = QtGui.QMessageBox()
        mb.setIcon(mb.Icon.Warning)
        mb.setText("{0}".format(err))
        mb.setWindowTitle("Macro IsoCurve")
        mb.exec_() 
开发者ID:tomate44,项目名称:CurvesWB,代码行数:32,代码来源:IsoCurve.py

示例11: Activated

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def Activated(self):
    import polarUtilsCmd as puc
    import FreeCAD, FreeCADGui
    from PySide import QtGui as qg
    if (FreeCADGui.Selection.countObjectsOfType('Sketcher::SketchObject')==0):
      qg.QMessageBox().information(None,'Incorrect input','First select at least one sketch.')
    else:
      n=int(qg.QInputDialog.getText(None,"draw a Polygon","Number of sides?")[0])
      R=float(qg.QInputDialog.getText(None,"draw a Polygon","Radius of circumscribed circle?")[0])
      for sk in FreeCADGui.Selection.getSelection():
        if sk.TypeId=="Sketcher::SketchObject":
          puc.disegna(sk,puc.cerchio(R,n)) 
开发者ID:oddtopus,项目名称:flamingo,代码行数:14,代码来源:CommandsPolar.py

示例12: _message_box

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def _message_box(self, title, text):
        msg_box = QtGui.QMessageBox(self)
        msg_box.setWindowTitle(title)
        msg_box.setText(text)
        return msg_box.exec_() 
开发者ID:farshield,项目名称:shortcircuit,代码行数:7,代码来源:app.py

示例13: btn_reset_clicked

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def btn_reset_clicked(self):
        msg_box = QtGui.QMessageBox(self)
        msg_box.setWindowTitle("Reset chain")
        msg_box.setText("Are you sure you want to clear all Tripwire data?")
        msg_box.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
        msg_box.setDefaultButton(QtGui.QMessageBox.No)
        ret = msg_box.exec_()

        if ret == QtGui.QMessageBox.Yes:
            self.nav.reset_chain()
            self._trip_message("Not connected to Tripwire, yet", MainWindow.MSG_INFO) 
开发者ID:farshield,项目名称:shortcircuit,代码行数:13,代码来源:app.py

示例14: warningBox

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QMessageBox [as 别名]
def warningBox( text ):
    msgBox = QtGui.QMessageBox()
    msgBox.setWindowTitle( 'FreeCAD Warning' )
    msgBox.setIcon( QtGui.QMessageBox.Critical )
    msgBox.setText( text )
    msgBox.exec_()
    return 
开发者ID:Zolko-123,项目名称:FreeCAD_Assembly4,代码行数:9,代码来源:libAsm4.py

示例15: quickMsg

# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui 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


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