def setupUi(self, MainWindow): self.lock = Lock() self.talker = Talker('taskview') rospy.Subscriber('BbSync', bbsynch, self.taskview) MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.listView = QtWidgets.QListWidget(self.centralwidget) self.listView.setGeometry(QtCore.QRect(10, 40, 771, 521)) self.listView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.listView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.listView.setObjectName("listView") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(10, 10, 67, 17)) self.label.setObjectName("label") MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.tasklist = [] self.markers = rviz_tools.RvizMarkers('/map', 'markers')
def __init__(self, context): super(Shooter, self).__init__(context) # Create the widget and name it self._widget = QtWidgets.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) # Deals with problem of multiple instances of same plugin 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 __init__(self, guimgr, launch, parent): super(AwPluginRemoveWindow, self).__init__(parent) self.guimgr = guimgr self.node = launch settings = QtCore.QSettings("Autoware", "AutowareLauncher") if settings.contains("geometry"): self.restoreGeometry(settings.value("geometry")) # select self.nodelist = QtWidgets.QListWidget() for child in self.node.children(): self.nodelist.addItem(child.name()) # footer cancel = QtWidgets.QPushButton("Cancel") cancel.clicked.connect(self.close) remove = QtWidgets.QPushButton("Remove") remove.clicked.connect(self.remove_launch_node) footer = QtWidgets.QHBoxLayout() footer.addStretch() footer.addWidget(cancel) footer.addWidget(remove) # widget layout = QtWidgets.QVBoxLayout() layout.addWidget(self.nodelist) layout.addLayout(footer) widget = QtWidgets.QWidget() widget.setLayout(layout) self.setCentralWidget(widget) self.setWindowTitle("Remove Launch Node")
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 = QtWidgets.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('robot_rqt_plugin'), 'resource', '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) # Sets up the functions to be called on clicking on buttons self._widget.hard_stop.clicked[bool].connect(self._hardstop) self._widget.soft_stop.clicked[bool].connect(self._softstop) self._widget.control.clicked[bool].connect(self._switchmode) # Sets up the variables and the text label self.mode_val = False self.soft_stop = False self.decide_text() # Sets the topics and the publishing rate self.control_publisher = rospy.Publisher("control_mode", Bool, queue_size=0) self.stop_publisher = rospy.Publisher("soft_stop", Bool, queue_size=0) self.rate = rospy.Rate(10) # Starts a thread to run in parallel publishing messages threading.Thread(target=self.publish_manually).start()
def __frame_setup(self, widget): widget.title = QtWidgets.QLabel("No Title") widget.title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) layout = self.create_frame_header_hlayout() layout.addWidget(widget.title) widget.header = QtWidgets.QWidget() widget.header.setObjectName("FrameHeader") widget.header.setLayout(layout) layout = self.create_frame_entire_vlayout() layout.addWidget(widget.header) widget.setLayout(layout)
def __init__(self, guimgr, node, view): super(AwTransformFrame, self).__init__(guimgr, node, view) super(AwTransformFrame, self).setup_widget() self.set_title(frame_title(self.view, "Transform")) widget = QtWidgets.QWidget() widget.setLayout(QtWidgets.QHBoxLayout()) for idx, txt in enumerate(["Tx", "Ty", "Tz", "Rx", "Ry", "Rz"]): field = AwRealField(self.node.get_config(self.view.target[idx])) field.target = self.view.target[idx] field.value_updated.connect(self.apply) widget.layout().addWidget(QtWidgets.QLabel(txt + ":")) widget.layout().addWidget(field) self.add_widget(widget)
def __setup_widget(self): # Frame Header self.title = QtWidgets.QLabel("No Title") self.title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) layout = self.guimgr.create_frame_header_hlayout() layout.addWidget(self.title) self.header = QtWidgets.QWidget() self.header.setObjectName("FrameHeader") self.header.setLayout(layout) # Frame Layout layout = self.guimgr.create_frame_entire_vlayout() layout.addWidget(self.header) self.setLayout(layout)
def __init__(self, context): super(InputPlugin, self).__init__(context) # Give QObjects reasonable names self.setObjectName('InputPlugin') # 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 = QtWidgets.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('roboteam_input'), 'resource', 'InputPlugin.ui') # Extend the widget with all attributes and children from UI file loadUi(ui_file, self._widget) # Give QObjects reasonable names self._widget.setObjectName('InputPluginUi') # 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._input_widgets = [] for i in range(0, 4): new_input = input_widget.InputWidget(i) self._input_widgets.append(new_input) self._widget.layout().addWidget(new_input) # Add widget to the user interface context.add_widget(self._widget)
def __panel_setup(self, widget, spacer): footer_layout = QtWidgets.QHBoxLayout() footer_layout.setContentsMargins(2, 2, 2, 2) footer_layout.setSpacing(2) footer_layout.addStretch() widget.footer = QtWidgets.QWidget() widget.footer.setLayout(footer_layout) widget_layout = QtWidgets.QVBoxLayout() widget_layout.setContentsMargins(16, 16, 16, 16) widget_layout.setSpacing(16) if not spacer: widget_layout.addStretch() else: widget_layout.addWidget(spacer) widget_layout.addWidget(widget.footer) widget.setLayout(widget_layout)
def __setup_widget(self): self.window().setWindowTitle(self.__class__.__name__) # Panel Footer layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(2, 2, 2, 2) layout.setSpacing(2) layout.addStretch() self.footer = QtWidgets.QWidget() self.footer.setLayout(layout) # Panel Layout layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(16, 16, 16, 16) layout.setSpacing(16) layout.addStretch() layout.addWidget(self.footer) self.setLayout(layout)
def __init__(self, context): super(Dashboard, self).__init__(context) # Create the widget and name it self._widget = QtWidgets.QWidget() self._widget.setObjectName("Dashboard") self.setObjectName("Dashboard") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "dashboard.ui") loadUi(ui_file, self._widget) self.remote = RemoteControl("dashboard") # Creates dictionaries that are used by the monitor functions to keep track of their node or service node_monitor_template = { "current": "Unknown", "displayed": "Unknown", } self.operating_mode = copy(node_monitor_template) self.battery_voltage = copy(node_monitor_template) self.kill_status = copy(node_monitor_template) self.kill_status["current"] = True self.system_time = copy(node_monitor_template) self.hosts = node_monitor_template.copy() self.clear_hosts() self.connect_ui() self.connect_ros() # Deals with problem when they're multiple instances of Dashboard plugin 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) # Creates monitors that update data on the GUI periodically self.update_gui()
def __init__(self, context): super(Dashboard, self).__init__(context) # Lock used to ensure ROS callbacks are synced with Qt self.lock = threading.Lock() # Create the widget and name it self._widget = QtWidgets.QWidget() self._widget.setObjectName("Dashboard") self.setObjectName("Dashboard") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("mil_missions"), "resource", "dashboard.ui") loadUi(ui_file, self._widget) self.mission_runner_client = ObserveActionClient( '/mission', DoMissionAction) self.mission_runner_client.register_observer_transition_cb( self.transition_cb) self.mission_runner_client.register_observer_feedback_cb( self.feedback_cb) self.current_mission = None self.current_mission_status = '' self.current_mission_mission = '' self.current_mission_result = '' self.connect_ui() self.reload_available_missions(None) # Deals with problem when they're multiple instances of Dashboard plugin 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 show_select_window(self): # window window = QtWidgets.QMainWindow(self) window.setCentralWidget(QtWidgets.QWidget()) window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) window.setWindowModality(QtCore.Qt.ApplicationModal) window.setGeometry(self.window().geometry()) # widget window.setWindowTitle("Create Node") widget = window.centralWidget() widget.setLayout(QtWidgets.QVBoxLayout()) # plugin select pname_select = QtWidgets.QListWidget() for pname in self.rule.plugins: pname_select.addItem(pname) widget.layout().addWidget(QtWidgets.QLabel("Node Type")) widget.layout().addWidget(pname_select) # footer error_label = QtWidgets.QLabel() error_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) cancel_button = QtWidgets.QPushButton("Cancel") select_button = QtWidgets.QPushButton("Select") cancel_button.clicked.connect(window.close) select_button.clicked.connect(self.onselected) footer = QtWidgets.QHBoxLayout() footer.addWidget(error_label) footer.addWidget(cancel_button) footer.addWidget(select_button) widget.layout().addLayout(footer) self.ui_window = window self.ui_error = error_label self.ui_pname = pname_select window.show()
def frame_add_text_widget(self, frame, text): layout = self.create_frame_header_hlayout() layout.addWidget(QtWidgets.QLabel(text)) widget = QtWidgets.QWidget() widget.setLayout(layout) self.frame_add_widget(frame, widget)
def add_text_widget(self, text): layout = self.guimgr.create_frame_header_hlayout() layout.addWidget(QtWidgets.QLabel(text)) widget = QtWidgets.QWidget() widget.setLayout(layout) self.add_widget(widget)
def start(self, profile=None, skin=None): application = QtWidgets.QApplication(self.__sysarg) resolution = application.desktop().screenGeometry() resolution = min(resolution.width(), resolution.height()) skin = skin or "autoware" with open(myutils.package("resources/skins/{}.css").format(skin)) as fp: stylesheet = fp.read() stylesheet += "* { font-size: " + str(resolution/100) + "px; }" application.setStyleSheet(stylesheet) self.__treeview = AwTreeViewPanel(self) # ToDo: consider moving to guimgr self.__control = AwControlPanel(self) # ToDo: consider moving to guimgr self.__summary = AwSummaryPanel(self) # ToDo: consider moving to guimgr self.__process = AwProcessPanel(self) # ToDo: consider moving to guimgr self.__network = AwTcpServerPanel() self.__quickstart = AwQuickStartPanel(self.__guimgr) self.__sim_rosbag = AwRosbagSimulatorWidget(self.__guimgr) self.__sim_lgsvl = AwLgsvlSimulatorWidget (self.__guimgr) self.__sim_gazebo = AwGazeboSimulatorWidget(self.__guimgr) tabwidget = QtWidgets.QTabWidget() tabwidget.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) tabwidget.addTab(self.__summary, "Summary") tabwidget.addTab(self.__process, "Process") #vsplitter = QtWidgets.QSplitter(QtCore.Qt.Vertical) vsplitter = QtWidgets.QWidget() vsplitter.setLayout(QtWidgets.QVBoxLayout()) vsplitter.layout().setContentsMargins(0, 0, 0, 0) vsplitter.layout().setSpacing(0) vsplitter.layout().addWidget(self.__treeview) vsplitter.layout().addWidget(self.__control) self.__develop = QtWidgets.QSplitter(QtCore.Qt.Horizontal) self.__develop.addWidget(vsplitter) self.__develop.addWidget(tabwidget) #mainwidget = QtWidgets.QTabWidget() #mainwidget.addTab(hsplitter, "Profile Edit") #mainwidget.addTab(self.__quickstart, "Quick Start") #mainwidget.addTab(self.__network, "Server Debug") mainwidget = QtWidgets.QStackedWidget() mainwidget.addWidget(self.__quickstart) mainwidget.addWidget(self.__develop) mainwidget.addWidget(self.__network) simulations = QtWidgets.QTabWidget() simulations.addTab(self.__sim_rosbag, "Rosbag") simulations.addTab(self.__sim_lgsvl, "LGSVL") simulations.addTab(self.__sim_gazebo, "Gazebo") mainsplitter = QtWidgets.QSplitter(QtCore.Qt.Vertical) mainsplitter.addWidget(mainwidget) mainsplitter.addWidget(simulations) #dock = QtWidgets.QDockWidget() #dock.setWidget( ) #window.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock) window = AwMainWindow(self) window.setCentralWidget(mainsplitter) window.show() simulations.hide() window.addViewMenu("Simulation", simulations.setVisible) def switch_develop_mode(checked): if checked: mainwidget.setCurrentWidget(self.__develop) else: mainwidget.setCurrentWidget(self.__quickstart) window.addViewMenu("Develop Mode", switch_develop_mode) # Debug #mainwidget.setCurrentWidget(self.__develop) simulations.hide() self.__sim_rosbag.rosbag_file.path.setText(myutils.userhome(".autoware/log/20150324.bag")) # connect objects self.__server.register_runner(self.__process) self.__process.register_server(self.__server) self.__server.register_client(self.__network) self.__network.register_server(self.__server) self.__panels.append(self.__treeview) self.__panels.append(self.__summary) self.__panels.append(self.__process) self.__panels.append(self.__quickstart) self.__treeview.register_select_listener(self.__summary) self.__treeview.register_select_listener(self.__process) self.__treeview.register_select_listener(self.__control) if profile: self.__server.load_profile(profile) else: self.__server.make_profile("root/default") return application.exec_()
def init_buttons(self): added_node_labels = [] if self.tree != None: for node in self.tree.nodes: if node.label in added_node_labels: continue added_node_labels.append(node.label) def get_publish_function(widget, button, other_buttons, node, message_type, message_data): pub = rospy.Publisher(node.get_subscriber_name(), message_type, queue_size=1) class IDContainer: def __init__(self): self.id = 0 id_container = IDContainer() def active_callback(msg): id_container.id = msg.id if isinstance(message_type(), Status): print(node.get_publisher_name()) sub = rospy.Subscriber(node.get_publisher_name(), Active, active_callback) def add_publish_function(): def publish_function(): if message_data != 'NO MESSAGE': msg = message_type() if isinstance(msg, Bool): msg.data = message_data elif isinstance(msg, Status): msg.status = message_data msg.id = id_container.id pub.publish(msg) #print(node.label + ' publishing to ' + node.get_subscriber_name() + ' ' + str(message_data)) self.functions_mutex.acquire() self.functions[node.label] = publish_function self.functions_mutex.release() if message_data == Status.SUCCESS or message_data == True: widget.setStyleSheet("background-color: rgb(0, 255, 0);") elif message_data == Status.RUNNING: widget.setStyleSheet("background-color: rgb(0, 0, 255);") elif message_data == Status.FAILURE or message_data == False: widget.setStyleSheet("background-color: rgb(255, 0, 0);") elif message_data == 'NO MESSAGE': widget.setStyleSheet("background-color: rgb(255, 255, 255);") button.setStyleSheet("background-color: rgb(0, 255, 0);") for b in other_buttons: b.setStyleSheet("background-color: rgb(255, 0, 0);") return add_publish_function if isinstance(node, bt.Action): action_widget = qt.QWidget() action_layout = qt.QHBoxLayout() action_widget.setLayout(action_layout) self.action_layout.addWidget(action_widget) label = qt.QLabel() label.setText(node.label) action_layout.addWidget(label) success_button = qt.QPushButton('SUCCESS') success_button.setStyleSheet("background-color: rgb(255, 0, 0);") action_layout.addWidget(success_button) running_button = qt.QPushButton('RUNNING') running_button.setStyleSheet("background-color: rgb(255, 0, 0);") action_layout.addWidget(running_button) failure_button = qt.QPushButton('FAILURE') failure_button.setStyleSheet("background-color: rgb(255, 0, 0);") action_layout.addWidget(failure_button) no_message_button = qt.QPushButton('NO MESSAGE') no_message_button.setStyleSheet("background-color: rgb(0, 255, 0);") action_layout.addWidget(no_message_button) success_button.clicked.connect(get_publish_function(action_widget, success_button, [running_button, failure_button, no_message_button], node, Status, Status.SUCCESS)) running_button.clicked.connect(get_publish_function(action_widget, running_button, [success_button, failure_button, no_message_button], node, Status, Status.RUNNING)) failure_button.clicked.connect(get_publish_function(action_widget, failure_button, [success_button, running_button, no_message_button], node, Status, Status.FAILURE)) no_message_button.clicked.connect(get_publish_function(action_widget, no_message_button, [success_button, running_button, failure_button], node, Status, 'NO MESSAGE')) elif isinstance(node, bt.Condition): condition_widget = qt.QWidget() condition_layout = qt.QHBoxLayout() condition_widget.setLayout(condition_layout) self.condition_layout.addWidget(condition_widget) label = qt.QLabel() label.setText(node.label) condition_layout.addWidget(label) success_button = qt.QPushButton('SUCCESS') success_button.setStyleSheet("background-color: rgb(255, 0, 0);") condition_layout.addWidget(success_button) failure_button = qt.QPushButton('FAILURE') failure_button.setStyleSheet("background-color: rgb(255, 0, 0);") condition_layout.addWidget(failure_button) no_message_button = qt.QPushButton('NO MESSAGE') no_message_button.setStyleSheet("background-color: rgb(0, 255, 0);") condition_layout.addWidget(no_message_button) success_button.clicked.connect(get_publish_function(condition_widget, success_button, [failure_button, no_message_button], node, Bool, True)) failure_button.clicked.connect(get_publish_function(condition_widget, failure_button, [success_button, no_message_button], node, Bool, False)) no_message_button.clicked.connect(get_publish_function(condition_widget, no_message_button, [success_button, failure_button], node, Bool, 'NO MESSAGE'))
def __init__(self, context): super(BehaviorTreePlugin, self).__init__(context) self.setObjectName('BehaviorTreePlugin') self.tree = None self.initialized_buttons = False self.prev_graphviz = '' self.behavior_tree_graphviz_sub = rospy.Subscriber('behavior_tree_graphviz', String, self.behavior_tree_graphviz_callback) self.timer = rospy.Timer(rospy.Duration(0.1), self.timer_callback) self.functions_mutex = Lock() self.functions = {} self.last_graphviz_string = '' self.widget = QWidget() self.vbox = qt.QVBoxLayout() self.widget.setLayout(self.vbox) context.add_widget(self.widget) #self.widget.setStyleSheet('QWidget{margin-left:-1px;}') self.top_widget = qt.QWidget() self.top_layout = qt.QVBoxLayout() self.top_widget.setLayout(self.top_layout) self.graph_widget = qt.QWidget() self.graph_layout = qt.QVBoxLayout() self.graph_widget.setLayout(self.graph_layout) self.image_label = qt.QLabel('asdfadsf') #self.graph_layout.addWidget(self.image_label) self.xdot_widget = DotWidget() self.graph_layout.addWidget(self.xdot_widget) self.top_layout.addWidget(self.graph_widget) self.graph_widget.setStyleSheet("background-color: rgb(255, 255, 255);") self.config_widget = qt.QWidget() self.config_widget.setStyleSheet('QWidget{margin-left:-1px;}') self.config_layout = qt.QHBoxLayout() self.config_widget.setLayout(self.config_layout) self.config_widget.setFixedHeight(50) self.config_button = qt.QPushButton('Open Config...') self.config_button.clicked.connect(self.select_config_file) self.config_layout.addWidget(self.config_button) self.tree_label = qt.QLabel('tree filename: ') self.config_layout.addWidget(self.tree_label) self.debug_checkbox = qt.QCheckBox('Debug Mode') self.config_layout.addWidget(self.debug_checkbox) self.debug_checkbox.stateChanged.connect(self.debug_mode_changed) #self.config_widget.setStyleSheet("background-color: rgb(255, 0, 0);") self.top_layout.addWidget(self.config_widget) #self.vbox.addWidget(self.top_widget) self.button_container_widget = qt.QWidget() self.button_container_layout = qt.QVBoxLayout() self.button_container_widget.setLayout(self.button_container_layout) #self.vbox.addWidget(self.button_container_widget) self.button_widget = qt.QWidget() self.button_layout = qt.QHBoxLayout() self.button_widget.setLayout(self.button_layout) #self.button_widget.setStyleSheet("background-color: rgb(0, 0, 255);") self.condition_widget = qt.QWidget() self.condition_layout = qt.QVBoxLayout() self.condition_widget.setLayout(self.condition_layout) self.button_layout.addWidget(self.condition_widget) self.condition_label = qt.QLabel() self.condition_label.setText('Conditions') self.condition_label.setAlignment(Qt.AlignCenter) self.condition_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold)) self.condition_layout.addWidget(self.condition_label) self.action_widget = qt.QWidget() self.action_layout = qt.QVBoxLayout() self.action_widget.setLayout(self.action_layout) self.button_layout.addWidget(self.action_widget) self.action_label = qt.QLabel() self.action_label.setText('Actions') self.action_label.setAlignment(Qt.AlignCenter) self.action_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold)) self.action_layout.addWidget(self.action_label) self.button_scroll_area = qt.QScrollArea() self.button_scroll_area.setWidget(self.button_widget) #self.button_scroll_area.setFixedHeight(200) #self.button_container_widget.setFixedHeight(200) self.button_container_layout.addWidget(self.button_scroll_area) self.button_widget.setMinimumWidth(self.button_scroll_area.sizeHint().width()) self.button_scroll_area.setWidgetResizable(True) self.horizontal_splitter = qt.QSplitter(core.Qt.Vertical) self.horizontal_splitter.addWidget(self.top_widget) self.horizontal_splitter.addWidget(self.button_container_widget) self.vbox.addWidget(self.horizontal_splitter) self.button_container_widget.hide()
#!/usr/bin/env python import os import sys import rospy import rospkg # binding provider is PyQt5, using its own specific stuff from python_qt_binding import QtWidgets, QtGui, QtCore rospy.init_node("test_qt_binding") app = QtWidgets.QApplication(sys.argv) w = QtWidgets.QWidget() w.resize(250, 150) w.move(300, 300) w.setWindowTitle("test_qt_binding") w.show() sys.exit(app.exec_())
def setupUi(self, MainWindow): ############################################################################################### self.lock = Lock() self.talker = Talker('gui') rospy.Subscriber('bbBackup',bbBackup,self.backupFunction) rospy.Subscriber('clicked_point',PointStamped,self.clickedPintRviz) ############################################################################################### MainWindow.setObjectName("MainWindow") MainWindow.resize(560, 440) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gBnewTask = QtWidgets.QGroupBox(self.centralwidget) self.gBnewTask.setGeometry(QtCore.QRect(10, 60, 541, 291)) self.gBnewTask.setObjectName("gBnewTask") self.gBc = QtWidgets.QGroupBox(self.gBnewTask) self.gBc.setEnabled(False) self.gBc.setGeometry(QtCore.QRect(420, 80, 111, 151)) self.gBc.setObjectName("gBc") self.label_29 = QtWidgets.QLabel(self.gBc) self.label_29.setGeometry(QtCore.QRect(10, 30, 16, 21)) self.label_29.setObjectName("label_29") self.label_30 = QtWidgets.QLabel(self.gBc) self.label_30.setGeometry(QtCore.QRect(10, 90, 21, 21)) self.label_30.setObjectName("label_30") self.label_31 = QtWidgets.QLabel(self.gBc) self.label_31.setGeometry(QtCore.QRect(10, 60, 16, 21)) self.label_31.setObjectName("label_31") self.cx = QtWidgets.QDoubleSpinBox(self.gBc) self.cx.setGeometry(QtCore.QRect(30, 30, 69, 26)) self.cx.setObjectName("cx") self.cx.setRange(-100.0,100.0) self.cy = QtWidgets.QDoubleSpinBox(self.gBc) self.cy.setGeometry(QtCore.QRect(30, 60, 69, 26)) self.cy.setObjectName("cy") self.cy.setRange(-100.0,100.0) self.cz = QtWidgets.QDoubleSpinBox(self.gBc) self.cz.setGeometry(QtCore.QRect(30, 90, 69, 26)) self.cz.setObjectName("cz") self.cz.setRange(-100.0,100.0) self.cw = QtWidgets.QDoubleSpinBox(self.gBc) self.cw.setGeometry(QtCore.QRect(30, 120, 69, 26)) self.cw.setObjectName("cw") self.cw.setRange(-100.0,100.0) self.label_39 = QtWidgets.QLabel(self.gBc) self.label_39.setGeometry(QtCore.QRect(10, 120, 21, 21)) self.label_39.setObjectName("label_39") self.gBb = QtWidgets.QGroupBox(self.gBnewTask) self.gBb.setEnabled(False) self.gBb.setGeometry(QtCore.QRect(300, 80, 111, 151)) self.gBb.setObjectName("gBb") self.label_40 = QtWidgets.QLabel(self.gBb) self.label_40.setGeometry(QtCore.QRect(10, 30, 16, 21)) self.label_40.setObjectName("label_40") self.label_41 = QtWidgets.QLabel(self.gBb) self.label_41.setGeometry(QtCore.QRect(10, 90, 21, 21)) self.label_41.setObjectName("label_41") self.label_42 = QtWidgets.QLabel(self.gBb) self.label_42.setGeometry(QtCore.QRect(10, 60, 16, 21)) self.label_42.setObjectName("label_42") self.bx = QtWidgets.QDoubleSpinBox(self.gBb) self.bx.setGeometry(QtCore.QRect(30, 30, 69, 26)) self.bx.setObjectName("bx") self.bx.setRange(-100.0,100.0) self.by = QtWidgets.QDoubleSpinBox(self.gBb) self.by.setGeometry(QtCore.QRect(30, 60, 69, 26)) self.by.setObjectName("by") self.by.setRange(-100.0,100.0) self.bz = QtWidgets.QDoubleSpinBox(self.gBb) self.bz.setGeometry(QtCore.QRect(30, 90, 69, 26)) self.bz.setObjectName("bz") self.bz.setRange(-100.0,100.0) self.bw = QtWidgets.QDoubleSpinBox(self.gBb) self.bw.setGeometry(QtCore.QRect(30, 120, 69, 26)) self.bw.setObjectName("bw") self.bw.setRange(-100.0,100.0) self.label_43 = QtWidgets.QLabel(self.gBb) self.label_43.setGeometry(QtCore.QRect(10, 120, 21, 21)) self.label_43.setObjectName("label_43") self.gBtaskType = QtWidgets.QGroupBox(self.gBnewTask) self.gBtaskType.setGeometry(QtCore.QRect(10, 80, 161, 151)) self.gBtaskType.setObjectName("gBtaskType") self.radioButton = QtWidgets.QRadioButton(self.gBtaskType) self.radioButton.setEnabled(True) self.radioButton.setGeometry(QtCore.QRect(10, 30, 131, 23)) self.radioButton.setChecked(True) self.radioButton.setObjectName("radioButton") self.radioButton_2 = QtWidgets.QRadioButton(self.gBtaskType) self.radioButton_2.setGeometry(QtCore.QRect(10, 60, 101, 23)) self.radioButton_2.setObjectName("radioButton_2") self.radioButton_3 = QtWidgets.QRadioButton(self.gBtaskType) self.radioButton_3.setGeometry(QtCore.QRect(10, 90, 131, 23)) self.radioButton_3.setObjectName("radioButton_3") self.radioButton_4 = QtWidgets.QRadioButton(self.gBtaskType) self.radioButton_4.setGeometry(QtCore.QRect(10, 120, 141, 23)) self.radioButton_4.setObjectName("radioButton_4") self.gBa = QtWidgets.QGroupBox(self.gBnewTask) self.gBa.setEnabled(True) self.gBa.setGeometry(QtCore.QRect(180, 80, 111, 151)) self.gBa.setObjectName("gBa") self.label_25 = QtWidgets.QLabel(self.gBa) self.label_25.setGeometry(QtCore.QRect(10, 30, 16, 21)) self.label_25.setObjectName("label_25") self.label_26 = QtWidgets.QLabel(self.gBa) self.label_26.setGeometry(QtCore.QRect(10, 90, 21, 21)) self.label_26.setObjectName("label_26") self.label_27 = QtWidgets.QLabel(self.gBa) self.label_27.setGeometry(QtCore.QRect(10, 60, 16, 21)) self.label_27.setObjectName("label_27") self.ax = QtWidgets.QDoubleSpinBox(self.gBa) self.ax.setGeometry(QtCore.QRect(30, 30, 69, 26)) self.ax.setObjectName("ax") self.ax.setRange(-100.0,100.0) self.ay = QtWidgets.QDoubleSpinBox(self.gBa) self.ay.setGeometry(QtCore.QRect(30, 60, 69, 26)) self.ay.setObjectName("ay") self.ay.setRange(-100.0,100.0) self.az = QtWidgets.QDoubleSpinBox(self.gBa) self.az.setGeometry(QtCore.QRect(30, 90, 69, 26)) self.az.setObjectName("az") self.az.setRange(-100.0,100.0) self.aw = QtWidgets.QDoubleSpinBox(self.gBa) self.aw.setGeometry(QtCore.QRect(30, 120, 69, 26)) self.aw.setObjectName("aw") self.aw.setRange(-100.0,100.0) self.label_28 = QtWidgets.QLabel(self.gBa) self.label_28.setGeometry(QtCore.QRect(10, 120, 21, 21)) self.label_28.setObjectName("label_28") self.btnAddTask = QtWidgets.QPushButton(self.gBnewTask) self.btnAddTask.setEnabled(True) self.btnAddTask.setGeometry(QtCore.QRect(10, 240, 521, 31)) self.btnAddTask.setObjectName("btnAddTask") self.widget = QtWidgets.QWidget(self.gBnewTask) self.widget.setGeometry(QtCore.QRect(10, 30, 521, 28)) self.widget.setObjectName("widget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.label_3 = QtWidgets.QLabel(self.widget) self.label_3.setObjectName("label_3") self.horizontalLayout.addWidget(self.label_3) self.sBtaskid = QtWidgets.QSpinBox(self.widget) self.sBtaskid.setObjectName("sBtaskid") self.horizontalLayout.addWidget(self.sBtaskid) self.label_4 = QtWidgets.QLabel(self.widget) self.label_4.setObjectName("label_4") self.horizontalLayout.addWidget(self.label_4) self.sbtaskPriority = QtWidgets.QSpinBox(self.widget) self.sbtaskPriority.setObjectName("sbtaskPriority") self.horizontalLayout.addWidget(self.sbtaskPriority) self.label_5 = QtWidgets.QLabel(self.widget) self.label_5.setObjectName("label_5") self.horizontalLayout.addWidget(self.label_5) self.sbtaskPayload = QtWidgets.QSpinBox(self.widget) self.sbtaskPayload.setObjectName("sbtaskPayload") self.horizontalLayout.addWidget(self.sbtaskPayload) self.gBrobotState = QtWidgets.QGroupBox(self.centralwidget) self.gBrobotState.setGeometry(QtCore.QRect(10, 360, 541, 71)) self.gBrobotState.setObjectName("gBrobotState") self.sBrobotId = QtWidgets.QSpinBox(self.gBrobotState) self.sBrobotId.setGeometry(QtCore.QRect(80, 30, 48, 31)) self.sBrobotId.setObjectName("sBrobotId") self.radioButton_5 = QtWidgets.QRadioButton(self.gBrobotState) self.radioButton_5.setGeometry(QtCore.QRect(140, 32, 61, 31)) self.radioButton_5.setChecked(True) self.radioButton_5.setObjectName("radioButton_5") self.radioButton_6 = QtWidgets.QRadioButton(self.gBrobotState) self.radioButton_6.setGeometry(QtCore.QRect(280, 32, 71, 31)) self.radioButton_6.setObjectName("radioButton_6") self.radioButton_7 = QtWidgets.QRadioButton(self.gBrobotState) self.radioButton_7.setGeometry(QtCore.QRect(210, 32, 51, 31)) self.radioButton_7.setObjectName("radioButton_7") self.btnsetRobotState = QtWidgets.QPushButton(self.gBrobotState) self.btnsetRobotState.setEnabled(True) self.btnsetRobotState.setGeometry(QtCore.QRect(380, 30, 151, 31)) self.btnsetRobotState.setObjectName("btnsetRobotState") self.label_32 = QtWidgets.QLabel(self.gBrobotState) self.label_32.setGeometry(QtCore.QRect(10, 30, 81, 31)) self.label_32.setObjectName("label_32") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(10, 20, 81, 17)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(300, 20, 141, 17)) self.label_2.setObjectName("label_2") self.lblblackBoard = QtWidgets.QLabel(self.centralwidget) self.lblblackBoard.setGeometry(QtCore.QRect(100, 20, 141, 17)) font = QtGui.QFont() font.setItalic(True) self.lblblackBoard.setFont(font) self.lblblackBoard.setObjectName("lblblackBoard") self.lblbackupBlackboard = QtWidgets.QLabel(self.centralwidget) self.lblbackupBlackboard.setGeometry(QtCore.QRect(450, 20, 91, 17)) font = QtGui.QFont() font.setItalic(True) self.lblbackupBlackboard.setFont(font) self.lblbackupBlackboard.setObjectName("lblbackupBlackboard") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) self.currentpint = 1