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


Python QWidget.windowTitle方法代码示例

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


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

示例1: MyPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class MyPlugin(Plugin):

    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # 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

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which should be in the "resource" folder of this package
        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_mypkg'), 'resource', 'MyPlugin.ui')
        # Extend the widget with all atrributes and children from UI File
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin(when it's set in _widget).
        # This is useful when you open multiple plugins aat once. Also if you open multiple
        # instances of your plugin at once, these lines add number to make it easy to
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' %d' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
        self._widget.cancelButton.clicked[bool].connect(self._handle_cancel_clicked)
        self._widget.okButton.clicked[bool].connect(self._handle_ok_clicked)


    def shutdown_plugin(self):
        # TODO unregister all publishers here
        pass

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.get_value(k, v)
        pass

    def restore_settings(self, pluign_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
        pass

    def _handle_cancel_clicked(self):
        print "cancelButton is clicked"

    def _handle_ok_clicked(self):
        print "okButton is clicked"
开发者ID:AriYu,项目名称:rqt_mypkg,代码行数:60,代码来源:my_module.py

示例2: skeletonPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class skeletonPlugin(Plugin):


    
    def __init__(self, context):
        super(skeletonPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('skeletonPlugin')

        # 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
        
        
        
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'skeleton.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('skeletonUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)



    def shutdown_plugin(self):
        # TODO unregister all publishers here
        pass

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.set_value(k, v)
        pass

    def restore_settings(self, plugin_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
        pass
开发者ID:KTH-AEROWORKS,项目名称:quad-suspended-load,代码行数:59,代码来源:skeleton.py

示例3: ExampleGuiPub

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class ExampleGuiPub(Plugin):
   
    def __init__(self, context=None):
        super(ExampleGuiPub, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('ExampleGuiPub')
  
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file        
        pkg_dir = roslib.packages.get_pkg_dir('example_gui_pub')
        ui_file_path = os.path.join(pkg_dir, 'ui/example_gui_pub.ui')


        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file_path, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('ExampleGuiPubUi')

	    # Show _widget.windowTitle on left-top of each plugin (when 
     	# it's set in _widget). This is useful when you open multiple
	    # plugins at once. Also if you open multiple instances of your 
	    # plugin at once, these lines add number to make it easy to
	    # tell from pane to pane.        
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)
    	
        # Now Set up our own interface:
        # ==> Connect the buttons to the functions        
        self._widget.btn_ok.clicked.connect(self.btn_ok_clicked)
	
    def shutdown_plugin(self):
        """Kill all subscribers and publishers."""
	pass

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.set_value(k, v)
    	pass
 
    def restore_settings(self, plugin_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
	pass    

    
        
    def btn_ok_clicked(self):
        #printing the word in the ui label box
        spin_speed = 3.0
        self._widget.StatusReturn.setText('set LIDAR speed to ' + str(spin_speed))
        #publisher the data to multisense_sl        
        self.pub = rospy.Publisher('multisense_sl/set_spindle_speed', Float64, queue_size=10)      
        self.pub.publish(spin_speed)
开发者ID:1508189250,项目名称:birl_baxter,代码行数:59,代码来源:_example_gui_pub_module.py

示例4: BalanceModeWidget

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class BalanceModeWidget(Plugin):
    def __init__(self, context):
        super(BalanceModeWidget, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('BalanceMode')

        # 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

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which should be in the "resource" folder of this package
        ui_file = os.path.join(rospkg.RosPack().get_path('rsv_balance_rqt'), 'resource', 'BalanceModeWidget.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('BalanceModeWidgetUI')
        # Numerated windowTitle
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        self._widget.set_park.clicked[bool].connect(self.on_set_park_button)
        self._widget.set_tractor.clicked[bool].connect(self.on_set_tractor_button)
        self._widget.set_balance.clicked[bool].connect(self.on_set_balance_button)

        self._widget.topic_line_edit.textChanged.connect(self.on_topic_changed)

        # Set mode client
        self.set_mode_srv = None
        self.on_topic_changed()

    def shutdown_plugin(self):
        pass

    def save_settings(self, plugin_settings, instance_settings):
        instance_settings.set_value('topic', self._widget.topic_line_edit.text())

    def restore_settings(self, plugin_settings, instance_settings):
        value = instance_settings.value('topic', "/set_mode")
        self._widget.topic_line_edit.setText(value)

    def on_set_park_button(self):
        try:
            self.set_mode_srv(rsv_balance_msgs.srv.SetModeRequest.PARK)
        except rospy.ServiceException, e:
            rospy.logwarn("Service call failed: %s" % e)
开发者ID:robosavvy,项目名称:rsv_balance_desktop,代码行数:59,代码来源:balance_mode_widget.py

示例5: RunStopPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class RunStopPlugin(Plugin):

    def __init__(self, context):
        super(RunStopPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('RunStopPlugin')

        # 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

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file
        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_runstop'), 'src', 'rqt_runstop', 'runstop.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('RunStopPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)


        # initialize publisher to publish cancel messages
        self._publisher = rospy.Publisher('move_base/cancel', GoalID, queue_size=10)

        self._widget.runstopButton.clicked.connect(self.runstopButton_clicked)  # button handler


    # cancel all goals by sending empty goal to /move_base/cancel
    def runstopButton_clicked(self):
        emptyGoal = GoalID()
        self._publisher.publish(emptyGoal)
        return
开发者ID:OSUrobotics,项目名称:wheelchair-automation,代码行数:51,代码来源:rqt_runstop_module.py

示例6: Builder

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class Builder(Plugin):

    def __init__(self, context):
        super(Builder, self).__init__(context)

        self.setObjectName('BeetreeBuilder')
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        rospack = rospkg.RosPack()
        ui_path = rospack.get_path('beetree_builder') + '/ui/main.ui'
        # Load the ui attributes into the main widget
        loadUi(ui_path, self._widget)
        self._widget.setObjectName('BeetreeBuilderPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)
        palette = QPalette ()
        palette.setColor(QPalette.Background, Qt.white)
        self._widget.setPalette(palette)

        # Add custom options
        self._widget.node_type_list.addItems(['test1','test2'])

    def shutdown_plugin(self):
        # TODO unregister all publishers here
        pass

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.set_value(k, v)
        pass

    def restore_settings(self, plugin_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
        pass
开发者ID:futureneer,项目名称:beetree_builder,代码行数:46,代码来源:builder.py

示例7: LogicalMarkerPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class LogicalMarkerPlugin(Plugin):

    def __init__(self, context):
        super(LogicalMarkerPlugin, self).__init__(context)

        # Create an image for the original map. This will never change.
        try:
            self.map_yaml_file_str = rospy.get_param("~map_file")
            self.data_directory = rospy.get_param("~data_directory")
        except KeyError:
            rospy.logfatal("~map_file and ~data_directory need to be set to use the logical marker")
            return

        map_image_location = getImageFileLocation(self.map_yaml_file_str)
        map = loadMapFromFile(self.map_yaml_file_str)
        locations_file = getLocationsFileLocationFromDataDirectory(self.data_directory)
        doors_file = getDoorsFileLocationFromDataDirectory(self.data_directory)
        objects_file = getObjectsFileLocationFromDataDirectory(self.data_directory)

        # Give QObjects reasonable names
        self.setObjectName('LogicalMarkerPlugin')

        # Create QWidget
        self.master_widget = QWidget()
        self.master_layout = QVBoxLayout(self.master_widget)

        # Main Functions - Doors, Locations, Objects
        self.function_layout = QHBoxLayout()
        self.master_layout.addLayout(self.function_layout)
        self.function_buttons = []
        self.current_function = None
        for button_text in ['Locations', 'Doors', 'Objects']:
            button = QPushButton(button_text, self.master_widget)
            button.clicked[bool].connect(self.handle_function_button)
            button.setCheckable(True)
            self.function_layout.addWidget(button)
            self.function_buttons.append(button)
        self.function_layout.addStretch(1)

        self.master_layout.addWidget(self.get_horizontal_line())

        # Subfunction toolbar
        self.subfunction_layout = QHBoxLayout()
        clearLayoutAndFixHeight(self.subfunction_layout)
        self.master_layout.addLayout(self.subfunction_layout)
        self.current_subfunction = None

        self.master_layout.addWidget(self.get_horizontal_line())

        self.image = MapImage(map_image_location, self.master_widget)
        self.master_layout.addWidget(self.image)

        self.master_layout.addWidget(self.get_horizontal_line())

        # Configuration toolbar
        self.configuration_layout = QHBoxLayout()
        clearLayoutAndFixHeight(self.configuration_layout)
        self.master_layout.addLayout(self.configuration_layout)

        # Add a stretch at the bottom.
        self.master_layout.addStretch(1)

        self.master_widget.setObjectName('LogicalMarkerPluginUI')
        if context.serial_number() > 1:
            self.master_widget.setWindowTitle(self.master_widget.windowTitle() + (' (%d)' % context.serial_number()))
        context.add_widget(self.master_widget)


        # Activate the functions
        self.functions = {}
        self.functions['Locations'] = LocationFunction(locations_file,
                                                       map,
                                                       self.master_widget, 
                                                       self.subfunction_layout, 
                                                       self.configuration_layout,
                                                       self.image)
        self.functions['Doors'] = DoorFunction(doors_file,
                                               map,
                                               self.functions['Locations'],
                                               self.master_widget, 
                                               self.subfunction_layout, 
                                               self.configuration_layout,
                                               self.image)
        self.functions['Objects'] = ObjectFunction(objects_file,
                                                   map,
                                                   self.functions['Locations'],
                                                   self.master_widget, 
                                                   self.subfunction_layout, 
                                                   self.configuration_layout,
                                                   self.image)
    def construct_layout(self):
        pass

    def get_horizontal_line(self):
        """
        http://stackoverflow.com/questions/5671354/how-to-programmatically-make-a-horizontal-line-in-qt
        """
        hline = QFrame()
        hline.setFrameShape(QFrame.HLine)
        hline.setFrameShadow(QFrame.Sunken)
#.........这里部分代码省略.........
开发者ID:nj1407,项目名称:bwi_common,代码行数:103,代码来源:plugins.py

示例8: Overview

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class Overview(Plugin):
    setImageSignal = pyqtSignal(Image)
    setBaseMaskSignal = pyqtSignal(Image)
    setBatteryMaskSignal = pyqtSignal(Image)
    setCupMaskSignal = pyqtSignal(Image)
    def __init__(self, context):
        super(Overview, self).__init__(context)
        
        # Give QObjects reasonable names
        self.setObjectName('rqt_calibration_blob')
        self.__imageTopic = "/camera/rgb/image_rect_color"
        self.__pickedColour = None
        self.__lastHSVimage = None

        # Process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # Add argument(s) to the parser.
        parser.add_argument("-i", "--imageTopic", dest="imageTopic", help="set image topic")
        args, unknowns = parser.parse_known_args(context.argv())
        if args.imageTopic:
            self.__imageTopic = args.imageTopic
        else:
            self.__imageTopic = "/object_detection_blob_node/object_detection_blob_node/lightCorrected"
        self.__imageSub = rospy.Subscriber(self.__imageTopic, Image, self.imageCallback)
        self.__baseMaskSub = rospy.Subscriber("/object_detection_blob_node/object_detection_blob_node/base_mask", Image, self.baseMaskCallback)
        self.__batteryMaskSub = rospy.Subscriber("/object_detection_blob_node/object_detection_blob_node/battery_mask", Image, self.batteryMaskCallback)
        self.__cupMaskSub = rospy.Subscriber("/object_detection_blob_node/object_detection_blob_node/cup_mask", Image, self.cupMaskCallback)
        self.__cvBridge = CvBridge()
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which should be in the "resource" folder of this node
        ui_file = os.path.join(rospkg.RosPack().get_path('object_detection_blob'), 'src', 'rqt_calibration_gui', 'resource', 'overview.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('CalibrationUI')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        
        self.__colorImageScene = ClickableGraphicsScene()
        self.__baseImageScene = ClickableGraphicsScene()
        self.__batteryImageScene = ClickableGraphicsScene()
        self.__cupImageScene = ClickableGraphicsScene()
        self.__colorImageScene.clicked.connect(self.readImageColour)
        self.__baseImageScene.clicked.connect(self.readImageColour)
        self.__batteryImageScene.clicked.connect(self.readImageColour)
        self.__cupImageScene.clicked.connect(self.readImageColour)

        self._widget.setBaseButton.clicked.connect(self.setBaseCallback)
        self._widget.setBatteryButton.clicked.connect(self.setBatteryCallback)
        self._widget.setCupButton.clicked.connect(self.setCupCallback)
        self._widget.subscribeButton.clicked.connect(self.subscribeToImage)
        self._widget.setMinButton.clicked.connect(self.setMinColour)
        self._widget.setMaxButton.clicked.connect(self.setMaxColour)
        # Connect signal so we can refresh widgets from the main thread        
        self.setImageSignal.connect(self.updateImage)
        self.setBaseMaskSignal.connect(self.updateBaseMask)
        self.setBatteryMaskSignal.connect(self.updateBatteryMask)
        self.setCupMaskSignal.connect(self.updateCupMask)
        # Add widget to the user interface
        context.add_widget(self._widget)
        rospy.loginfo("initialized")
    
    def readImageColour(self, pos):
        if self.__lastHSVimage is not None:
            self.__pickedColour = self.__lastHSVimage[pos[1], pos[0]] # x, y is swapped in opencv
            self._widget.colourLabel.setText("hue {0} sat {1} val {2}".format(self.__pickedColour[0], self.__pickedColour[1], self.__pickedColour[2]))
            rospy.loginfo("picked color %s", self.__pickedColour)
    
    def setMinColour(self):
        if self.__pickedColour is not None:
            self._widget.hueMinEdit.setText(str(self.__pickedColour[0]))
            self._widget.satMinEdit.setText(str(self.__pickedColour[1]))
            self._widget.valMinEdit.setText(str(self.__pickedColour[2]))
    
    def setMaxColour(self):
        if self.__pickedColour is not None:
            self._widget.hueMaxEdit.setText(str(self.__pickedColour[0]))
            self._widget.satMaxEdit.setText(str(self.__pickedColour[1]))
            self._widget.valMaxEdit.setText(str(self.__pickedColour[2])) 
        
    def updateImage(self, img):
        try:
            img.encoding = "bgr8" # no, it's not but cv_bridge can't handle hsv
            image = self.__cvBridge.imgmsg_to_cv2(img) # Convert ROS' sensor_msgs/Image to cv2 image
            self.__lastHSVimage = image.copy()
            image = cv2.cvtColor(image, cv2.COLOR_HSV2RGB)
            height, width = image.shape[:2]
            frame = QImage(image.data, width, height, QImage.Format_RGB888)
            self.__colorImageScene.clear()
            self.__colorImageScene.addPixmap(QPixmap.fromImage(frame))
            self.__colorImageScene.update()
            self._widget.lightCorrectedGraphicsView.setScene(self.__colorImageScene)
            self._widget.lightCorrectedGraphicsView.ensureVisible(self.__colorImageScene.sceneRect());
#.........这里部分代码省略.........
开发者ID:DAInamite,项目名称:uav_object_localisation,代码行数:103,代码来源:blob_calibration_gui.py

示例9: Dot

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class Dot(Plugin):

    def __init__(self, context):
        super(Dot, self).__init__(context)

        self._dotcode_sub = None

        # Give QObjects reasonable names
        self.setObjectName('Dot')

        # 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

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rqt_dot.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names

        self._widget.setObjectName('DotPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        # Add widget to the user interface
        context.add_widget(self._widget)
        palette = QPalette ()
        palette.setColor(QPalette.Background, Qt.white)
        self._widget.setPalette(palette)

        self._widget.subscribe_button.setCheckable(True)
        self._widget.subscribe_button.clicked[bool].connect(self._handle_subscribe_clicked)

    def shutdown_plugin(self):
        # TODO unregister all publishers here
        pass

    def save_settings(self, plugin_settings, instance_settings):
        # TODO save intrinsic configuration, usually using:
        # instance_settings.set_value(k, v)
        pass

    def restore_settings(self, plugin_settings, instance_settings):
        # TODO restore intrinsic configuration, usually using:
        # v = instance_settings.value(k)
        pass

    #def trigger_configuration(self):
        # Comment in to signal that the plugin has a way to configure
        # This will enable a setting button (gear icon) in each dock widget title bar
        # Usually used to open a modal configuration dialog

    def _handle_subscribe_clicked(self, checked):
        if checked:
            topic_name = self._widget.topic_name.text()
            if len(topic_name) > 0:
                self._dotcode_sub = rospy.Subscriber(
                        topic_name,
                        std_msgs.msg.String,
                        self._dotcode_msg_cb)
            else:
                return False
        else:
            if self._dotcode_sub:
                self._dotcode_sub.unregister()
                self._dotcode_sub = None

    def _dotcode_msg_cb(self, msg):
        self._widget.xdot_widget.set_dotcode(msg.data)
开发者ID:jbohren,项目名称:rqt_dot,代码行数:87,代码来源:dot.py

示例10: ChooseControllerPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class ChooseControllerPlugin(Plugin):

    # for controller state
    ctr_st = pyqtSignal(numpy.ndarray)

    # ---------------------------------------------- #
    # ---------------------------------------------- #
    # Necessary constants

    # size of vectors: INTEGER
    Size_Vector = 100


    def __init__(self, context,namespace = None):

        # it is either "" or the input given at creation of plugin
        self.namespace = self._parse_args(context.argv())


        super(ChooseControllerPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('ChooseControllerPlugin')

        # 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
        
        
        
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ChooseController.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('ChooseControllerUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # ---------------------------------------------- #
        # ---------------------------------------------- #

        # BUTTON TO SET DESIRED CONTROLLER
        self._widget.SetControllerButton.clicked.connect(self.SetController)

        # BUTTON TO SET DESIRED TRAJECTORY
        self._widget.Reset_Int_XY.clicked.connect(self.RESET_xy_PID)

        # BUTTON TO SET DESIRED TRAJECTORY
        self._widget.Reset_Int_Z.clicked.connect(self.RESET_z_PID)

        # ------------------------------------------------------------------#
        # ------------------------------------------------------------------#
        # get some values from launch file if theyre available
        wn  = 1
        xsi = numpy.sqrt(2)/2
        kv   = rospy.get_param("kv",2.0*xsi*wn)
        kp   = rospy.get_param("kp",wn*wn)

        Throttle_neutral = rospy.get_param("Throttle_neutral_ctr",1484.0)


        # ------------------------------------------------------------------#
        # ------------------------------------------------------------------#

        # Default values for buttons: PD Controller
        self._widget.PgainXY.setValue(kp)
        self._widget.DgainXY.setValue(kv)
        self._widget.PgainZ.setValue(kp)
        self._widget.DgainZ.setValue(kv)
        self._widget.ThrottleNeutral.setValue(Throttle_neutral)

        # Default values for buttons: PID Controller
        self._widget.PgainXY_PID.setValue(kp)
        self._widget.DgainXY_PID.setValue(kv)
        self._widget.IgainXY_PID.setValue(0.0)
        self._widget.PgainZ_PID.setValue(kp)
        self._widget.DgainZ_PID.setValue(kv)
        self._widget.DgainXY_PID.setValue(kv)
        self._widget.IgainZ_PID.setValue(0.0)
        self._widget.ThrottleNeutral_PID.setValue(Throttle_neutral)


#.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:sml_under_development,代码行数:103,代码来源:ChooseController.py

示例11: RCDisplayPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class RCDisplayPlugin(Plugin):
    
    def __init__(self, context):
        

        super(RCDisplayPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # 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


        
        
        
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'RCDisplay.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('RCDisplayUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # Setting maximum and minimum on the bars:
        self._widget.channel1bar.setMinimum(0)
        self._widget.channel1bar.setMaximum(2000)
        self._widget.channel2bar.setMinimum(0)
        self._widget.channel2bar.setMaximum(2000)
        self._widget.channel3bar.setMinimum(0)
        self._widget.channel3bar.setMaximum(2000)
        self._widget.channel4bar.setMinimum(0)
        self._widget.channel4bar.setMaximum(2000)
        self._widget.channel5bar.setMinimum(0)
        self._widget.channel5bar.setMaximum(2000)
        self._widget.channel6bar.setMinimum(0)
        self._widget.channel6bar.setMaximum(2000)
        self._widget.channel7bar.setMinimum(0)
        self._widget.channel7bar.setMaximum(2000)
        self._widget.channel8bar.setMinimum(0)
        self._widget.channel8bar.setMaximum(2000)
        self._widget.Batterybar.setMinimum(0)

        # The batterybar can only handle integer values, so its maximum is set to 10000 to get a good resolution.
        self._widget.Batterybar.setMaximum(10000)

        # Connecting slots to signals. Each time channelXdisplay emits the signal textChanged, 
        # the function self.change_barX will be called.
        self._widget.channel1display.textChanged.connect(self.change_bar1)
        self._widget.channel2display.textChanged.connect(self.change_bar2)
        self._widget.channel3display.textChanged.connect(self.change_bar3)
        self._widget.channel4display.textChanged.connect(self.change_bar4)
        self._widget.channel5display.textChanged.connect(self.change_bar5)
        self._widget.channel6display.textChanged.connect(self.change_bar6)
        self._widget.channel7display.textChanged.connect(self.change_bar7)
        self._widget.channel8display.textChanged.connect(self.change_bar8)
        self._widget.Batterydisplay.textChanged.connect(self.change_Batterybar)
        self._widget.ListenButton.clicked.connect(self.Listen)

        # Setting other variables

        self._widget.IrisInputBox.insertItems(0,['iris1','iris2','iris3','iris4',"iris5"])
        self.batterysub = ''
        self.sub = ''
        

    def Listen(self):

        # Unsubscribes from any previous channels and subscribes to the monitored channels of the selected drone.

        if self.sub != '':
            self.sub.unregister()
        self.sub = rospy.Subscriber('/' + self._widget.IrisInputBox.currentText() + '/mavros/rc/override', OverrideRCIn, self.callback)    
        if self.batterysub != '':
            self.batterysub.unregister()
        self.batterysub = rospy.Subscriber('/' + self._widget.IrisInputBox.currentText() + '/mavros/battery', BatteryStatus, self.batterycallback)
#
    def callback(self,data):

        # Called each time data from /irisX/mavros/rc/override is recieved, 
#.........这里部分代码省略.........
开发者ID:KTH-AEROWORKS,项目名称:quad-suspended-load,代码行数:103,代码来源:RCDisplay.py

示例12: MyPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class MyPlugin(Plugin):
    def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('MyPlugin')

        # 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

        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MyPlugin.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('MyPluginUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)
        
        # UI interaction
        self._widget.loadProgramButton.clicked.connect(self._loadProgram)
        self._widget.loadPointsButton.clicked.connect(self._loadPoints)
        self._widget.sendButton.clicked.connect(self._sendInstruction)
        self._widget.chooseProgramButton.clicked.connect(self._chooseProgram)
        self._widget.choosePointsButton.clicked.connect(self._choosePoints)
        self._widget.runButton.clicked.connect(self._runProgram)
        self.pub = rospy.Publisher('execute_instruction', String, queue_size=10)
        

    def publish_file(self, fname):
        try:
            with open(fname) as f:
                for line in f:
                    self.pub.publish(line.strip('\n'))
        except IOError:
            QMessageBox.warning(self._widget, "Error opening file", "Error opening file: %s"%fname)
            sys.stderr.write("Error opening file: %s \n"%fname)
        

    def _loadProgram(self):
        fname = self._widget.programPathTextEdit.toPlainText()
        if fname == "":
            sys.stderr.write("No file specified\n")
            QMessageBox.warning(self._widget, "Error loading program", "Please specify a file")
            return
            
        if not fname.endswith(".MB4"):
            sys.stderr.write("Please choose .MB4 file\n")
            QMessageBox.warning(self._widget, "Error loading program", "Wrong extension: Please choose .mb4 file")
            return

        self.pub.publish('---LOAD PROGRAM BEGIN---')
        self.publish_file(fname)
        self.pub.publish('---LOAD PROGRAM END---')


    def _loadPoints(self):
        fname = self._widget.pointsPathTextEdit.toPlainText()
        if fname == "":
            sys.stderr.write("No file specified\n")
            QMessageBox.warning(self._widget, "Error loading points", "Please specify a file")
            return
            
        if not fname.endswith(".POS"):
            sys.stderr.write("Please choose .POS file\n")
            QMessageBox.warning(self._widget, "Error loading points", "Wrong extension: Please choose .pos file")
            return

        self.pub.publish('---LOAD POINTS BEGIN---')
        self.publish_file(fname)
        self.pub.publish('---LOAD POINTS END---')
        
        
    def _runProgram(self):
        self.pub.publish('---RUN PROGRAM---')

    def _sendInstruction(self):
        self.pub.publish('---SINGLE INSTRUCTION---')
        self.pub.publish(self._widget.textEdit.toPlainText())
        

    def _chooseProgram(self):
#.........这里部分代码省略.........
开发者ID:biellls,项目名称:rqt_arm_control_py,代码行数:103,代码来源:my_module.py

示例13: positionPlotPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]

#.........这里部分代码省略.........
        super(positionPlotPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('positionPlotPlugin')

        # 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
        
        
        
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'positionPlot.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('positionPlotUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # ---------------------------------------------- #
        # ---------------------------------------------- #

        # window for positions
        plotwidget = pg.PlotWidget()
        plotwidget.getPlotItem().addLegend()
        plotwidget.setYRange(-2.5,2.5)      


        # window for velocities
        velplotwidget = pg.PlotWidget()
        velplotwidget.getPlotItem().addLegend()
        velplotwidget.setYRange(-2.5,2.5)   

        # window for velocities
        Anglesplotwidget = pg.PlotWidget()
        Anglesplotwidget.getPlotItem().addLegend()
        Anglesplotwidget.setYRange(-30,30)        

        # window for channels
        channelplotwidget = pg.PlotWidget()
        channelplotwidget.getPlotItem().addLegend()
        channelplotwidget.setYRange(1000,2000)


        # ---------------------------------------------- #
        # ---------------------------------------------- #        
        
        layout        = QtGui.QGridLayout()
开发者ID:KTH-AEROWORKS,项目名称:quad-suspended-load,代码行数:70,代码来源:positionPlot.py

示例14: ChooseMissionPlugin

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class ChooseMissionPlugin(Plugin):

    def __init__(self, context,namespace = None):

        # "global variables"
        self.dic_sequence_services = {}
        self.dic_sequence_services['last_trigger_time']            = 0.0
        self.dic_sequence_services['checked_sequence_of_missions'] = True
        self.dic_sequence_services['list_sequence_services']       = []

        # it is either "" or the input given at creation of plugin
        self.namespace = self._parse_args(context.argv())
        self.context   = context

        super(ChooseMissionPlugin, self).__init__(context)
        # Give QObjects reasonable names
        self.setObjectName('ChooseMissionPlugin')

        # 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
        
               
        # Create QWidget
        self._widget = QWidget()
        # Get path to UI file which is a sibling of this file
        # in this example the .ui and .py file are in the same folder
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'choose_mission.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('ChooseMissionUi')
        # Show _widget.windowTitle on left-top of each plugin (when 
        # it's set in _widget). This is useful when you open multiple 
        # plugins at once. Also if you open multiple instances of your 
        # plugin at once, these lines add number to make it easy to 
        # tell from pane to pane.
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        # Add widget to the user interface
        context.add_widget(self._widget)

        # ---------------------------------------------- #
        # ---------------------------------------------- #

        self._widget.ResetIrisNeutralValue.clicked.connect(self.reset_iris_neutral_value)
        self._widget.SetIrisNeutralValue.clicked.connect(self.set_iris_neutral_value)


        self._widget.SetSequenceMissions.clicked.connect(self.send_list_of_services)
        # ---------------------------------------------- #
        
        # button to request service for setting new controller, with new parameters
        self._widget.SetControllerButton.clicked.connect(self.__get_new_controller_parameters)

        # if item in list is selected, print corresponding message
        self._widget.ListControllersWidget.itemDoubleClicked.connect(self.__controller_item_clicked)
        self._widget.ListControllersWidget.itemClicked.connect(self.__print_controller_item_clicked)

        self.__reset_controllers_widget()

        # button for resetting list of available controllers
        self._widget.ResetControllersList.clicked.connect(self.__reset_controllers_widget)


        self.choose_reference  = ChooseJsonablePlugin(context,\
            self.namespace,\
            name_tab = "Reference",
            dictionary_of_options = {},\
            service_name = 'ServiceChangeReference',\
            ServiceClass = SrvCreateJsonableObjectByStr)
        self.choose_reference.dic_sequence_services = self.dic_sequence_services


        self.choose_yaw_reference  = ChooseJsonablePlugin(context,\
            self.namespace,\
            name_tab = "YawReference",
            dictionary_of_options = {},\
            service_name = 'ServiceChangeYawReference',\
            ServiceClass = SrvCreateJsonableObjectByStr)        
        self.choose_yaw_reference.dic_sequence_services = self.dic_sequence_services


        self.choose_yaw_controller  = ChooseJsonablePlugin(context,\
            self.namespace,\
            name_tab = "YawController",
            dictionary_of_options = {},\
            service_name = 'ServiceChangeYawController',\
            ServiceClass = SrvCreateJsonableObjectByStr)
        self.choose_yaw_controller.dic_sequence_services = self.dic_sequence_services


#.........这里部分代码省略.........
开发者ID:KTH-AEROWORKS,项目名称:sml_under_development,代码行数:103,代码来源:choose_mission.py

示例15: RosTfTree

# 需要导入模块: from python_qt_binding.QtGui import QWidget [as 别名]
# 或者: from python_qt_binding.QtGui.QWidget import windowTitle [as 别名]
class RosTfTree(QObject):

    _deferred_fit_in_view = Signal()

    def __init__(self, context):
        super(RosTfTree, self).__init__(context)
        self.initialized = False

        self.setObjectName('RosTfTree')

        self._current_dotcode = None

        self._widget = QWidget()

        # factory builds generic dotcode items
        self.dotcode_factory = PydotFactory()
        # self.dotcode_factory = PygraphvizFactory()
        # generator builds rosgraph
        self.dotcode_generator = RosTfTreeDotcodeGenerator()
        self.tf2_buffer_ = tf2_ros.Buffer()
        self.tf2_listener_ = tf2_ros.TransformListener(self.tf2_buffer_)

        # dot_to_qt transforms into Qt elements using dot layout
        self.dot_to_qt = DotToQtGenerator()

        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('rqt_tf_tree'), 'resource', 'RosTfTree.ui')
        loadUi(ui_file, self._widget, {'InteractiveGraphicsView': InteractiveGraphicsView})
        self._widget.setObjectName('RosTfTreeUi')
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        self._scene = QGraphicsScene()
        self._scene.setBackgroundBrush(Qt.white)
        self._widget.graphics_view.setScene(self._scene)

        self._widget.refresh_graph_push_button.setIcon(QIcon.fromTheme('view-refresh'))
        self._widget.refresh_graph_push_button.pressed.connect(self._update_tf_graph)

        self._widget.highlight_connections_check_box.toggled.connect(self._redraw_graph_view)
        self._widget.auto_fit_graph_check_box.toggled.connect(self._redraw_graph_view)
        self._widget.fit_in_view_push_button.setIcon(QIcon.fromTheme('zoom-original'))
        self._widget.fit_in_view_push_button.pressed.connect(self._fit_in_view)

        self._widget.load_dot_push_button.setIcon(QIcon.fromTheme('document-open'))
        self._widget.load_dot_push_button.pressed.connect(self._load_dot)
        self._widget.save_dot_push_button.setIcon(QIcon.fromTheme('document-save-as'))
        self._widget.save_dot_push_button.pressed.connect(self._save_dot)
        self._widget.save_as_svg_push_button.setIcon(QIcon.fromTheme('document-save-as'))
        self._widget.save_as_svg_push_button.pressed.connect(self._save_svg)
        self._widget.save_as_image_push_button.setIcon(QIcon.fromTheme('image-x-generic'))
        self._widget.save_as_image_push_button.pressed.connect(self._save_image)

        self._deferred_fit_in_view.connect(self._fit_in_view,
                                           Qt.QueuedConnection)
        self._deferred_fit_in_view.emit()

        context.add_widget(self._widget)

        self._force_refresh = False

    def save_settings(self, plugin_settings, instance_settings):
        instance_settings.set_value('auto_fit_graph_check_box_state',
                                    self._widget.auto_fit_graph_check_box.isChecked())
        instance_settings.set_value('highlight_connections_check_box_state',
                                    self._widget.highlight_connections_check_box.isChecked())

    def restore_settings(self, plugin_settings, instance_settings):
        self._widget.auto_fit_graph_check_box.setChecked(
            instance_settings.value('auto_fit_graph_check_box_state', True) in [True, 'true'])
        self._widget.highlight_connections_check_box.setChecked(
            instance_settings.value('highlight_connections_check_box_state', True) in [True, 'true'])
        self.initialized = True
        self._refresh_tf_graph()

    def _update_tf_graph(self):
        self._force_refresh = True
        self._refresh_tf_graph()

    def _refresh_tf_graph(self):
        if not self.initialized:
            return
        self._update_graph_view(self._generate_dotcode())

    def _generate_dotcode(self):
        force_refresh = self._force_refresh
        self._force_refresh = False
        rospy.wait_for_service('~tf2_frames')
        tf2_frame_srv = rospy.ServiceProxy('~tf2_frames', FrameGraph)
        return self.dotcode_generator.generate_dotcode(dotcode_factory=self.dotcode_factory,
                                                       tf2_frame_srv=tf2_frame_srv,
                                                       force_refresh=force_refresh)

    def _update_graph_view(self, dotcode):
        if dotcode == self._current_dotcode:
            return
        self._current_dotcode = dotcode
        self._redraw_graph_view()

    def _generate_tool_tip(self, url):
#.........这里部分代码省略.........
开发者ID:Aerobota,项目名称:rqt_robot_plugins,代码行数:103,代码来源:tf_tree.py


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