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


Python python_qt_binding.loadUi函数代码示例

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


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


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