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

Python python_qt_binding.loadUi函数代码示例

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

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



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

示例1: __init__

    def __init__(self, parentfilter, rospack, time_range_provider):
        """
        Widget for displaying interactive data related to time filtering.
        :param parentfilter: buddy filter were data is stored, ''TimeFilter''
        :param display_list_args: single element list containing one tuple with
        the min and max time to be displayed, ''list of tuple''
        """
        super(TimeFilterWidget, self).__init__()
        ui_file = os.path.join(rospack.get_path('rqt_console'), 'resource/filters', 'time_filter_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('TimeFilterWidget')
        self._parentfilter = parentfilter  # When data is changed it is stored in the parent filter

        self.start_datetime.dateTimeChanged[QDateTime].connect(self.handle_start_changed)
        self.stop_datetime.dateTimeChanged[QDateTime].connect(self.handle_stop_changed)
        self.stop_enabled_check_box.clicked[bool].connect(self.handle_stop_enabled_changed)

        # Times are passed in unixtimestamp '.' decimal fraction of a second
        mintime, maxtime = time_range_provider()
        if mintime != -1:
            mintime = str(mintime).split('.')
            maxtime = str(maxtime).split('.')

            time = QDateTime()
            time.setTime_t(int(mintime[0]))
            mintime = time.addMSecs(int(str(mintime[1]).zfill(9)[:3]))
            self.start_datetime.setDateTime(mintime)
            time.setTime_t(int(maxtime[0]))
            maxtime = time.addMSecs(int(str(maxtime[1]).zfill(9)[:3]))
            self.stop_datetime.setDateTime(maxtime)
        else:
            self.start_datetime.setDateTime(datetime.now())
            self.stop_datetime.setDateTime(datetime.now())
开发者ID:Rescube,项目名称:rqt_common_plugins,代码行数:33,代码来源:time_filter_widget.py


示例2: __init__

    def __init__(self):
        super(IdSelectorWidget, self).__init__()
        self.setObjectName('IdSelectorWidget')

        # Get path to UI file which should be in the "resource" folder of this package
        pkg_path = rospkg.RosPack().get_path('rqt_tracker_id_selector')
        ui_file = os.path.join(pkg_path, 'resource', 'IdSelector.ui')
        # Extend the widget with all attributes and children from UI file
        loadUi(ui_file, self)

        self.labels = ["ID","label"]
        self.id_table.setColumnCount(len(self.labels))
        self.id_table.setHorizontalHeaderLabels(self.labels)
        self.lineEdit.setText("~/labels.yaml")

        self.sub_traj = rospy.Subscriber("tracking/lk2d/points", Point2dArray,
                                         self.cb_points, queue_size=10)
        self.sub_traj = rospy.Subscriber("tracking/lk3d/points", Point3dArray,
                                         self.cb_points3d, queue_size=10)
        self.sub_img = rospy.Subscriber("/camera/rgb/image_color", Image,
                                        self.cb_img, queue_size=1)
        self.pub_img = rospy.Publisher("tracking/selected_tracks",Image,queue_size=1)
        self.pub_marker = rospy.Publisher("trajectory_marker",MarkerArray,queue_size=1)
        
        self.bridge = CvBridge()
        self.img = None
        
        self.ids = {}
        self.tracks = defaultdict(list)
        self.tracks3d = defaultdict(list)
        self.select = []
开发者ID:stfuchs,项目名称:feature_trajectory_clustering,代码行数:31,代码来源:id_selector_widget.py


示例3: __init__

    def __init__(self, parent, rospack, signal_msg=None):
        """
        @param signal_msg: Signal to carries a system msg that is shown on GUI.
        @type signal_msg: QtCore.Signal
        """
        super(NodeSelectorWidget, self).__init__()
        self._parent = parent
        self.stretch = None
        self._signal_msg = signal_msg

        ui_file = os.path.join(rospack.get_path('rqt_reconfigure'), 'resource',
                               'node_selector.ui')
        loadUi(ui_file, self)

        # List of the available nodes. Since the list should be updated over
        # time and we don't want to create node instance per every update
        # cycle, This list instance should better be capable of keeping track.
        self._nodeitems = OrderedDict()
        # Dictionary. 1st elem is node's GRN name,
        # 2nd is TreenodeQstdItem instance.
        # TODO: Needs updated when nodes list updated.

        #  Setup treeview and models
        self._item_model = TreenodeItemModel()
        self._rootitem = self._item_model.invisibleRootItem()  # QStandardItem

        self._nodes_previous = None

        # Calling this method updates the list of the node.
        # Initially done only once.
        self._update_nodetree_pernode()

        # TODO(Isaac): Needs auto-update function enabled, once another
        #             function that updates node tree with maintaining
        #             collapse/expansion  state. http://goo.gl/GuwYp can be a
        #             help.

        self._collapse_button.pressed.connect(
                                          self._node_selector_view.collapseAll)
        self._expand_button.pressed.connect(self._node_selector_view.expandAll)

        # Filtering preparation.
        self._proxy_model = FilterChildrenModel(self)
        self._proxy_model.setDynamicSortFilter(True)
        self._proxy_model.setSourceModel(self._item_model)
        self._node_selector_view.setModel(self._proxy_model)
        self._filterkey_prev = ''

        # This 1 line is needed to enable horizontal scrollbar. This setting
        # isn't available in .ui file.
        # Ref. http://stackoverflow.com/a/6648906/577001
        self._node_selector_view.header().setResizeMode(
                                              0, QHeaderView.ResizeToContents)

        # Setting slot for when user clicks on QTreeView.
        self.selectionModel = self._node_selector_view.selectionModel()
        # Note: self.selectionModel.currentChanged doesn't work to deselect
        # a treenode as expected. Need to use selectionChanged.
        self.selectionModel.selectionChanged.connect(
                                                  self._selection_changed_slot)
开发者ID:suryaprakaz,项目名称:rospy_android,代码行数:60,代码来源:node_selector_widget.py


示例4: __init__

  def __init__(self, pr2_interface):

    super(ObjectHandoffWindowManager, self).__init__(pr2_interface)

    # 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_pr2_hand_syntouch_sensor_interface'), 'resource',
            'objecthandoff.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('ObjectHandoff')

    self._widget.setWindowTitle('Object Handoff Using PR2 Arm')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    self._widget.OutputTextBox.document().setPlainText(
        'Object should already be in the PR2 gripper\'s fingers. Press the \
         button to begin waiting for socially acceptable hand off.')

    # Register a listener for the Hand Off button.
    # TODO: Rename button from PlaceButton to HandOff button.
    self._widget.PlaceButton.clicked.connect(self._handle_hand_off_button_clicked)
开发者ID:BigMacStorm,项目名称:PR2_hapticSensorResearch,代码行数:29,代码来源:object_handoff_window_manager.py


示例5: __init__

    def __init__(self, plugin):
        super(Theta360ViewWidget, self).__init__()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('theta_viewer'), 'resource', 'Theta360ViewWidget.ui')
        loadUi(ui_file, self)
        self.plugin = plugin

        self.position = (0.0, 0.0, 0.0)
        self.orientation = quaternion_about_axis(0.0, (1.0, 0.0, 0.0))
        self.topicName = None
        self.subscriber = None

        # create GL view
        self._glview = MyGLWidget()
        self._glview.setAcceptDrops(True)

        # backup and replace original paint method
        # self.glView.paintGL is callbacked from QGLWidget
        self._glview.paintGL_original = self._glview.paintGL
        self._glview.paintGL = self.glview_paintGL

        # backup and replace original mouse release method
        self._glview.mouseReleaseEvent_original = self._glview.mouseReleaseEvent
        self._glview.mouseReleaseEvent = self.glview_mouseReleaseEvent

        # add GL view to widget layout
        self.layout().addWidget(self._glview)

        # init and start update timer with 40ms (25fps)
        # updateTimeout is called with interval time
        self.update_timer = QTimer(self)
        self.update_timer.timeout.connect(self.update_timeout)
        self.update_timer.start(40)
        self.cnt = 0
开发者ID:my-garbage-collection,项目名称:rqt_test,代码行数:34,代码来源:theta_view_widget.py


示例6: __init__

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'part.ui'), self)

        self.pub_marker_array = rospy.Publisher(
            'visualization_marker_array', MarkerArray, queue_size=10)

        self.btnLoad.clicked.connect(self.btnLoadClicked)
        self.btnProcessMesh.clicked.connect(self.btnProcessMeshClicked)
        self.btnLayers.clicked.connect(self.btnLayersClicked)
        self.btnAcceptPath.clicked.connect(self.btnAcceptPathClicked)

        self.sbStart.valueChanged.connect(self.changeLayers)
        self.sbStop.valueChanged.connect(self.changeLayers)

        self.sbPositionX.valueChanged.connect(self.changePosition)
        self.sbPositionY.valueChanged.connect(self.changePosition)
        self.sbPositionZ.valueChanged.connect(self.changePosition)

        self.sbSizeX.valueChanged.connect(self.changeSize)
        self.sbSizeY.valueChanged.connect(self.changeSize)
        self.sbSizeZ.valueChanged.connect(self.changeSize)

        self.processing = False
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.updateProcess)

        self.robpath = RobPath()
开发者ID:openlmd,项目名称:robpath,代码行数:28,代码来源:qt_part.py


示例7: __init__

  def __init__(self, pr2_interface):

    super(ConnectionWindowManager, self).__init__(pr2_interface)

    # 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_pr2_hand_syntouch_sensor_interface'), 'resource', 'connectioninfo.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('ConnectionInfoWindow')

    self._widget.setWindowTitle(
        'Connection Info')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    # Since this window has text that needs to be updated in real time
    # A thread will need to be created that will handle updating the 
    # labels.
    self._worker = threading.Thread(target=self.update_labels)
    self._worker.start()
开发者ID:BigMacStorm,项目名称:PR2_hapticSensorResearch,代码行数:27,代码来源:connection_window_manager.py


示例8: __init__

    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)
开发者ID:felixendres,项目名称:rqt_mypkg,代码行数:35,代码来源:my_module.py


示例9: __init__

    def __init__(self, context):
        super(CalibrationControl, self).__init__(context)
        self.setObjectName('CalibrationControl')
        
        
        # Argument parsing
        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
        rp = rospkg.RosPack()
        ui_file = os.path.join(rp.get_path('industrial_calibration_gui'), 'resource', 'calibration_control.ui')
        loadUi(ui_file, self._widget)
        # Give QObjects reasonable names
        self._widget.setObjectName('calibration_control_Ui')
        
        # Custom code begins here
        self._widget.cal_button.clicked[bool].connect(self.__handle_cal_clicked)
        
        self.cal_service = rospy.ServiceProxy('calibration_service', Empty)
        
        # Add widget to the user interface
        context.add_widget(self._widget)
开发者ID:gomezc,项目名称:industrial_calibration,代码行数:33,代码来源:calibration_control.py


示例10: __init__

    def __init__(self, context):
        Plugin.__init__(self, context)
        self.setObjectName('RqtGraspViewer')

        self._widget = QWidget()

        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_grasp_viewer'), 'ui', 'RqtGraspViewer.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('RqtGraspViewerUi')
        context.add_widget(self._widget)

        main_layout = QHBoxLayout()
        self._default_labels = ["obj_id", "object", "grasp_id", "grasp", "quality"]
        self._filemodel = QStandardItemModel(0, 5)
        self._filemodel.setHorizontalHeaderLabels(self._default_labels)

        self._table_view = QTableView()
        self._table_view.setModel(self._filemodel)
        self._table_view.resizeColumnsToContents()

        main_layout.addWidget(self._table_view)
        self._widget.scrollarea.setLayout(main_layout)

        self.init_services()
        self.init_subscribers()

        # self._table_view.clicked.connect(self.on_table_view_clicked)
        self._table_view.selectionModel().selectionChanged.connect(self.on_table_view_select)
开发者ID:ubi-agni,项目名称:grasp_visualization,代码行数:28,代码来源:grasp_viewer_gui.py


示例11: __init__

    def __init__(self, parentfilter, rospack, item_providers):
        super(CustomFilterWidget, self).__init__()
        ui_file = os.path.join(rospack.get_path('rqt_console'), 'resource/filters', 'custom_filter_widget.ui')
        loadUi(ui_file, self)
        self.setObjectName('CustomFilterWidget')
        self._parentfilter = parentfilter  # When data is changed it is stored in the parent filter

        # keep color for highlighted items even when not active
        for list_widget in [self.severity_list, self.node_list, self.topic_list]:
            active_color = list_widget.palette().brush(QPalette.Active, QPalette.Highlight).color().name()
            list_widget.setStyleSheet('QListWidget:item:selected:!active { background: %s; }' % active_color)

        # Text Filter Initialization
        self.text_edit.textChanged.connect(self.handle_text_changed)
        self.regex_check_box.clicked[bool].connect(self.handle_regex_clicked)
        self.handle_text_changed()

        # Severity Filter Initialization
        self.severity_list.itemSelectionChanged.connect(self.handle_severity_item_changed)
        new_items = item_providers[0]()
        for key in sorted(new_items.keys()):
            item = new_items[key]
            self.severity_list.addItem(item)
            self.severity_list.item(self.severity_list.count() - 1).setData(Qt.UserRole, key)

        # Node Filter Initialization
        self._node_list_populate_function = item_providers[1]
        self.node_list.itemSelectionChanged.connect(self.handle_node_item_changed)

        # Topic Filter Initialization
        self._topic_list_populate_function = item_providers[2]
        self.topic_list.itemSelectionChanged.connect(self.handle_topic_item_changed)

        self.repopulate()
开发者ID:Rescube,项目名称:rqt_common_plugins,代码行数:34,代码来源:custom_filter_widget.py


示例12: __init__

  def __init__(self, pr2_interface):
    # Initialize the WindowManager base class. The WindowManager class
    # creates the _widget object that will be used by this window and
    # guarantees successful shutdown of rqt upon program termination.
    super(SensorWindowManager, self).__init__(pr2_interface)

    # Keep track of the lowest and highest value received so far to use for
    # graphing relative sensor intensity.
    self._low_data_values = {'force':None, 'fluid_pressure':None, 'microvibration':None,
                             'temperature':None, 'thermal_flux':None}
    self._high_data_values = {'force':None, 'fluid_pressure':None, 'microvibration':None,
                             'temperature':None, 'thermal_flux':None}

    # 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_pr2_hand_syntouch_sensor_interface'), 'resource', 'sensorvisualizer.ui')

    # Extend the widget with all attributes and children from UI file
    loadUi(ui_file, self._widget)

    # Give QObjects reasonable names
    self._widget.setObjectName('SensorVisualizerWindow')

    self._widget.setWindowTitle('Sensor Visualizer')

    # Add widget to the user interface
    user_interface = pr2_interface.get_user_interface()
    user_interface.add_widget(self._widget)

    # Create a thread that will update the sensor visualization bar graph.
    self._worker = threading.Thread(target=self.draw_bar_graphs)
    self._worker.start()
开发者ID:BigMacStorm,项目名称:PR2_hapticSensorResearch,代码行数:33,代码来源:sensor_window_manager.py


示例13: __init__

 def __init__(self, topics):
     super(HistogramPlotWidget, self).__init__()
     self.setObjectName('HistogramPlotWidget')
     rp = rospkg.RosPack()
     ui_file = os.path.join(rp.get_path('jsk_rqt_plugins'), 
                            'resource', 'plot_histogram.ui')
     loadUi(ui_file, self)
     self.cv_bridge = CvBridge()
     self.subscribe_topic_button.setIcon(QIcon.fromTheme('add'))
     self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))
     self.clear_button.setIcon(QIcon.fromTheme('edit-clear'))
     self.data_plot = MatHistogramPlot(self)
     self.data_plot_layout.addWidget(self.data_plot)
     self._topic_completer = TopicCompleter(self.topic_edit)
     self._topic_completer.update_topics()
     self.topic_edit.setCompleter(self._topic_completer)
     self.data_plot.dropEvent = self.dropEvent
     self.data_plot.dragEnterEvent = self.dragEnterEvent
     self._start_time = rospy.get_time()
     self._rosdata = None
     if len(topics) != 0:
         self.subscribe_topic(topics)
     self._update_plot_timer = QTimer(self)
     self._update_plot_timer.timeout.connect(self.update_plot)
     self._update_plot_timer.start(self._redraw_interval)
开发者ID:CPFL,项目名称:jsk_visualization_packages,代码行数:25,代码来源:hist.py


示例14: __init__

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

        # Create QWidget
        self._widget = QWidget()
        ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'rqt_navigation.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('rqt_navigation')
        # 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.loadComboBoxItems()

        # ROS stuff
        self.veh = rospy.get_param('/veh')
        self.topic_name = '/' + self.veh + '/actions_dispatcher_node/plan_request'
        self.pub = rospy.Publisher(self.topic_name,SourceTargetNodes, queue_size = 1, latch=True)
        self._widget.buttonFindPlan.clicked.connect(self.requestPlan)
开发者ID:Duckietown-NCTU,项目名称:Software,代码行数:27,代码来源:rqt_navigation.py


示例15: __init__

    def __init__(self):
        super(MainWidget, self).__init__()
        self.setObjectName('MainWidget')

        rospack = rospkg.RosPack()
        ui_file = rospack.get_path('rqt_joint_trajectory_plot')+'/resource/JointTrajectoryPlot.ui'
        loadUi(ui_file, self)

        self.refresh_button.setIcon(QIcon.fromTheme('reload'))
        self.pause_button.setIcon(QIcon.fromTheme('media-playback-pause'))

        self.handler = None
        self.joint_names = []
        self.timer = QTimer(self)
        self.timer.timeout.connect(self.update)
        self.plot_widget = PlotWidget(self)
        self.plot_layout.addWidget(self.plot_widget)
        self.draw_curves.connect(self.plot_widget.draw_curves)

        self.time = None
        (self.dis, self.vel, self.acc, self.eff) = ({}, {}, {}, {})

        # refresh topics list in the combobox
        self.refresh_topics()
        self.change_topic()

        self.refresh_button.clicked.connect(self.refresh_topics)
        self.topic_combox.currentIndexChanged.connect(self.change_topic)
        self.select_tree.itemChanged.connect(self.update_checkbox)
开发者ID:aaravrav142,项目名称:rqt_joint_trajectory_plot,代码行数:29,代码来源:main_widget.py


示例16: __init__

 def __init__(self, mcptam_namespace='mcptam'):
   
   # Init QWidget
   super(SysmonWidget, self).__init__()
   self.setObjectName('SysmonWidget')
   
   # load UI
   ui_file = os.path.join(rospkg.RosPack().get_path('artemis_sysmon'), 'resource', 'widget.ui')
   loadUi(ui_file, self)
           
   # Subscribe to ROS topics and register callbacks
   self._slam_info_sub = rospy.Subscriber(mcptam_namespace+'/system_info', SystemInfo, self.slam_info_cb)
   self._slam_tracker_sub = rospy.Subscriber(mcptam_namespace+'/tracker_state', TrackerState, self.slam_tracker_cb)
   
   # Initialize service call
   print('Waiting for MAV services')
   rospy.wait_for_service(mcptam_namespace+'/init')
   rospy.wait_for_service(mcptam_namespace+'/reset')
   print('Connected to SLAM system')
   self._slam_init_srv = rospy.ServiceProxy(mcptam_namespace+'/init', Empty)
   self._slam_reset_srv = rospy.ServiceProxy(mcptam_namespace+'/reset', Reset)
  
   # init and start update timer for data, the timer calls the function update_info all 40ms    
   self._update_info_timer = QTimer(self)
   self._update_info_timer.timeout.connect(self.update_info)
   self._update_info_timer.start(40)
   
   # set the functions that are called when a button is pressed
   self.button_start.pressed.connect(self.on_start_button_pressed)
   self.button_reset.pressed.connect(self.on_reset_button_pressed)
   self.button_quit.pressed.connect(self.on_quit_button_pressed)
开发者ID:ProjectArtemis,项目名称:artemis_sysmon,代码行数:31,代码来源:sysmon_widget.py


示例17: __init__

    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)
开发者ID:AriYu,项目名称:rqt_mypkg,代码行数:35,代码来源:my_module.py


示例18: __init__

    def __init__(self, mode=rosmsg.MODE_MSG,
                 pkg_name='rqt_msg',
                 ui_filename='messages.ui'):
        """
        :param ui_filename: This Qt-based .ui file must have elements that are
                            referred from this class. Otherwise unexpected
                            errors are likely to happen. Best way to avoid that
                            situation when you want to give your own .ui file
                            is to implement all Qt components in
                            rqt_msg/resource/message.ui file.
        """

        super(MessagesWidget, self).__init__()
        self._rospack = rospkg.RosPack()
        ui_file = os.path.join(self._rospack.get_path(pkg_name), 'resource', ui_filename)
        loadUi(ui_file, self, {'MessagesTreeView': MessagesTreeView})
        self.setObjectName(ui_filename)
        self._mode = mode

        self._add_button.setIcon(QIcon.fromTheme('list-add'))
        self._add_button.clicked.connect(self._add_message)
        self._refresh_packages(mode)
        self._refresh_msgs(self._package_combo.itemText(0))
        self._package_combo.currentIndexChanged[str].connect(self._refresh_msgs)
        self._messages_tree.mousePressEvent = self._handle_mouse_press

        self._browsers = []
开发者ID:suryaprakaz,项目名称:rospy_android,代码行数:27,代码来源:messages_widget.py


示例19: __init__

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

        # Create the widget and name it
        self._widget = QtGui.QWidget()
        self._widget.setObjectName("Shooter")
        self.setObjectName("Shooter")

        # Extend the widget with all attributes and children in the UI file
        ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "shooter.ui")
        loadUi(ui_file, self._widget)

        self.remote = RemoteControl("shooter gui")
        self.remote.is_timed_out = True

        self.shooter_status = {
            "received": "Unknown",
            "stamp": rospy.Time.now(),
            "cached": "Unknown"
        }

        self.disc_speed_setting = 0

        self.connect_ui()

        rospy.Subscriber("/shooter/status", String, self.cache_shooter_status)

        # 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)
开发者ID:whispercoros,项目名称:Navigator,代码行数:35,代码来源:shooter.py


示例20: __init__

    def __init__(self):
        super(WaypointWidget, self).__init__()
        # Give QObjects reasonable names
        try:
            rospy.wait_for_service('/proc_control/set_global_target', timeout=2)
            rospy.wait_for_service('/proc_navigation/set_depth_offset',timeout=2)
            rospy.wait_for_service('/proc_navigation/set_world_x_y_offset', timeout=2)
        except rospy.ROSException:
            False

        self.setObjectName('WaypointWidget')

        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_waypoint'), 'resource', 'Mainwindow.ui')
        loadUi(ui_file, self)

        self.setObjectName('MyWaypointWidget')

        self._odom_subscriber = rospy.Subscriber('/proc_navigation/odom', Odometry, self._odom_callback)
        self.position_target_subscriber = rospy.Subscriber('/proc_control/current_target', PositionTarget,
                                                           self._position_target_callback)

        self.set_global_target = rospy.ServiceProxy('/proc_control/set_global_target', SetPositionTarget)
        self.set_initial_depth = rospy.ServiceProxy('/proc_navigation/set_depth_offset', SetDepthOffset)
        self.set_initial_position = rospy.ServiceProxy('/proc_navigation/set_world_x_y_offset', SetWorldXYOffset)

        self.xPositionTarget.returnPressed.connect(self.send_position)
        self.yPositionTarget.returnPressed.connect(self.send_position)
        self.zPositionTarget.returnPressed.connect(self.send_position)
        self.rollPositionTarget.returnPressed.connect(self.send_position)
        self.pitchPositionTarget.returnPressed.connect(self.send_position)
        self.yawPositionTarget.returnPressed.connect(self.send_position)

        self.actionReset_Depth.triggered.connect(self._reset_depth)
        self.actionReset_Position.triggered.connect(self._reset_position)
开发者ID:sonia-auv,项目名称:rqt_sonia_plugins,代码行数:34,代码来源:WaypointWidget.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python QtCore.qDebug函数代码示例发布时间:2022-05-27
下一篇:
Python python_mysql_dbconfig.read_db_config函数代码示例发布时间: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