def main(sys_argv): parser = argparse.ArgumentParser( description='Autoware Launcher Plugin Editor') parser.add_argument("plugin", help="plugin file path") args = parser.parse_args() application = QtWidgets.QApplication(sys_argv) wizard = QtWidgets.QWizard() wizard.setWindowTitle("Plugin Editor") wizard.addPage(LaunchFileSelect()) wizard.show() return application.exec_()
def main(sys_argv): if len(sys_argv) < 2: print("missing plugin file path") return 2 application = QtWidgets.QApplication(sys_argv) widget = PluginEditWidget() ynode = plugin.AwPluginNode(None, sys_argv[1]) ynode.load(myutils.package("plugins")) xnode = load_launch_xml(ynode.rosxml()) fields = [PluginEditField(child.attrib) for child in xnode if child.tag == "arg"] for field in fields: widget.add_field(field) widget.add_button() for field in ynode.args(): widget.set_yaml(field) widget.show() return application.exec_()
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_()
#!/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_())