def __init__(self, parent, cmdp, state_preference):
        QtWidgets.QWidget.__init__(self, parent)
        self._cmdp = cmdp
        self._buttons = []
        self.setObjectName("WaveformControlWidget")
        self._layout = QtWidgets.QHBoxLayout(self)
        self._layout.setObjectName("WaveformControlLayout")
        self._layout.setContentsMargins(-1, 1, -1, 1)

        self._markers_label = QtWidgets.QLabel(self)
        self._markers_label.setText('Markers:')
        self._layout.addWidget(self._markers_label)

        self._add_button('Add Single', self._on_markers_single_add,
                         TOOLTIP_MARKER_SINGLE_ADD)
        self._add_button('Add Dual', self._on_markers_dual_add,
                         TOOLTIP_MARKER_DUAL_ADD)
        self._add_button('Clear', self._on_markers_clear, TOOLTIP_MARKER_CLEAR)

        self._x_axis_label = QtWidgets.QLabel(self)
        self._x_axis_label.setText('X-Axis:')
        self._layout.addWidget(self._x_axis_label)

        self._add_zoom_icon('zoom_in', self._on_x_axis_zoom_in,
                            TOOLTIP_X_AXIS_ZOOM_IN)
        self._add_zoom_icon('zoom_out', self._on_x_axis_zoom_out,
                            TOOLTIP_X_AXIS_ZOOM_OUT)
        self._add_zoom_icon('zoom_all', self._on_x_axis_zoom_all,
                            TOOLTIP_X_AXIS_ZOOM_ALL)

        self._show_min_max_label = QtWidgets.QLabel(self)
        self._show_min_max_label.setText('Min/Max:')
        self._layout.addWidget(self._show_min_max_label)

        self._show_min_max = widget_factory(self._cmdp,
                                            'Widgets/Waveform/show_min_max')
        self._show_min_max_widget = self._show_min_max.widget_construct(self)
        self._layout.addWidget(self._show_min_max_widget)

        self._signals_label = QtWidgets.QLabel(self)
        self._signals_label.setText('Signals:')
        self._layout.addWidget(self._signals_label)
        self._signals = {}
        for signal in signal_def:
            self._add_signal(signal)

        self._spacer = QtWidgets.QSpacerItem(40, 20,
                                             QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self._layout.addItem(self._spacer)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Minimum)
        h = self.minimumSizeHint().height()
        self.setMinimumHeight(h)
        self.setMaximumHeight(h)
        self.updateGeometry()
        self._cmdp.subscribe('Widgets/Waveform/_signals',
                             self._on_signals_active,
                             update_now=True)
예제 #2
0
 def _parameters_populate(self):
     self._parameters_clean()
     for topic, value in self._cmdp.preferences.flatten().items():
         if not topic.startswith('Device/parameter/') or topic[-1] == '/':
             continue
         widget = widget_factory(self._cmdp, topic)
         if widget is not None:
             widget.populate(self._parameters_widget)
             self._parameters[topic] = widget
     self._parameters_layout.activate()
예제 #3
0
    def __init__(self, parent, cmdp, state_preference):
        QtWidgets.QWidget.__init__(self, parent)
        self._cmdp = cmdp
        self.setObjectName("WaveformControlWidget")
        self._layout = QtWidgets.QHBoxLayout(self)
        self._layout.setObjectName("horizontalLayout")

        self._markers_label = QtWidgets.QLabel(self)
        self._markers_label.setText('Add Markers:')
        self._markers_signal_button = QtWidgets.QPushButton(self)
        self._markers_signal_button.setText('Single')
        self._markers_signal_button.setToolTip(TOOLTIP_MARKER_SINGLE_ADD)
        self._markers_dual_button = QtWidgets.QPushButton(self)
        self._markers_dual_button.setText('Dual')
        self._markers_dual_button.setToolTip(TOOLTIP_MARKER_DUAL_ADD)
        self._layout.addWidget(self._markers_label)
        self._layout.addWidget(self._markers_signal_button)
        self._layout.addWidget(self._markers_dual_button)

        self._x_axis_label = QtWidgets.QLabel(self)
        self._x_axis_label.setText('X-Axis:')
        self._x_axis_zoom_in_button = QtWidgets.QPushButton(self)
        self._x_axis_zoom_in_button.setToolTip(TOOLTIP_X_AXIS_ZOOM_IN)
        # self._x_axis_zoom_in_button.setText('Zoom In')
        self._x_axis_zoom_out_button = QtWidgets.QPushButton(self)
        self._x_axis_zoom_out_button.setToolTip(TOOLTIP_X_AXIS_ZOOM_OUT)
        # self._x_axis_zoom_out_button.setText('Zoom Out')

        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/joulescope/resources/zoom_in_128.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self._x_axis_zoom_in_button.setIcon(icon1)

        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/joulescope/resources/zoom_out_128.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self._x_axis_zoom_out_button.setIcon(icon2)

        self._layout.addWidget(self._x_axis_label)
        self._layout.addWidget(self._x_axis_zoom_in_button)
        self._layout.addWidget(self._x_axis_zoom_out_button)

        self._show_min_max_label = QtWidgets.QLabel(self)
        self._show_min_max_label.setText('Min/Max:')
        self._show_min_max_widget = QtWidgets.QWidget(self)
        self._show_min_max = widget_factory(self._cmdp, 'Widgets/Waveform/show_min_max')
        self._show_min_max_widget = self._show_min_max.widget_construct(self)
        self._layout.addWidget(self._show_min_max_label)
        self._layout.addWidget(self._show_min_max_widget)

        self._spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self._layout.addItem(self._spacer)
        # self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.updateGeometry()
        height = self.height() + 10
        self.setMinimumHeight(height)
        self.setMaximumHeight(height)

        self._x_axis_zoom_in_button.clicked.connect(self._on_x_axis_zoom_in)
        self._x_axis_zoom_out_button.clicked.connect(self._on_x_axis_zoom_out)
        self._markers_signal_button.clicked.connect(self._on_markers_single_add)
        self._markers_dual_button.clicked.connect(self._on_markers_dual_add)