Example #1
0
 def node_ui_created(self, lnode):
     panel = self.__client.guimgr().create_widget(lnode,
                                                  lnode.plugin().panel())
     panel.setup_widget()
     #self.__panels[lnode.path()] = panel
     #self.addWidget(panel)
     scroll = QtWidgets.QScrollArea()
     scroll.setWidget(panel)
     scroll.setWidgetResizable(True)
     self.__panels[lnode.path()] = scroll
     self.addWidget(scroll)
Example #2
0
    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()