• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python QtGui.QMessageBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: on_power_on

 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,代码行数:7,代码来源:hrpsys_dashboard.py


示例2: __init__

    def __init__(self, icon, title, text, detailed_text="", buttons=QMessageBox.Ok):
        QMessageBox.__init__(self, icon, title, text, buttons)
        if detailed_text:
            self.setDetailedText(detailed_text)
            horizontalSpacer = QSpacerItem(480, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
            layout = self.layout()
            layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1, layout.columnCount())

        if QMessageBox.Abort & buttons:
            self.setEscapeButton(QMessageBox.Abort)
        elif QMessageBox.Ignore & buttons:
            self.setEscapeButton(QMessageBox.Ignore)
        else:
            self.setEscapeButton(buttons)

        self.textEdit = textEdit = self.findChild(QTextEdit)
        if textEdit is not None:
            textEdit.setMinimumHeight(0)
            textEdit.setMaximumHeight(600)
            textEdit.setMinimumWidth(0)
            textEdit.setMaximumWidth(600)
            textEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.ignore_all_btn = QPushButton('Don\'t display again')
        self.addButton(self.ignore_all_btn, QMessageBox.HelpRole)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:25,代码来源:detailed_msg_box.py


示例3: __init__

    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,代码行数:28,代码来源:rqt_node_manager.py


示例4: on_save_motion_button_clicked

 def on_save_motion_button_clicked(self):
     motion_name = str(self.motion_name_combo.currentText())
     if len(motion_name) == 0:
         QMessageBox.warning(self, 'Error', 'No name given to save this motion.')
         return
     self._motion_data.save(motion_name, self.get_motion_from_timeline())
     self.update_motion_name_combo()
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:7,代码来源:motion_editor_widget.py


示例5: click_btn_apply

 def click_btn_apply(self):
     
     if self.validate_checked():
         quit_msg = "Are you sure you want to Apply this configuration?"
         reply = QMessageBox.question(self, 'Message', quit_msg, QMessageBox.Yes, QMessageBox.No)
         self.get_selected_robot_checked()
         if reply == QMessageBox.Yes:
             xml_info = XmlInfo()
             env_os = EnvOs()
             dialog_xml = DialogXml()
             deleted_general_items = xml_info.get_deleted_general_variable()  #get deleted general items (deleted status = 1 in xml)
             variable_general_items = xml_info.get_general_variables()
             dialog_xml.get_deleted_variable_robot()
             deleted_robots_items=dialog_xml.get_deleted_variable_robot()
             variable_robot_items,active_robot=dialog_xml.get_general_variable_robot()
             deleted_robot=dialog_xml.get_deleted_robot()
             asociative_variable_robot = dialog_xml.get_asociative_robot_variable()
             env_os.unset_to_htbash(deleted_robots_items+deleted_robots_items)
             env_os.export_to_general_htbash(variable_general_items)
             env_os.export_to_robot_htbash(variable_robot_items,active_robot)
             dialog_xml.remove_asociative_robot_variable(asociative_variable_robot)
             for item in deleted_robot:
                 dialog_xml.remove_robot_list_variable(item)
             for item in deleted_general_items:   
                 xml_info.remove_general_variable(item)   
             env_os.include_htbash()
             self.lblmsg.setText("write file .htbash successfully")
         else:
              pass
     else:
         QMessageBox.information(self, 'Checked validate',"You only must select one active robot")
开发者ID:hsarmiento,项目名称:rqt_env,代码行数:31,代码来源:env_widget.py


示例6: on_delete_motion_button_clicked

 def on_delete_motion_button_clicked(self):
     motion_name = str(self.motion_name_combo.currentText())
     if len(motion_name) == 0:
         QMessageBox.warning(self, 'Error', 'No motion selected to delete.')
         return
     if motion_name not in self._motion_data:
         QMessageBox.warning(self, 'Error', 'Motion "%s" not in motion list.' % motion_name)
         return
     self._motion_data.delete(motion_name)
     self.update_motion_name_combo()
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:10,代码来源:motion_editor_widget.py


示例7: on_move_button_clicked

 def on_move_button_clicked(self):
     position_name = str(self.move_name_combo.currentText())
     if len(position_name) == 0:
         QMessageBox.warning(self, 'Error', 'No position selected to move to.')
         return
     appendix_name = str(self.move_appendix_combo.currentText())
     target_positions = self._position_data[self.robot_config.groups[appendix_name].group_type][position_name]
     target_positions = self.robot_config.groups[appendix_name].adapt_to_side(target_positions)
     print '[Motion Editor] Moving %s to "%s": %s' % (appendix_name, position_name, target_positions)
     self._motion_publisher.move_to_position(appendix_name, target_positions)
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:10,代码来源:position_editor_widget.py


示例8: RosPyPluginProvider

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,代码行数:55,代码来源:ros_py_plugin_provider.py


示例9: show

    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,代码行数:55,代码来源:about_handler.py


示例10: on_run_motion_button_clicked

 def on_run_motion_button_clicked(self):
     motion_name = str(self.motion_name_combo.currentText())
     if len(motion_name) == 0:
         QMessageBox.warning(self, 'Error', 'No motion selected to run.')
         return
     if motion_name not in self._motion_data:
         QMessageBox.warning(self, 'Error', 'Motion "%s" not in motion list.' % motion_name)
         return
     self._clear_playback_marker()
     self._motion_publisher.publish_motion(self._motion_data[motion_name], self.time_factor_spin.value())
     print '[Motion Editor] Running motion:', motion_name
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:11,代码来源:motion_editor_widget.py


示例11: _send_comand_cb

	def _send_comand_cb(self):
		'''
			Sends a mission command
		'''
		msg = MissionCommand()	
		msg.command = self._widget.comboBox_command.currentText()
		
		try:
			msg.variable = float(self._widget.lineEdit_parameter.text().encode("utf8"))
		except ValueError, e:
			rospy.logerr('MissionCommanderGUI:_send_command_cb: %s',e)
			QMessageBox.warning(self._widget, 'Error', 'Incorrect format of the parameter. A number is expected')
开发者ID:RobospectEU,项目名称:robospect_mission_planner,代码行数:12,代码来源:rqt_mission_commander.py


示例12: on_download

 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,代码行数:12,代码来源:hrpsys_dashboard.py


示例13: on_delete_button_clicked

 def on_delete_button_clicked(self):
     appendix_name = str(self.save_appendix_combo.currentText())
     position_name = str(self.save_name_combo.currentText())
     if len(position_name) == 0 or \
        position_name not in self._position_data[self.robot_config.groups[appendix_name].group_type]:
         QMessageBox.warning(self, 'Error', 'Position "%s" not in position list.')
         return
     self._position_data[self.robot_config.groups[appendix_name].group_type].delete(position_name)
     self.position_list_updated.emit(self._position_data)
     self.on_save_appendix_combo_currentIndexChanged(appendix_name)
     if self.robot_config.groups[self.move_appendix_combo.currentText()].group_type \
        == self.robot_config.groups[appendix_name].group_type:
         self.on_move_appendix_combo_currentIndexChanged(appendix_name)
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:13,代码来源:position_editor_widget.py


示例14: on_saveButton_clicked

 def on_saveButton_clicked(self):
     '''
     Saves the current document. This method is called if the C{save button}
     was clicked.
     '''
     saved, errors, msg = self.tabWidget.currentWidget().save(True)
     if errors:
         QMessageBox.critical(self, "Error", msg)
         self.tabWidget.setTabIcon(self.tabWidget.currentIndex(), self._error_icon)
         self.tabWidget.setTabToolTip(self.tabWidget.currentIndex(), msg)
     elif saved:
         self.tabWidget.setTabIcon(self.tabWidget.currentIndex(), self._empty_icon)
         self.tabWidget.setTabToolTip(self.tabWidget.currentIndex(), '')
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:13,代码来源:editor.py


示例15: on_load_motion_button_clicked

 def on_load_motion_button_clicked(self):
     motion_name = str(self.motion_name_combo.currentText())
     if len(motion_name) == 0:
         QMessageBox.warning(self, 'Error', 'No motion selected to load.')
         return
     if motion_name not in self._motion_data:
         QMessageBox.warning(self, 'Error', 'Motion "%s" not in motion list.' % motion_name)
         return
     self.on_clear_motion_button_clicked()
     motion = self._motion_data[motion_name]
     for group_name, poses in motion.items():
         for pose in poses:
             data = self.robot_config.groups[group_name].adapt_to_side(pose['positions'])
             self._timeline_widget.scene().add_clip(group_name, pose['name'], pose['starttime'], pose['duration'], data)
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:14,代码来源:motion_editor_widget.py


示例16: DialogService

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,代码行数:49,代码来源:proser.py


示例17: on_servo_off

 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,代码行数:15,代码来源:hrpsys_dashboard.py


示例18: on_save_button_clicked

 def on_save_button_clicked(self):
     position_name = str(self.save_name_combo.currentText())
     if len(position_name) == 0:
         QMessageBox.warning(self, 'Error', 'No name given to save this position.')
         return
     appendix_name = str(self.save_appendix_combo.currentText())
     group = self.robot_config.groups[appendix_name]
     current_positions = self._motion_publisher.get_current_positions(group)
     current_positions = self.robot_config.groups[appendix_name].adapt_to_side(current_positions)
     print '[Motion Editor] Saving %s as "%s": %s' % (appendix_name, position_name, current_positions)
     self._position_data[self.robot_config.groups[appendix_name].group_type].save(position_name, current_positions)
     self.position_list_updated.emit(self._position_data)
     self.on_save_appendix_combo_currentIndexChanged(appendix_name)
     if self.robot_config.groups[self.move_appendix_combo.currentText()].group_type \
        == self.robot_config.groups[appendix_name].group_type:
         self.on_move_appendix_combo_currentIndexChanged(appendix_name)
开发者ID:tu-darmstadt-ros-pkg,项目名称:motion_editor,代码行数:16,代码来源:position_editor_widget.py


示例19: on_close_tab

 def on_close_tab(self, tab_index):
     '''
     Signal handling to close single tabs.
     @param tab_index: tab index to close
     @type tab_index: C{int}
     '''
     try:
         doremove = True
         w = self.tabWidget.widget(tab_index)
         if w.document().isModified():
             name = self.__getTabName(w.filename)
             result = QMessageBox.question(self, "Unsaved Changes", '\n\n'.join(["Save the file before closing?", name]), QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
             if result == QMessageBox.Yes:
                 self.tabWidget.currentWidget().save()
             elif result == QMessageBox.No:
                 pass
             else:
                 doremove = False
         if doremove:
             # remove the indexed files
             if w.filename in self.files:
                 self.files.remove(w.filename)
             # close tab
             self.tabWidget.removeTab(tab_index)
             # close editor, if no tabs are open
             if not self.tabWidget.count():
                 self.close()
     except:
         import traceback
         rospy.logwarn("Error while close tab %s: %s", str(tab_index), traceback.format_exc(1))
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:30,代码来源:editor.py


示例20: _reset_steering_encoder_cb

	def _reset_steering_encoder_cb(self):
		'''
			Resets the steering encoder
		'''
		msg = Empty()
		ret = QMessageBox.question(self._widget, "Reset Encoder", 'Are you sure of resetting the encoder?', QMessageBox.Ok, QMessageBox.Cancel)
		
		if ret == QMessageBox.Ok:
			try:
				self._reset_steering_encoder_service_client()
			except rospy.ROSInterruptException,e: 
				rospy.logerr('MissionCommanderGUI:_reset_steering_encoder_cb: %s',e)
				QMessageBox.warning(self._widget, 'Error', 'Error sending the command')
			except rospy.ServiceException,e: 
				rospy.logerr('MissionCommanderGUI:_reset_steering_encoder_cb: %s',e)
				QMessageBox.warning(self._widget, 'Error', 'Error sending the command')
开发者ID:RobospectEU,项目名称:robospect_mission_planner,代码行数:16,代码来源:rqt_mission_commander.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python QtGui.QPushButton类代码示例发布时间:2022-05-27
下一篇:
Python QtGui.QMenu类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap