示例#1
0
    def __init__(self, oscillo, parent):
        super(OscilloWidget, self).__init__(oscillo, parent)

        self.driver = oscillo
        self.avg_on = False

        self.counter = 0

        self.data_path = parent.data_path

        # Layouts
        self.splitterV_1 = QtGui.QVBoxLayout()
        self.auto_scale_layout = QtGui.QHBoxLayout()

        self.tabs = QtGui.QTabWidget()
        self.control = QtGui.QWidget()
        self.tabs.addTab(self.control, "Control")

        self.calibration_widget = CalibrationWidget(self.driver,
                                                    data_path=self.data_path)
        self.tabs.addTab(self.calibration_widget, "Calibration")

        self.plotWid = KPlotWidget(self.driver, name="data")

        # Widgets : Buttons, Sliders, PlotWidgets

        self.save_box = QtGui.QGroupBox("Save")

        self.auto_scale_button = QtGui.QPushButton('Auto scale')
        self.auto_scale_button.setStyleSheet('QPushButton {color: green;}')
        self.auto_scale_button.setFixedWidth(312)

        # Add Widgets to layout
        self.set_axis()
        self.left_panel_layout.insertWidget(1, self.plotWid, 1)
        self.select_channel_widget = SelectChannelWidget(self.plotWid)
        self.display_box = QtGui.QGroupBox("Display")
        self.display_box.setLayout(self.select_channel_widget.layout)

        self.math_widget = MathWidget(self.driver, self.plotWid)
        self.math_box = QtGui.QGroupBox("Math")
        self.math_box.setLayout(self.math_widget.layout)

        self.stats_widget = StatsWidget(self.driver)

        self.cursors_box = QtGui.QGroupBox('Cursors')
        self.cursor_widget = CursorWidget(self.plotWid)
        self.cursors_box.setLayout(self.cursor_widget.layout)

        # Save widget
        self.save_widget = SaveWidget(self)
        self.save_box.setLayout(self.save_widget.layout)

        self.auto_scale_layout.addWidget(self.auto_scale_button,
                                         QtCore.Qt.AlignCenter)
        self.splitterV_1.addWidget(self.display_box)
        self.splitterV_1.addLayout(self.stats_widget.layout)
        self.splitterV_1.addWidget(self.cursors_box)
        self.splitterV_1.addLayout(self.auto_scale_layout)
        self.splitterV_1.addWidget(self.math_box)
        self.splitterV_1.addWidget(self.save_box)
        self.splitterV_1.addStretch(1)
        self.control.setLayout(self.splitterV_1)

        self.right_panel.addWidget(self.tabs)

        self.right_panel_widget.setLayout(self.right_panel)

        self.auto_scale_button.clicked.connect(self.auto_scale)