def __init__(self, timeline, parent, topic): MessageView.__init__(self, timeline, topic) self._parent = parent self._stamp = None self._name = parent.objectName() self.toolbar = QToolBar() self._first_action = QAction(QIcon.fromTheme('go-first'), '', self.toolbar) self._first_action.triggered.connect(self.navigate_first) self.toolbar.addAction(self._first_action) self._prev_action = QAction(QIcon.fromTheme('go-previous'), '', self.toolbar) self._prev_action.triggered.connect(self.navigate_previous) self.toolbar.addAction(self._prev_action) self._next_action = QAction(QIcon.fromTheme('go-next'), '', self.toolbar) self._next_action.triggered.connect(self.navigate_next) self.toolbar.addAction(self._next_action) self._last_action = QAction(QIcon.fromTheme('go-last'), '', self.toolbar) self._last_action.triggered.connect(self.navigate_last) self.toolbar.addAction(self._last_action) parent.layout().addWidget(self.toolbar)
def __init__(self, context): super(Dashboard, self).__init__(context) self.context = context self.setup(context) if not hasattr(self, 'name'): self.name = 'Dashboard' if not hasattr(self, 'max_icon_size'): self.max_icon_size = QSize(50, 30) self._main_widget = QToolBar() self._main_widget.setIconSize(self.max_icon_size) self._main_widget.setObjectName(self.name) self._main_widget.setWindowTitle(self.name) if context.serial_number() > 1: self._main_widget.setWindowTitle(self._main_widget.windowTitle() + (' (%d)' % context.serial_number())) widgets = self.get_widgets() self._widgets = [] for v in widgets: for i in v: try: self._main_widget.addWidget(i) self._widgets.append(i) except: raise Exception( "All widgets must be a subclass of QWidget!") self._main_widget.addSeparator() # Display the dashboard context.add_toolbar(self._main_widget)
def __init__(self, context): super(EusGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('EusGUI') self.msg = None # Create a container widget and give it a layout self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('EusGUI')) self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) self._prev_button = QPushButton('PREV') self._prev_button.clicked.connect(self._prev_cb) self._layout.addWidget(self._prev_button) self._refresh_button = QPushButton('DO IT AGAIN') self._refresh_button.clicked.connect(self._refresh_cb) self._layout.addWidget(self._refresh_button) self._next_button = QPushButton('NEXT') self._next_button.clicked.connect(self._next_cb) self._layout.addWidget(self._next_button) context.add_widget(self._container)
def embed_toolbar(self, pid, toolbar_object_name): toolbar = QToolBar() toolbar.setObjectName(toolbar_object_name) embed_container = QX11EmbedContainer(toolbar) toolbar.addWidget(embed_container) #embed_container.clientClosed.connect(self._emit_close_signal) self._add_toolbar(toolbar) self._embed_containers[toolbar_object_name] = embed_container # setup mapping to signal change of orientation to client self._embed_toolbars[toolbar_object_name] = toolbar self._signal_mapper_toolbars.setMapping(toolbar, toolbar_object_name) toolbar.orientationChanged.connect(self._signal_mapper_toolbars.map) return embed_container.winId()
def __init__(self, context): super(ImageSnapShotGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('ImageSnapShotGUI') # 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()) self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('ImageSnapShot')) # Create a container widget and give it a layout self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) # Add a button for .... self._go_button = QPushButton('Head') self._go_button.clicked.connect(self._head) self._layout.addWidget(self._go_button) self._clear_button = QPushButton('Larm') self._clear_button.clicked.connect(self._larm) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('Rarm') self._clear_button.clicked.connect(self._rarm) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('L FishEye') self._clear_button.clicked.connect(self._lfisheye) self._layout.addWidget(self._clear_button) self._clear_button = QPushButton('R FishEye') self._clear_button.clicked.connect(self._rfisheye) self._layout.addWidget(self._clear_button) # self._step_run_button.setStyleSheet('QPushButton {color: black}') context.add_widget(self._container) self._head_pub = rospy.Publisher('/head_snap/snapshot', std_msgs.msg.Empty) self._lhand_pub = rospy.Publisher('/lhand_snap/snapshot', std_msgs.msg.Empty) self._rhand_pub = rospy.Publisher('/rhand_snap/snapshot', std_msgs.msg.Empty) self._lfisheye_pub = rospy.Publisher('/lfisheye_snap/snapshot', std_msgs.msg.Empty) self._rfisheye_pub = rospy.Publisher('/rfisheye_snap/snapshot', std_msgs.msg.Empty)
def __init__(self, context): super(TriangleGUI, self).__init__(context) # Give QObjects reasonable names self.setObjectName('TriangleGUI') # 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()) self._toolbar = QToolBar() self._toolbar.addWidget(QLabel('Triangle')) # Create a container widget and give it a layout self._container = QWidget() self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) # Add a button for killing nodes self._go_button = QPushButton('Go') self._go_button.clicked.connect(self._go) self._layout.addWidget(self._go_button) self._clear_button = QPushButton('Clear') self._clear_button.clicked.connect(self._clear) self._layout.addWidget(self._clear_button) # self._step_run_button.setStyleSheet('QPushButton {color: black}') context.add_widget(self._container)
def __init__(self, context): super(Top, self).__init__(context) # Give QObjects reasonable names self.setObjectName('Top') # 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 self._selected_node = '' self._selected_node_lock = RLock() # Setup the toolbar self._toolbar = QToolBar() self._filter_box = QLineEdit() self._regex_box = QCheckBox() self._regex_box.setText('regex') self._toolbar.addWidget(QLabel('Filter')) self._toolbar.addWidget(self._filter_box) self._toolbar.addWidget(self._regex_box) self._filter_box.returnPressed.connect(self.update_filter) self._regex_box.stateChanged.connect(self.update_filter) # Create a container widget and give it a layout self._container = QWidget() self._container.setWindowTitle('Process Monitor') self._layout = QVBoxLayout() self._container.setLayout(self._layout) self._layout.addWidget(self._toolbar) # Create the table widget self._table_widget = QTreeWidget() self._table_widget.setObjectName('TopTable') self._table_widget.setColumnCount(len(self.NODE_LABELS)) self._table_widget.setHeaderLabels(self.NODE_LABELS) self._table_widget.itemClicked.connect(self._tableItemClicked) self._table_widget.setSortingEnabled(True) self._table_widget.setAlternatingRowColors(True) self._layout.addWidget(self._table_widget) context.add_widget(self._container) # Add a button for killing nodes self._kill_button = QPushButton('Kill Node') self._layout.addWidget(self._kill_button) self._kill_button.clicked.connect(self._kill_node) # Update twice since the first cpu% lookup will always return 0 self.update_table() self.update_table() self._table_widget.resizeColumnToContents(0) # Start a timer to trigger updates self._update_timer = QTimer() self._update_timer.setInterval(1000) self._update_timer.timeout.connect(self.update_table) self._update_timer.start()