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


Python QMessageBox.exec_方法代码示例

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


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

示例1: __init__

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
    def __init__(self, context):
        super(NodeManager, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('NodeManagerFKIE')

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-q", "--quiet", action="store_true",
                      dest="quiet",
                      help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns
        node_manager_fkie.init_settings()
        masteruri = node_manager_fkie.settings().masteruri()
        node_manager_fkie.init_globals(masteruri)
        # Create QWidget
        try:
          self._widget = MainWindow()
#          self._widget.read_view_history()
        except Exception, e:
          msgBox = QMessageBox()
          msgBox.setText(str(e))
          msgBox.exec_()
          raise
开发者ID:garyservin,项目名称:multimaster_fkie,代码行数:30,代码来源:rqt_node_manager.py

示例2: on_power_on

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def on_power_on(self):
     try:
         power = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/power", OpenHRP_RobotHardwareService_power)
         power(OpenHRP_RobotHardwareService_powerRequest("all", 0))
     except Exception, e:
         mb = QMessageBox(QMessageBox.NoIcon, "Error", "Failed to power on: %s" % (e), QMessageBox.Ok, self.parent())
         mb.exec_()
开发者ID:oshiroy,项目名称:rtmros_common,代码行数:9,代码来源:hrpsys_dashboard.py

示例3: _showWarning

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def _showWarning(self, title, body):
     if threading.current_thread().name != "MainThread":
         rospy.logwarn("{}: {}".format(title, body))
     else:
         msg = QMessageBox()
         msg.setIcon(QMessageBox.Warning)
         msg.setWindowTitle(title)
         msg.setText(body)
         msg.setStandardButtons(QMessageBox.Ok)
         msg.exec_()
开发者ID:HLP-R,项目名称:hlpr_kinesthetic_teaching,代码行数:12,代码来源:kinesthetic_teaching_widget.py

示例4: show

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
    def show(self):
        # append folder of 'qt_gui_cpp/lib' to module search path
        qt_gui_cpp_path = os.path.realpath(get_package_path("qt_gui_cpp"))
        sys.path.append(os.path.join(qt_gui_cpp_path, "lib"))
        sys.path.append(os.path.join(qt_gui_cpp_path, "src"))
        from qt_gui_cpp.cpp_binding_helper import qt_gui_cpp

        import rospkg

        _rospkg_version = getattr(rospkg, "__version__", "< 0.2.4")

        logo = os.path.join(self._qtgui_path, "resource", "ros_org_vertical.png")
        text = '<img src="%s" width="56" height="200" style="float: left;"/>' % logo

        text += '<h3 style="margin-top: 1px;">%s</h3>' % self.tr("rqt")

        text += "<p>%s %s</p>" % (
            self.tr("rqt is a framework for graphical user interfaces."),
            self.tr("It is extensible with plugins which can be written in either Python or C++."),
        )
        text += "<p>%s</p>" % (
            self.tr(
                'Please see the <a href="%s">Wiki</a> for more information on rqt and available plugins.'
                % "http://wiki.ros.org/rqt"
            )
        )

        text += "<p>%s: " % self.tr("Utilized libraries:")

        text += "Python %s, " % platform.python_version()

        text += "rospkg %s, " % _rospkg_version

        if QT_BINDING == "pyside":
            text += "PySide"
        elif QT_BINDING == "pyqt":
            text += "PyQt"
        text += " %s (%s), " % (QT_BINDING_VERSION, ", ".join(sorted(QT_BINDING_MODULES)))

        text += "Qt %s, " % qVersion()

        if qt_gui_cpp is not None:
            if QT_BINDING == "pyside":
                text += "%s" % (self.tr("%s C++ bindings available") % "Shiboken")
            elif QT_BINDING == "pyqt":
                text += "%s" % (self.tr("%s C++ bindings available") % "SIP")
            else:
                text += "%s" % self.tr("C++ bindings available")
        else:
            text += "%s" % self.tr("no C++ bindings found - no C++ plugins available")

        text += ".</p>"

        mb = QMessageBox(QMessageBox.NoIcon, self.tr("About rqt"), text, QMessageBox.Ok, self.parent())
        mb.exec_()
开发者ID:ethz-asl,项目名称:qt_gui_core,代码行数:57,代码来源:about_handler.py

示例5: on_download

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def on_download(self):
   try:
     hrpsys_save = rospy.ServiceProxy("/DataLoggerServiceROSBridge/save", OpenHRP_DataLoggerService_save )
     name = "/tmp/rtclog-" + time.strftime("%Y%m%d%H%M%S")
     print "Writing log data to ",name
     hrpsys_save(OpenHRP_DataLoggerService_saveRequest(name))
     print "Done writing",name
   except rospy.ServiceException, e:
     mb = QMessageBox(QMessageBox.NoIcon, "Error",
                      "Failed to save rtcd log: service call failed with error: %s"%(e),
                      QMessageBox.Ok, self.parent())
     mb.exec_()
开发者ID:kindsenior,项目名称:rtmros_common,代码行数:14,代码来源:hrpsys_dashboard.py

示例6: DialogService

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
class DialogService(QWidget):
    '''
    Provides popup windows for information and error messages 
    '''

    #----------------------------------
    # Initializer
    #--------------

    def __init__(self, parent=None):
        super(DialogService, self).__init__(parent);
        
        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>), 
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
	    # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler();
       	# Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags());
        #self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        self.infoMsg = QMessageBox(parent=parent);
        #self.infoMsg.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
    
    #----------------------------------
    # showErrorMsg
    #--------------
    QErrorMessage
    def showErrorMsg(self,errMsg):
        '''
        Given a string, pop up an error dialog on top of the application window.
        @param errMsg: The message
        @type errMsg: string
        '''
        self.errorMsgPopup.showMessage(errMsg);
    
    #----------------------------------
    # showInfoMsg 
    #--------------

    def showInfoMsg(self, text):
        '''
        Display a message window with an OK button on top of the application window.
        @param text: text to display
        @type text: string
        '''
        self.infoMsg.setText(text);
        self.infoMsg.exec_();        
开发者ID:ros-visualization,项目名称:robhum_ui_utils,代码行数:51,代码来源:proser.py

示例7: on_servo_off

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def on_servo_off(self):
   try:
     if self.stop_command:
       Popen(['bash', '-c', self.stop_command])
     else:
       power = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/power", OpenHRP_RobotHardwareService_power )
       servo = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/servo", OpenHRP_RobotHardwareService_servo )
       servo(OpenHRP_RobotHardwareService_servoRequest("all", 1))
       time.sleep(1)
       power(OpenHRP_RobotHardwareService_powerRequest("all",1))
   except Exception, e:
     mb = QMessageBox(QMessageBox.NoIcon, "Error",
                      "Failed to servo off: %s"%(e),
                      QMessageBox.Ok, self.parent())
     mb.exec_()
开发者ID:130s,项目名称:rtmros_common,代码行数:17,代码来源:hrpsys_dashboard.py

示例8: on_servo_off

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def on_servo_off(self):
     try:
         if self.stop_command:
             Popen(["bash", "-c", self.stop_command])
         elif self.use_hrpsys_configurator:
             execHrpsysConfiguratorCommand("hcf.servoOff()")
         else:
             power = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/power", OpenHRP_RobotHardwareService_power)
             servo = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/servo", OpenHRP_RobotHardwareService_servo)
             servo(OpenHRP_RobotHardwareService_servoRequest("all", 1))
             time.sleep(1)
             power(OpenHRP_RobotHardwareService_powerRequest("all", 1))
     except Exception, e:
         mb = QMessageBox(
             QMessageBox.NoIcon, "Error", "Failed to servo off: %s" % (e), QMessageBox.Ok, self.parent()
         )
         mb.exec_()
开发者ID:oshiroy,项目名称:rtmros_common,代码行数:19,代码来源:hrpsys_dashboard.py

示例9: on_servo_on

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def on_servo_on(self):
   try:
     if self.start_command:
       Popen(['bash', '-c', self.start_command])
     else:
       servo = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/servo", OpenHRP_RobotHardwareService_servo )
       power = rospy.ServiceProxy("/RobotHardwareServiceROSBridge/power", OpenHRP_RobotHardwareService_power )
       actual = rospy.ServiceProxy("/StateHolderServiceROSBridge/goActual", OpenHRP_StateHolderService_goActual )
       power(OpenHRP_RobotHardwareService_powerRequest("all",0))
       time.sleep(1)
       actual(OpenHRP_StateHolderService_goActualRequest())
       time.sleep(2)
       servo(OpenHRP_RobotHardwareService_servoRequest("all",0))
   except Exception, e:
     mb = QMessageBox(QMessageBox.NoIcon, "Error",
                      "Failed to servo on: %s"%(e),
                      QMessageBox.Ok, self.parent())
     mb.exec_()
开发者ID:130s,项目名称:rtmros_common,代码行数:20,代码来源:hrpsys_dashboard.py

示例10: RosPyPluginProvider

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
class RosPyPluginProvider(CompositePluginProvider):

    _master_found_signal = Signal(int)

    def __init__(self):
        super(RosPyPluginProvider, self).__init__([RospkgPluginProvider('rqt_gui', 'rqt_gui_py::Plugin')])
        self.setObjectName('RosPyPluginProvider')
        self._node_initialized = False
        self._wait_for_master_dialog = None
        self._wait_for_master_thread = None

    def load(self, plugin_id, plugin_context):
        self._check_for_master()
        self._init_node()
        return super(RosPyPluginProvider, self).load(plugin_id, plugin_context)

    def _check_for_master(self):
        # check if master is available
        try:
            rospy.get_master().getSystemState()
            return
        except Exception:
            pass
        # spawn thread to detect when master becomes available
        self._wait_for_master_thread = threading.Thread(target=self._wait_for_master)
        self._wait_for_master_thread.start()
        self._wait_for_master_dialog = QMessageBox(QMessageBox.Question, self.tr('Waiting for ROS master'), self.tr("Could not find ROS master. Either start a 'roscore' or abort loading the plugin."), QMessageBox.Abort)
        self._master_found_signal.connect(self._wait_for_master_dialog.done, Qt.QueuedConnection)
        button = self._wait_for_master_dialog.exec_()
        # check if master existence was not detected by background thread
        no_master = button != QMessageBox.Ok
        self._wait_for_master_dialog.deleteLater()
        self._wait_for_master_dialog = None
        if no_master:
            raise PluginLoadError('RosPyPluginProvider._init_node() could not find ROS master')

    def _wait_for_master(self):
        while True:
            time.sleep(0.1)
            if not self._wait_for_master_dialog:
                break
            try:
                rospy.get_master().getSystemState()
            except Exception:
                continue
            self._master_found_signal.emit(QMessageBox.Ok)
            break

    def _init_node(self):
        # initialize node once
        if not self._node_initialized:
            name = 'rqt_gui_py_node_%d' % os.getpid()
            qDebug('RosPyPluginProvider._init_node() initialize ROS node "%s"' % name)
            rospy.init_node(name, disable_signals=True)
            self._node_initialized = True
开发者ID:NhatTanXT3,项目名称:humanoid_op_ros,代码行数:57,代码来源:ros_py_plugin_provider.py

示例11: newButtonSetOrUpdateCurrent

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
开发者ID:ros-visualization,项目名称:speakeasy,代码行数:25,代码来源:speakeasy_ui.py

示例12: DialogService

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
class DialogService(object):

    class ButtonSaveResult:
        UPDATE_CURRENT = 0;
        NEW_SET = 1;
        CANCEL = 2;
        

    #----------------------------------
    # Initializer
    #--------------

    def __init__(self, parent=None):
        
        # All-purpose error popup message:
        # Used by self.showErrorMsgByErrorCode(<errorCode>), 
        # or self.showErrorMsg(<string>). Returns a
        # QErrorMessage without parent, but with QWindowFlags set
	    # properly to be a dialog popup box:
        self.errorMsgPopup = QErrorMessage.qtHandler();
       	# Re-parent the popup, retaining the window flags set
        # by the qtHandler:
        self.errorMsgPopup.setParent(parent, self.errorMsgPopup.windowFlags());
        self.errorMsgPopup.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        
        self.infoMsg = QMessageBox(parent=parent);
        self.infoMsg.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
    
    #----------------------------------
    # showErrorMsg
    #--------------
    QErrorMessage
    def showErrorMsg(self,errMsg):
        '''
        Given a string, pop up an error dialog.
        @param errMsg: The message
        @type errMsg: string
        '''
        self.errorMsgPopup.showMessage(errMsg);
    
    #----------------------------------
    # showInfoMsg 
    #--------------

    def showInfoMessage(self, text):
        self.infoMsg.setText(text);
        self.infoMsg.exec_();        

    #----------------------------------
    # newButtonSetOrUpdateCurrent
    #--------------
    
    def newButtonSetOrUpdateCurrent(self):
        '''
        Asks user whether saving of button set is to be 
        to a new file, or an update to the current file.
        Cancel is offered as well.
        @return: ButtonSaveResult.NEW_SET, ButtonSaveResult.UPDATE_CURRENT, or ButtonSaveResult.CANCEL
        @rtype: DialogService.ButtonSaveResult
        '''
        msgBox = QMessageBox()
        msgBox.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        msgBox.setText('Create new button set, or update current set?')

        updateCurrButton   = QPushButton('Update current')
        msgBox.addButton(updateCurrButton, QMessageBox.NoRole)
        
        newSetButton   = QPushButton('Create new set')
        msgBox.addButton(newSetButton, QMessageBox.YesRole)
        
        cancelButton = QPushButton('Cancel');
        msgBox.addButton(cancelButton, QMessageBox.RejectRole)

        value = msgBox.exec_();
        return value;
开发者ID:ros-visualization,项目名称:speakeasy,代码行数:77,代码来源:speakeasy_ui.py

示例13: show_warning

# 需要导入模块: from python_qt_binding.QtGui import QMessageBox [as 别名]
# 或者: from python_qt_binding.QtGui.QMessageBox import exec_ [as 别名]
 def show_warning(self, text):
     qWarning(text)
     msgBox = QMessageBox()
     msgBox.setText(text)
     msgBox.exec_()
开发者ID:elimenta,项目名称:robotics_capstone_team4,代码行数:7,代码来源:simple_gui.py


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