Beispiel #1
0
    def __init__(self, plugin):
        DefaultConfigWidget.__init__(self, plugin)
        c = plugin_prefs[STORE_NAME]

        other_group_box = QGroupBox('Other options', self)
        self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2)
        other_group_box_layout = QGridLayout()
        other_group_box.setLayout(other_group_box_layout)

        # Guess Series
        guess_series_label = QLabel(
            'Guess Series and Series Index from Title:', self)
        guess_series_label.setToolTip('DNB only rarely provides data about a book\'s series.\n'
                                      'This plugin can try to extract series and series_index from the book title.\n')
        other_group_box_layout.addWidget(guess_series_label, 0, 0, 1, 1)

        self.guess_series_checkbox = QtGui.QCheckBox(self)
        self.guess_series_checkbox.setChecked(
            c.get(KEY_GUESS_SERIES, DEFAULT_STORE_VALUES[KEY_GUESS_SERIES]))
        other_group_box_layout.addWidget(
            self.guess_series_checkbox, 0, 1, 1, 1)

        # Append Edition to Title
        append_edition_to_title_label = QLabel(
            'Append Edition to Title:', self)
        append_edition_to_title_label.setToolTip('For some books DNB has information about the edition.\n'
                                                 'This plugin can fetch this information and append it to the book\'s title,\n'
                                                 'e.g. "Mord am Tegernsee : Ein Bayern-Krimi : 2. Aufl.".\n'
                                                 'Of course this only works reliable if you search for a book with a known unique identifier such as dnb-idn or ISBN.')
        other_group_box_layout.addWidget(
            append_edition_to_title_label, 1, 0, 1, 1)

        self.append_edition_to_title_checkbox = QtGui.QCheckBox(self)
        self.append_edition_to_title_checkbox.setChecked(c.get(
            KEY_APPEND_EDITION_TO_TITLE, DEFAULT_STORE_VALUES[KEY_APPEND_EDITION_TO_TITLE]))
        other_group_box_layout.addWidget(
            self.append_edition_to_title_checkbox, 1, 1, 1, 1)

        # Fetch Subjects
        fetch_subjects_label = QLabel('Fetch Subjects:', self)
        fetch_subjects_label.setToolTip('DNB provides several types of subjects:\n'
                                        ' - Standardized subjects according to the GND\n'
                                        ' - Subjects delivered by the publisher\n'
                                        'You can choose which ones to fetch.')
        other_group_box_layout.addWidget(fetch_subjects_label, 2, 0, 1, 1)

        self.fetch_subjects_radios_group = QtGui.QButtonGroup(other_group_box)
        titles = ['only GND subjects', 'GND subjects if available, otherwise non-GND subjects', 'GND and non-GND subjects',
                  'non-GND subjects if available, otherwise GND subjects', 'only non-GND subjects', 'none']
        self.fetch_subjects_radios = [
            QtGui.QRadioButton(title) for title in titles]
        for i, radio in enumerate(self.fetch_subjects_radios):
            if i == c.get(KEY_FETCH_SUBJECTS, DEFAULT_STORE_VALUES[KEY_FETCH_SUBJECTS]):
                radio.setChecked(True)
            self.fetch_subjects_radios_group.addButton(radio, i)
            other_group_box_layout.addWidget(radio, 2 + i, 1, 1, 1)
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Carregar a interface do arquivo exportado pelo Qt Designer
        uic.loadUi(get_project_dir() / 'gui/dialogo_capturar.ui', self)

        self.buttonGroup = Qt.QButtonGroup(self)

        botoes = (Qt.QRadioButton(nome) for nome in get_tshark_interface_names())
        for i, botao in enumerate(botoes):
            if i == 0:
                botao.setChecked(True)
            self.layoutBotoes.addWidget(botao)
            self.buttonGroup.addButton(botao)
Beispiel #3
0
 def init_widget(self):
     self.widget = Qt.QGroupBox(self.name)
     layout = Qt.QHBoxLayout()
     self.widget.setLayout(layout)
     self.buttons = []
     self.button_group = Qt.QButtonGroup()
     for stage, key in zip(self.stages, self.shortcuts):
         button = Qt.QPushButton(stage)
         self.buttons.append(button)
         button.setCheckable(True)
         self.button_group.addButton(button)
         callback = self._make_stage_callback(button, stage)
         button.clicked.connect(callback)
         layout.addWidget(button)
         Qt.QShortcut(key,
                      self.widget,
                      callback,
                      context=Qt.Qt.ApplicationShortcut)
    def initUI(self):

        # Add a first QwtPlot to the UI:
        #self.qplt_mag = Qwt.QwtPlot()
        self.qplt_mag = pg.PlotWidget()
        self.qplt_mag.setTitle('Magnitude response')
        #self.qplt_mag.setCanvasBackground(Qt.Qt.white)
        #self.qplt_mag.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLog10ScaleEngine())
        self.qplt_mag.getPlotItem().setLogMode(x=True)
        #print('DisplayTransferFunctionWindow: initUI(): first plot widget created')

        # plot_grid = Qwt.QwtPlotGrid()
        # plot_grid.setMajPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine))
        # plot_grid.attach(self.qplt_mag)
        self.qplt_mag.showGrid(x=True, y=True)

        self.colors_order = [
            [0, 114, 189],
            [217, 83, 25],
            [237, 177, 32],
            [126, 47, 142],
            [119, 172, 48],
            [77, 190, 238],
            [162, 20, 47],
        ]

        # Add a second QwtPlot to the UI:

        self.qplt_phase = pg.PlotWidget()
        self.qplt_phase.setTitle('Phase response')
        #self.qplt_phase.setCanvasBackground(Qt.Qt.white)
        #self.qplt_phase.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLog10ScaleEngine())
        self.qplt_phase.getPlotItem().setLogMode(x=True)
        #print('DisplayTransferFunctionWindow: initUI(): 2nd plot widget created')

        # plot_grid = Qwt.QwtPlotGrid()
        # plot_grid.setMajPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine))
        # plot_grid.attach(self.qplt_phase)
        self.qplt_phase.showGrid(x=True, y=True)

        # create the lists to hold the curve objects as they get added to the plots:
        self.curve_mag_list = []
        self.curve_phase_list = []

        ######################################################################
        # Controls to adjust the model
        ######################################################################

        # Units select
        units_label = Qt.QLabel('Units:')
        self.qcombo_units = Qt.QComboBox()
        self.qcombo_units.addItems([
            'dB', 'Linear', 'real part', 'imag part', 'Ohms, 50*Vin/Vout',
            'Ohms, shunt DUT, 50 ohms probe',
            'Ohms, Shunt DUT, high-Z probe + Series source impedance'
        ])
        self.qcombo_units.setCurrentIndex(0)
        #        self.qcombo_units.changeEvent.connect(self.updateGraph)
        self.qcombo_units.currentIndexChanged.connect(self.updateGraph)

        self.qlabel_SeriesImpedance = Qt.QLabel('Series Impedance [Ohms]:')
        self.qedit_SeriesImpedance = Qt.QLineEdit('100e3')
        self.qedit_SeriesImpedance.editingFinished.connect(self.updateGraph)

        self.qchk_display_model = Qt.QCheckBox('Display model')
        self.qchk_display_model.setChecked(False)

        self.qchk_DDCFilter = Qt.QCheckBox('DDC sinc filter')
        self.qchk_DDCFilter.clicked.connect(self.updateGraph)

        self.qradio_signp = Qt.QRadioButton('+ Sign')
        self.qradio_signp.setChecked(True)
        self.qradio_signn = Qt.QRadioButton('- Sign')
        button_group = Qt.QButtonGroup()
        button_group.addButton(self.qradio_signp)
        button_group.addButton(self.qradio_signn)

        self.qradio_signp.clicked.connect(self.updateGraph)
        self.qradio_signn.clicked.connect(self.updateGraph)

        # set the default DC gain to the value of the transfer function at the lowest frequency:

        self.qlabel_k = Qt.QLabel('DC Gain [dB]')
        self.qedit_k = Qt.QLineEdit(str(0))
        self.qedit_k.setMaximumWidth(60)
        self.qedit_k.textChanged.connect(self.updateGraph)

        self.qlabel_f1 = Qt.QLabel('1st order poles')
        self.qedit_f1 = Qt.QLineEdit('20e3,600e3')
        self.qedit_f1.setMaximumWidth(120)
        self.qedit_f1.textChanged.connect(self.updateGraph)

        self.qlabel_f0 = Qt.QLabel('2nd order poles')
        self.qedit_f0 = Qt.QLineEdit('1.5e6')
        self.qedit_f0.setMaximumWidth(120)
        self.qedit_f0.textChanged.connect(self.updateGraph)

        self.qlabel_zeta = Qt.QLabel('zeta')
        self.qedit_zeta = Qt.QLineEdit('0.1')
        self.qedit_zeta.setMaximumWidth(120)
        self.qedit_zeta.textChanged.connect(self.updateGraph)

        self.qlabel_T = Qt.QLabel('Pure delay')
        self.qedit_T = Qt.QLineEdit('570e-9')
        self.qedit_T.setMaximumWidth(60)
        self.qedit_T.textChanged.connect(self.updateGraph)

        self.qchk_controller = Qt.QCheckBox('Closed-loop prediction')
        self.qchk_controller.clicked.connect(self.updateGraph)

        self.qlabel_pgain = Qt.QLabel('P gain [dB]')
        self.qedit_pgain = Qt.QLineEdit('-100')
        self.qedit_pgain.setMaximumWidth(60)
        self.qedit_pgain.textChanged.connect(self.updateGraph)

        self.qlabel_icorner = Qt.QLabel('I corner [Hz]')
        self.qedit_icorner = Qt.QLineEdit('0')
        self.qedit_icorner.setMaximumWidth(60)
        self.qedit_icorner.textChanged.connect(self.updateGraph)

        self.qedit_comment = Qt.QTextEdit('')
        #        self.qedit_comment.setMaximumWidth(80)
        #self.qedit_comment.textChanged.connect(self.updateGraph)

        # Put all the widgets into a grid layout
        grid = Qt.QGridLayout()

        grid.addWidget(units_label, 0, 0)
        grid.addWidget(self.qcombo_units, 0, 1)

        grid.addWidget(self.qlabel_SeriesImpedance, 1, 0)
        grid.addWidget(self.qedit_SeriesImpedance, 1, 1)

        # grid.addWidget(self.qchk_display_model    , 2, 1)

        # grid.addWidget(self.qradio_signp          , 3, 0)
        # grid.addWidget(self.qradio_signn          , 3, 1)

        # grid.addWidget(self.qlabel_k              , 4, 0)
        # grid.addWidget(self.qedit_k               , 4, 1)
        # grid.addWidget(self.qlabel_f1             , 5, 0)
        # grid.addWidget(self.qedit_f1              , 5, 1)
        # grid.addWidget(self.qlabel_f0             , 6, 0)
        # grid.addWidget(self.qedit_f0              , 6, 1)

        # grid.addWidget(self.qlabel_zeta           , 7, 0)
        # grid.addWidget(self.qedit_zeta            , 7, 1)

        # grid.addWidget(self.qlabel_T              , 8, 0)
        # grid.addWidget(self.qedit_T               , 8, 1)

        # grid.addWidget(self.qchk_controller       , 9, 0, 1, 2)

        # grid.addWidget(self.qlabel_pgain          , 10, 0)
        # grid.addWidget(self.qedit_pgain           , 10, 1)

        # grid.addWidget(self.qlabel_icorner        , 12, 0)
        # grid.addWidget(self.qedit_icorner         , 12, 1)
        # grid.addWidget(self.qchk_DDCFilter        , 13, 0, 1, 2)

        grid.addWidget(self.qedit_comment, 14, 0, 1, 2)
        grid.setRowStretch(15, 0)
        #        grid.addWidget(Qt.QLabel(''), 12, 0, 1, 2)
        #        grid.setRowStretch(14, 1)

        vbox = Qt.QVBoxLayout()
        vbox.addWidget(self.qplt_mag)
        vbox.addWidget(self.qplt_phase)

        hbox = Qt.QHBoxLayout()
        hbox.addLayout(grid)
        hbox.addLayout(vbox, 1)
        #        hbox.setStretch(2, 1)

        self.setLayout(hbox)

        # Adjust the size and position of the window
        self.resize(1200, 500)
        self.center()
        self.setWindowTitle('Transfer function #%d' % self.window_number)
        self.show()
    def initUI(self):

        # Create the widgets which control the system identification module:

        # Input select
        transfer_input_label = Qt.QLabel('Input:')
        self.qcombo_transfer_input = Qt.QComboBox()
        self.qcombo_transfer_input.addItems(
            ['ADC 0', 'ADC 1', 'DDC 0', 'DDC 1'])
        self.qcombo_transfer_input.setCurrentIndex(2)
        #        transfer_input_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        #        self.qcombo_transfer_input.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        # Output select
        transfer_output_label = Qt.QLabel('Output:')
        self.qcombo_transfer_output = Qt.QComboBox()
        self.qcombo_transfer_output.addItems(['DAC 0', 'DAC 1', 'DAC 2'])
        self.qcombo_transfer_output.setCurrentIndex(0)
        #        transfer_output_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        #        self.qcombo_transfer_output.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        #
        settling_time_label = Qt.QLabel('System settling time [s]:')
        self.qedit_settling_time = Qt.QLineEdit('1e-3')
        self.qedit_settling_time.setMaximumWidth(60)
        self.qedit_settling_time.editingFinished.connect(
            self.updateIntegrationTime)

        #        settling_time_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        #        self.qedit_settling_time.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        freq_start_label = Qt.QLabel('Freq start [Hz]:')
        self.qedit_freq_start = Qt.QLineEdit('10e3')
        self.qedit_freq_start.setMaximumWidth(60)
        self.qedit_freq_start.editingFinished.connect(
            self.updateIntegrationTime)
        #        freq_start_label.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
        #        self.qedit_freq_start.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        freq_end_label = Qt.QLabel('Freq end [Hz]:')
        self.qedit_freq_end = Qt.QLineEdit('2e6')
        self.qedit_freq_end.setMaximumWidth(60)
        #        self.qedit_freq_end.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        freq_number_label = Qt.QLabel('Number of freq [max 3276]:')
        self.qedit_freq_number = Qt.QLineEdit('160')
        self.qedit_freq_number.setMaximumWidth(60)
        #        self.qedit_freq_number.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        amplitude_label = Qt.QLabel('Modulation amplitude [0-1]:')
        self.qedit_output_amplitude = Qt.QLineEdit('0.01')
        self.qedit_output_amplitude.setMaximumWidth(60)
        #        self.qedit_output_amplitude.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        self.qlbl_integration_time = Qt.QLabel(
            'Integration time per freq [s]: ')
        self.updateIntegrationTime()

        # Button which triggers the system identification
        self.qbtn_ident = QtGui.QPushButton('Run identification')
        self.qbtn_ident.clicked.connect(self.runSytemIdentification)
        #        self.qbtn_ident.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        self.qbtn_stop_ident = QtGui.QPushButton('Stop identification')
        self.qbtn_stop_ident.clicked.connect(self.stopClicked)

        # Progress bar which indicates the progression of the identification
        self.qprogress_ident = Qt.QProgressBar()
        self.qprogress_ident.setTextVisible(False)
        self.qprogress_ident.setValue(0)
        #        self.qprogress_ident.setSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)

        # Controls for the dither mode:
        # Needs: output select, frequency, amplitude, Square/Sine select, dither on/off
        ######################################################################
        # Settings
        ######################################################################
        self.qgroupbox_dither = Qt.QGroupBox('Continuous output', self)

        self.dither_output_label = Qt.QLabel('Output:')
        self.qcombo_dither_output = Qt.QComboBox()
        self.qcombo_dither_output.addItems(['DAC 0', 'DAC 1', 'DAC 2'])
        self.qcombo_dither_output.setCurrentIndex(0)
        self.qcombo_dither_output.currentIndexChanged.connect(
            self.ditherClicked)

        # Modulation frequency:
        self.qedit_freq_label = Qt.QLabel('Frequency [Hz]:')
        self.qedit_dither_freq = Qt.QLineEdit('1e6')
        self.qedit_dither_freq.textChanged.connect(self.ditherClicked)
        self.qedit_dither_freq.setMaximumWidth(60)

        # Amplitude:
        self.qlabel_dither_amplitude = Qt.QLabel('Amplitude [0-1]:')
        self.qedit_dither_amplitude = Qt.QLineEdit('0.01')
        self.qedit_dither_amplitude.textChanged.connect(self.ditherClicked)
        self.qedit_dither_amplitude.setMaximumWidth(60)

        # Sine/Square wave
        self.qradio_sinewave = Qt.QRadioButton('Sine wave')
        self.qradio_squarewave = Qt.QRadioButton('Square wave')
        self.qsign_group = Qt.QButtonGroup(self)
        self.qsign_group.addButton(self.qradio_sinewave)
        self.qsign_group.addButton(self.qradio_squarewave)

        self.qradio_sinewave.setChecked(True)
        self.qradio_squarewave.setChecked(False)
        self.qradio_sinewave.clicked.connect(self.ditherClicked)
        self.qradio_squarewave.clicked.connect(self.ditherClicked)

        # On/Off button
        self.qbtn_dither = QtGui.QPushButton('Activate dither')
        self.qbtn_dither.clicked.connect(self.ditherClicked)
        self.qbtn_dither.setCheckable(True)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.dither_output_label, 0, 0)
        grid.addWidget(self.qcombo_dither_output, 0, 1)
        grid.addWidget(self.qedit_freq_label, 1, 0)
        grid.addWidget(self.qedit_dither_freq, 1, 1)
        grid.addWidget(self.qlabel_dither_amplitude, 2, 0)
        grid.addWidget(self.qedit_dither_amplitude, 2, 1)
        grid.addWidget(self.qradio_sinewave, 3, 0)
        grid.addWidget(self.qradio_squarewave, 3, 1)

        grid.addWidget(self.qbtn_dither, 4, 0, 1, 2)
        self.qgroupbox_dither.setLayout(grid)

        ######################################################################
        # Settings
        ######################################################################
        self.qgroupbox_test_osc = Qt.QGroupBox(
            'Variable duty-cycle oscillator')
        self.qlbl_osc_freq = Qt.QLabel('Frequency [Hz]:')
        self.qedit_osc_freq = Qt.QLineEdit('200e3')
        self.qedit_osc_freq.textChanged.connect(self.oscClicked)
        # On/Off button
        self.qbtn_osc = QtGui.QPushButton('Activate output')
        self.qbtn_osc.setCheckable(True)
        self.qbtn_osc.setChecked(True)
        self.qbtn_osc.clicked.connect(self.oscClicked)
        # Polarity setting
        self.qchk_osc_polarity = Qt.QCheckBox('Invert polarity')
        self.qchk_osc_polarity.clicked.connect(self.oscClicked)
        # Duty cycle slider
        self.q_osc_duty_cyle = Qt.QSlider()
        self.q_osc_duty_cyle.valueChanged.connect(self.oscClicked)
        self.q_osc_duty_cyle.setSliderPosition(0)
        self.q_osc_duty_cyle.setOrientation(Qt.Qt.Horizontal)
        # Units are millionth of the full range available
        self.q_osc_duty_cyle.setMinimum(0)
        self.q_osc_duty_cyle.setMaximum(1e6)

        self.q_osc_duty_cyle.setSingleStep(1e6 / 100. / 3.)
        self.q_osc_duty_cyle.setPageStep(1e6 / 10.)
        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()
        grid.addWidget(self.qlbl_osc_freq, 0, 0)
        grid.addWidget(self.qedit_osc_freq, 0, 1)
        grid.addWidget(self.qbtn_osc, 1, 0, 1, 2)
        grid.addWidget(self.qchk_osc_polarity, 2, 0, 1, 2)
        grid.addWidget(self.q_osc_duty_cyle, 3, 0, 1, 2)
        self.qgroupbox_test_osc.setLayout(grid)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(transfer_input_label, 0, 0)
        grid.addWidget(self.qcombo_transfer_input, 0, 1)
        grid.addWidget(transfer_output_label, 1, 0)
        grid.addWidget(self.qcombo_transfer_output, 1, 1)
        grid.addWidget(settling_time_label, 2, 0)
        grid.addWidget(self.qedit_settling_time, 2, 1)
        grid.addWidget(freq_start_label, 3, 0)
        grid.addWidget(self.qedit_freq_start, 3, 1)
        grid.addWidget(freq_end_label, 4, 0)
        grid.addWidget(self.qedit_freq_end, 4, 1)
        grid.addWidget(freq_number_label, 5, 0)
        grid.addWidget(self.qedit_freq_number, 5, 1)
        grid.addWidget(amplitude_label, 6, 0)
        grid.addWidget(self.qedit_output_amplitude, 6, 1)
        grid.addWidget(self.qlbl_integration_time, 7, 0, 1, 2)
        grid.addWidget(self.qbtn_ident, 8, 0, 1, 2)
        grid.addWidget(self.qbtn_stop_ident, 9, 0, 1, 2)

        grid.addWidget(self.qprogress_ident, 10, 0, 1, 2)

        self.qgroupbox_vna = Qt.QGroupBox('Swept sine', self)
        self.qgroupbox_vna.setLayout(grid)

        vbox = Qt.QVBoxLayout()
        vbox.addWidget(self.qgroupbox_vna)
        vbox.addWidget(self.qgroupbox_dither)
        # vbox.addWidget(self.qgroupbox_test_osc)

        # Spacer which takes up the rest of the space:
        spacerItem = QtGui.QSpacerItem(1, 1, QtGui.QSizePolicy.Maximum,
                                       QtGui.QSizePolicy.Expanding)
        vbox.addItem(spacerItem)

        self.setLayout(vbox)

        # Adjust the size and position of the window
        #        self.resize(800, 600)
        self.center()
        self.setWindowTitle('VNA control')
        self.show()
Beispiel #6
0
    def initUI(self):
        # init the UI
        self.qlabel_serial = Qt.QLabel('Connected FPGAs')
        self.qlabel_broadcast = Qt.QLabel('UDP Broadcast address')
        self.qlabel_firmware = Qt.QLabel('FPGA Firmware file')
        self.qlabel_software = Qt.QLabel('CPU Software file')
        self.qcombo_serial = Qt.QComboBox()
        self.qcombo_serial.setMinimumContentsLength(
            100
        )  # I can't figure out how to make it scale correctly with content so we'll make it big enough...
        self.qcombo_serial.setSizeAdjustPolicy(
            Qt.QComboBox.AdjustToMinimumContentsLength)

        self.qedit_broadcast = Qt.QLineEdit(self.strBroadcastAddress)
        self.qedit_firmware = Qt.QLineEdit(self.strFPGAFirmware)
        self.qedit_software = Qt.QLineEdit(self.strCPUFirmware)

        self.qbtn_send_broadcast = Qt.QPushButton('Broadcast discovery packet')
        self.qbtn_reprogram_fpga = Qt.QPushButton('Update FPGA firmware')
        self.qbtn_reprogram_cpu = Qt.QPushButton('Update CPU software')
        self.qbtn_send_broadcast.clicked.connect(
            self.reset_list_and_send_broadcast)
        self.qbtn_reprogram_fpga.clicked.connect(self.programFPGAClicked)
        self.qbtn_reprogram_cpu.clicked.connect(self.programCPUClicked)

        self.qradio_reprogram = Qt.QRadioButton('Send default values')
        self.qradio_noreprogram = Qt.QRadioButton(
            'Connect to an already running box')
        self.qradio_reprogram.setChecked(True)

        self.qradio_noreprogram.setDisabled(True)

        btn_group = Qt.QButtonGroup(self)
        btn_group.addButton(self.qradio_reprogram)
        btn_group.setId(self.qradio_reprogram, 0)
        btn_group.addButton(self.qradio_noreprogram)
        btn_group.setId(self.qradio_noreprogram, 1)

        # btn_group2 = Qt.QButtonGroup(self)
        # btn_group2.addButton(self.qradio_usefromlist)
        # btn_group2.setId(self.qradio_usefromlist, 0)
        # btn_group2.addButton(self.qradio_usefromtextbox)
        # btn_group2.setId(self.qradio_usefromtextbox, 1)

        self.qbtn_yes = Qt.QPushButton('OK')
        self.qbtn_no = Qt.QPushButton('Cancel')

        self.qbtn_yes.clicked.connect(self.okClicked)
        self.qbtn_no.clicked.connect(self.cancelClicked)

        self.qgroupbox_IP_addr = Qt.QGroupBox('IP Address')
        gridIP = Qt.QGridLayout()

        self.qradio_usefromlist = Qt.QRadioButton('Use listed')
        self.qradio_usefromtextbox = Qt.QRadioButton('Use manual entry')
        self.qradio_usefromtextbox.setChecked(False)
        self.qradio_usefromlist.setChecked(True)

        self.qlabel_manual_entry = Qt.QLabel('Manual IP entry')
        self.qedit_manual_entry = Qt.QLineEdit('192.168.0.150')

        self.qlabel_host_port = Qt.QLabel('Host Port')
        self.qedit_host_port = Qt.QLineEdit('5000')

        gridIP.addWidget(self.qradio_usefromtextbox, 0, 0)
        gridIP.addWidget(self.qlabel_manual_entry, 0, 1)
        gridIP.addWidget(self.qedit_manual_entry, 0, 2)

        gridIP.addWidget(self.qlabel_host_port, 0, 3)
        gridIP.addWidget(self.qedit_host_port, 0, 4)

        gridIP.addWidget(self.qradio_usefromlist, 1, 0)
        gridIP.addWidget(self.qlabel_serial, 1, 1)
        gridIP.addWidget(self.qcombo_serial, 1, 2)

        gridIP.addWidget(self.qbtn_send_broadcast, 2, 0)
        gridIP.addWidget(self.qlabel_broadcast, 2, 1)
        gridIP.addWidget(self.qedit_broadcast, 2, 2)

        self.qgroupbox_IP_addr.setLayout(gridIP)

        self.qgroupbox_connection = Qt.QGroupBox('Red Pitaya Connection')
        gridConnection = Qt.QGridLayout()

        self.qradio_pushValue = Qt.QRadioButton(
            'Push default values to Red Pitaya')
        self.qradio_existingRP = Qt.QRadioButton(
            'Reconnect to an already running Red Pitaya')
        self.qradio_noRP = Qt.QRadioButton(
            'Open the GUI without any Red Pitaya')
        self.qradio_existingRP.setChecked(True)

        gridConnection.addWidget(self.qradio_pushValue, 0, 0)
        gridConnection.addWidget(self.qradio_existingRP, 0, 1)
        gridConnection.addWidget(self.qradio_noRP, 0, 2)

        self.qgroupbox_connection.setLayout(gridConnection)

        #        btn_group2 = Qt.QButtonGroup(self)
        #        btn_group2.addButton(self.qradio_clk_internal)
        #        btn_group2.addButton(self.qradio_clk_external)
        #        btn_group2.setId(self.qradio_clk_internal, 2)
        #        btn_group2.setId(self.qradio_clk_external, 3)
        #        self.close.connect(self.closeEvent)

        grid = Qt.QGridLayout()

        grid.addWidget(self.qgroupbox_IP_addr, 2, 0, 1, 3)

        grid.addWidget(self.qgroupbox_connection, 0, 0, 1, 3)

        grid.addWidget(self.qbtn_reprogram_fpga, 3, 0)
        grid.addWidget(self.qlabel_firmware, 3, 1)
        grid.addWidget(self.qedit_firmware, 3, 2)

        grid.addWidget(self.qbtn_reprogram_cpu, 4, 0)
        grid.addWidget(self.qlabel_software, 4, 1)
        grid.addWidget(self.qedit_software, 4, 2)

        #        #FEATURE
        #        grid.addWidget(self.qradio_reprogram, 4, 0)
        #        grid.addWidget(self.qradio_noreprogram, 4, 1)

        #        grid.addWidget(self.qradio_clk_internal, 3, 0)
        #        grid.addWidget(self.qradio_clk_external, 3, 1)

        #        grid.addWidget(self.qbtn_yes, 4, 0)
        #        grid.addWidget(self.qbtn_no, 4, 1)
        hbox = Qt.QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(self.qbtn_yes)
        hbox.addWidget(self.qbtn_no)
        grid.addLayout(hbox, 5, 0, 1, 3)

        self.setLayout(grid)
        self.setWindowTitle('Initial configuration')
        self.qbtn_yes.setFocus()
        self.show()
    def initUI(self):
        #        print('initUI()')

        self.qchk_lock = Qt.QCheckBox(
            'Lock On'
        )  # Not displayed, for status reading only (to act like the other LoopFilter)
        self.qchk_lock.setChecked(False)

        # first column: contains the radio buttons to select the mode
        vbox = Qt.QVBoxLayout()

        self.qradio_mode_off = Qt.QRadioButton('Off')
        self.qradio_mode_off.setChecked(True)
        self.qradio_mode_slow = Qt.QRadioButton('Acquisition on slow PZT only')
        self.qradio_mode_fast = Qt.QRadioButton('Lock on fast PZT only')
        self.qradio_mode_both = Qt.QRadioButton('Lock on both PZTs')

        #        self.qradio_mode_off.setEnabled(self.bDisplayLockChkBox)
        #        self.qradio_mode_slow.setEnabled(self.bDisplayLockChkBox)
        #        self.qradio_mode_fast.setEnabled(self.bDisplayLockChkBox)
        #        self.qradio_mode_both.setEnabled(self.bDisplayLockChkBox)

        # Two checkboxes to flip the sign
        self.qchk_flip1 = Qt.QCheckBox('Flip sign on acquisition')
        self.qchk_flip1.clicked.connect(self.setIntegratorGainEvent)
        self.qchk_flip2 = Qt.QCheckBox('Flip sign on lock')
        self.qchk_flip2.clicked.connect(self.setIntegratorGainEvent)

        self.qradio_mode_off.clicked.connect(self.updateSettings)
        self.qradio_mode_slow.clicked.connect(self.updateSettings)
        self.qradio_mode_fast.clicked.connect(self.updateSettings)
        self.qradio_mode_both.clicked.connect(self.updateSettings)

        self.qgroup_mode = Qt.QButtonGroup(self)
        self.qgroup_mode.addButton(self.qradio_mode_off)
        self.qgroup_mode.addButton(self.qradio_mode_slow)
        self.qgroup_mode.addButton(self.qradio_mode_fast)
        self.qgroup_mode.addButton(self.qradio_mode_both)

        self.qchk_hold = Qt.QCheckBox('Hold both')
        self.qchk_hold.clicked.connect(self.updateSettings)

        self.qlabel_int1_state = Qt.QLabel('Integrator 1 state: Off')
        self.qlabel_int2_state = Qt.QLabel('Integrator 2 state: Off')

        vbox.addWidget(self.qradio_mode_off)
        vbox.addWidget(self.qradio_mode_slow)
        vbox.addWidget(self.qradio_mode_fast)
        vbox.addWidget(self.qradio_mode_both)
        #FEATURE
        vbox.addWidget(self.qchk_flip1)
        vbox.addWidget(self.qchk_flip2)
        #vbox.addWidget(self.qchk_hold)
        vbox.addWidget(self.qlabel_int1_state)
        vbox.addWidget(self.qlabel_int2_state)

        vbox.addStretch(1)

        ## The slow PZT integrators BW controls:
        # The label to indicate the predicted closed-loop BW
        self.qlbl_acquisition = Qt.QLabel('Acq gain:')
        self.qlabel_int1_gain = Qt.QLabel('BW : 10 Hz')
        self.qlabel_int1_gain.setAlignment(Qt.Qt.AlignHCenter)

        # The knob to set the open-loop gain, and thus closed-loop BW
        self.qcombo_int1_gain = Qt.QComboBox()
        gainsList = range(-31, 31)
        gainsList = list(map(str, gainsList))
        self.qcombo_int1_gain.addItems(gainsList)
        self.qcombo_int1_gain.setCurrentIndex(
            32 - 17
        )  # this has to be overridden if we load the register settings (TODO)
        self.qcombo_int1_gain.currentIndexChanged.connect(
            self.setIntegratorGainEvent)

        self.qlbl_lock_gain = Qt.QLabel('Lock gain:')
        self.qlabel_int2_gain = Qt.QLabel('BW : 1 kHz')
        self.qlabel_int2_gain.setAlignment(Qt.Qt.AlignHCenter)

        # The knob to set the open-loop gain, and thus closed-loop BW
        self.qcombo_int2_gain = Qt.QComboBox()
        gainsList = range(-31, 31)
        gainsList = list(map(str, gainsList))
        self.qcombo_int2_gain.addItems(gainsList)
        self.qcombo_int2_gain.setCurrentIndex(
            32 - 17
        )  # this has to be overridden if we load the register settings (TODO)
        self.qcombo_int2_gain.currentIndexChanged.connect(
            self.setIntegratorGainEvent)

        self.qgroupbox_integrators = Qt.QGroupBox('Slow PZT (DAC2)')

        vbox_int = Qt.QVBoxLayout()
        vbox_int.addWidget(self.qlbl_acquisition)
        vbox_int.addWidget(self.qcombo_int1_gain)
        vbox_int.addWidget(self.qlabel_int1_gain)
        vbox_int.addWidget(self.qlbl_lock_gain)
        vbox_int.addWidget(self.qcombo_int2_gain)
        vbox_int.addWidget(self.qlabel_int2_gain)
        vbox_int.addStretch(1)

        self.qgroupbox_integrators.setLayout(vbox_int)

        # The controls for the fast PZT's loop filter settings, contains only one (composite) widget:
        self.qgroupbox_pll = Qt.QGroupBox('Fast PZT (DAC1)', self)
        #        self.dac1_ui.setParent(self.qgroupbox_pll)
        vbox3 = Qt.QVBoxLayout()
        vbox3.addWidget(self.dac1_ui)
        self.qgroupbox_pll.setLayout(vbox3)

        # Put all the vboxes and groupboxes into a single layout:
        hbox = Qt.QHBoxLayout()
        hbox.addLayout(vbox)
        hbox.addWidget(self.qgroupbox_integrators)
        hbox.addWidget(self.qgroupbox_pll)
        hbox.setStretch(2, 1)

        self.setLayout(hbox)
    def initUI(self, modulation_frequency_in_hz, output_amplitude,
               integration_time_in_seconds, bEnableDither):

        # Create the widgets which control the dither module:

        # Controls for the dither mode:
        # Needs: output select, frequency, amplitude, Square/Sine select, dither on/off
        ######################################################################
        # Settings
        ######################################################################

        self.qgroupbox_dither = Qt.QGroupBox('Dither DAC%d settings' %
                                             self.output_number)
        self.qgroupbox_dither.setAutoFillBackground(True)

        # Modulation frequency:
        self.qedit_freq_label = Qt.QLabel('Frequency [Hz]:')
        self.qedit_dither_freq = Qt.QLineEdit(str(modulation_frequency_in_hz))
        self.qedit_dither_freq.textChanged.connect(self.ditherClicked)
        self.qedit_dither_freq.setMaximumWidth(100)

        # Integration time:
        self.qedit_int_label = Qt.QLabel('Integration time [s]:')
        self.qedit_integration_time = Qt.QLineEdit(
            str(integration_time_in_seconds))
        self.qedit_integration_time.textChanged.connect(self.ditherClicked)
        self.qedit_integration_time.setMaximumWidth(100)

        # Amplitude:
        self.qlabel_dither_amplitude = Qt.QLabel('Amplitude [0-1]:')
        self.qedit_dither_amplitude = Qt.QLineEdit(str(output_amplitude))
        self.qedit_dither_amplitude.textChanged.connect(self.ditherClicked)
        self.qedit_dither_amplitude.setMaximumWidth(100)

        #        # On/Off button
        #        self.qbtn_dither = QtGui.QPushButton('Activate dither')
        #        self.qbtn_dither.clicked.connect(self.ditherClicked)
        #        self.qbtn_dither.setCheckable(True)
        #        self.qbtn_dither.setChecked(bool(bEnableDither))

        # Mode select button (Automatic, Manual Off, Manual On)
        self.qchk_mode_auto = QtGui.QRadioButton('Automatic')
        self.qchk_mode_manual_off = QtGui.QRadioButton('Manual Off')
        self.qchk_mode_manual_on = QtGui.QRadioButton('Manual On')
        qbtn_group = Qt.QButtonGroup()
        qbtn_group.addButton(self.qchk_mode_auto)
        qbtn_group.addButton(self.qchk_mode_manual_off)
        qbtn_group.addButton(self.qchk_mode_manual_on)
        self.qchk_mode_auto.setChecked(True)
        self.qchk_mode_auto.clicked.connect(self.ditherClicked)
        self.qchk_mode_manual_off.clicked.connect(self.ditherClicked)
        self.qchk_mode_manual_on.clicked.connect(self.ditherClicked)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qedit_freq_label, 0, 0)
        grid.addWidget(self.qedit_dither_freq, 0, 1)
        grid.addWidget(self.qedit_int_label, 1, 0)
        grid.addWidget(self.qedit_integration_time, 1, 1)

        grid.addWidget(self.qlabel_dither_amplitude, 2, 0)
        grid.addWidget(self.qedit_dither_amplitude, 2, 1)

        grid.addWidget(self.qchk_mode_auto, 3, 0, 1, 2)
        grid.addWidget(self.qchk_mode_manual_off, 4, 0, 1, 2)
        grid.addWidget(self.qchk_mode_manual_on, 5, 0, 1, 2)
        self.qgroupbox_dither.setLayout(grid)

        vbox = Qt.QVBoxLayout()
        vbox.addWidget(self.qgroupbox_dither)
        self.setLayout(vbox)

        # Adjust the size and position of the window
        #        self.resize(800, 600)
        self.center()
        self.setWindowTitle('Dither #%d control' % self.output_number)
Beispiel #9
0
    def __init__(self, plugin):
        DefaultConfigWidget.__init__(self, plugin)
        c = plugin_prefs[STORE_NAME]

        other_group_box = QGroupBox('Other options', self)
        self.l.addWidget(other_group_box, self.l.rowCount(), 0, 1, 2)
        other_group_box_layout = QGridLayout()
        other_group_box.setLayout(other_group_box_layout)

        # SRU Token
        sru_token_label = QLabel('SRU Token (recommended):', self)
        sru_token_label.setToolTip(
            'To access the API of the DNB a personal SRU access token is required.\n'
            'The token is for free.\n\n'
            'To get a token, create an account at https://portal.dnb.de/myAccount/register.htm \n'
            'After that write an email to [email protected] and ask them to enable \n'
            'SRU token generation for your account.')
        other_group_box_layout.addWidget(sru_token_label, 0, 0, 1, 1)

        self.sru_token_line = QtGui.QLineEdit(self)
        self.sru_token_line.setText(
            c.get(KEY_SRUTOKEN, DEFAULT_STORE_VALUES[KEY_SRUTOKEN]))
        other_group_box_layout.addWidget(self.sru_token_line, 0, 1, 1, 1)

        # Guess Series
        guess_series_label = QLabel(
            'Guess Series and Series Index from Title:', self)
        guess_series_label.setToolTip(
            'DNB only rarely provides data about a book\'s series.\n'
            'This plugin can try to extract series and series_index from the book title.\n'
        )
        other_group_box_layout.addWidget(guess_series_label, 1, 0, 1, 1)

        self.guess_series_checkbox = QtGui.QCheckBox(self)
        self.guess_series_checkbox.setChecked(
            c.get(KEY_GUESS_SERIES, DEFAULT_STORE_VALUES[KEY_GUESS_SERIES]))
        other_group_box_layout.addWidget(self.guess_series_checkbox, 1, 1, 1,
                                         1)

        # Append Edition to Title
        append_edition_to_title_label = QLabel('Append Edition to Title:',
                                               self)
        append_edition_to_title_label.setToolTip(
            'For some books DNB has information about the edition.\n'
            'This plugin can fetch this information and append it to the book\'s title,\n'
            'e.g. "Mord am Tegernsee : Ein Bayern-Krimi : 2. Aufl.".\n'
            'Of course this only works reliable if you search for a book with a known unique identifier such as dnb-idn or ISBN.'
        )
        other_group_box_layout.addWidget(append_edition_to_title_label, 2, 0,
                                         1, 1)

        self.append_edition_to_title_checkbox = QtGui.QCheckBox(self)
        self.append_edition_to_title_checkbox.setChecked(
            c.get(KEY_APPEND_EDITION_TO_TITLE,
                  DEFAULT_STORE_VALUES[KEY_APPEND_EDITION_TO_TITLE]))
        other_group_box_layout.addWidget(self.append_edition_to_title_checkbox,
                                         2, 1, 1, 1)

        # Fetch Subjects
        fetch_subjects_label = QLabel('Fetch Subjects:', self)
        fetch_subjects_label.setToolTip(
            'DNB provides several types of subjects:\n'
            ' - Standardized subjects according to the GND\n'
            ' - Subjects delivered by the publisher\n'
            'You can choose which ones to fetch.')
        other_group_box_layout.addWidget(fetch_subjects_label, 3, 0, 1, 1)

        self.fetch_subjects_radios_group = QtGui.QButtonGroup(other_group_box)
        titles = [
            'only GND subjects',
            'GND subjects if available, otherwise non-GND subjects',
            'GND and non-GND subjects',
            'non-GND subjects if available, otherwise GND subjects',
            'only non-GND subjects', 'none'
        ]
        self.fetch_subjects_radios = [
            QtGui.QRadioButton(title) for title in titles
        ]
        for i, radio in enumerate(self.fetch_subjects_radios):
            if i == c.get(KEY_FETCH_SUBJECTS,
                          DEFAULT_STORE_VALUES[KEY_FETCH_SUBJECTS]):
                radio.setChecked(True)
            self.fetch_subjects_radios_group.addButton(radio, i)
            other_group_box_layout.addWidget(radio, 3 + i, 1, 1, 1)
Beispiel #10
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle('xml_html__xpath__css_selector__gui')

        self.le_xpath_css = Qt.QLineEdit()

        self.rb_xpath = Qt.QRadioButton('XPath')
        self.rb_css_selector = Qt.QRadioButton('CSS selector')
        self.rb_css_selector.setChecked(True)

        self.text_edit_input = Qt.QPlainTextEdit()
        self.text_edit_output = Qt.QPlainTextEdit()

        self.label_error = Qt.QLabel()
        self.label_error.setStyleSheet("QLabel { color : red; }")
        self.label_error.setTextInteractionFlags(Qt.Qt.TextSelectableByMouse)
        self.label_error.setSizePolicy(Qt.QSizePolicy.Expanding,
                                       Qt.QSizePolicy.Preferred)

        self.button_detail_error = Qt.QPushButton('...')
        self.button_detail_error.setFixedSize(20, 20)
        self.button_detail_error.setToolTip('Detail error')
        self.button_detail_error.hide()

        self.last_error_message = None
        self.last_detail_error_message = None

        self.le_xpath_css.textEdited.connect(self.on_process)
        self.rb_xpath.clicked.connect(self.on_process)
        self.rb_css_selector.clicked.connect(self.on_process)
        self.text_edit_input.textChanged.connect(self.on_process)
        self.button_detail_error.clicked.connect(
            self.show_detail_error_message)

        self.rb_parser_html = Qt.QRadioButton('HTML')
        self.rb_parser_html.setChecked(True)
        self.rb_parser_xml = Qt.QRadioButton('XML')

        self.button_parser_group = Qt.QButtonGroup()
        self.button_parser_group.addButton(self.rb_parser_xml)
        self.button_parser_group.addButton(self.rb_parser_html)

        self.button_parser_group.buttonClicked.connect(self.on_process)

        splitter = Qt.QSplitter()
        splitter.setSizePolicy(Qt.QSizePolicy.Expanding,
                               Qt.QSizePolicy.Expanding)
        splitter.addWidget(self.text_edit_input)
        splitter.addWidget(self.text_edit_output)

        layout_xpath_css = Qt.QHBoxLayout()
        layout_xpath_css.addWidget(self.le_xpath_css)
        layout_xpath_css.addWidget(self.rb_xpath)
        layout_xpath_css.addWidget(self.rb_css_selector)

        layout = Qt.QVBoxLayout()
        layout.addLayout(layout_xpath_css)
        layout.addWidget(splitter)

        layout_input_parser = Qt.QHBoxLayout()
        layout_input_parser.addWidget(Qt.QLabel('Parser:'))
        layout_input_parser.addWidget(self.rb_parser_html)
        layout_input_parser.addWidget(self.rb_parser_xml)
        layout_input_parser.addStretch()
        layout.addLayout(layout_input_parser)

        layout_error = Qt.QHBoxLayout()
        layout_error.addWidget(self.label_error)
        layout_error.addWidget(self.button_detail_error)

        layout.addLayout(layout_error)

        self.setLayout(layout)
Beispiel #11
0
    def initUI(self):

        ######################################################################
        # Create the widgets which control the clk divider module:
        # Needs: clk_divider_modulus, bDividerOn, bPulses or Square Wave
        ######################################################################
        self.qgroupbox_divider = Qt.QGroupBox(
            'Clk divider settings (Triggers the PRBS generator on DOUT2), enter to accept changes'
        )
        self.qgroupbox_divider.setAutoFillBackground(True)

        if self.bPulses:
            output_freq = 2 * self.sl.dev.ADC_CLK_Hz / (
                self.clk_divider_modulus)
        else:
            # square wave mode:
            output_freq = 2 * self.sl.dev.ADC_CLK_Hz / (
                2 * (self.clk_divider_modulus))

        self.qlbl_modulus = Qt.QLabel(
            'Modulus [2, 2^32-1], [samples at 200 MHz]:')
        self.qedit_modulus = Qt.QLineEdit(
            str(int(self.clk_divider_modulus + 1)))
        self.qedit_modulus.editingFinished.connect(self.updateClicked)

        self.qlbl_phaseinc = Qt.QLabel(
            'Time increment [-Period, Period], [seconds]:')
        self.qedit_phaseinc = Qt.QLineEdit('0')
        #        self.qedit_phaseinc.editingFinished.connect(self.phaseIncrement)
        self.qbtn_phaseinc = Qt.QPushButton('Apply')
        self.qbtn_phaseinc.clicked.connect(self.phaseIncrement)

        # Modulation frequency:
        self.qlbl_freq = Qt.QLabel('Actual frequency [Hz]:')
        self.qlbl_actual_frequency = Qt.QLabel(str(output_freq))
        #        self.qlbl_actual_frequency.setMaximumWidth(60)

        # Sine/Square wave
        self.qradio_pulses = Qt.QRadioButton('5 ns pulses')
        self.qradio_square_wave = Qt.QRadioButton('Square wave')
        self.qsign_group = Qt.QButtonGroup(self)
        self.qsign_group.addButton(self.qradio_pulses)
        self.qsign_group.addButton(self.qradio_square_wave)

        self.qradio_pulses.setChecked(bool(self.bPulses))
        self.qradio_square_wave.setChecked(not bool(self.bPulses))
        self.qradio_pulses.clicked.connect(self.updateClicked)
        self.qradio_square_wave.clicked.connect(self.updateClicked)

        # On/Off button
        self.qbtn_divider_on = QtGui.QPushButton('Activate output')
        self.qbtn_divider_on.clicked.connect(self.updateClicked)
        self.qbtn_divider_on.setCheckable(True)
        self.qbtn_divider_on.setChecked(bool(self.bDividerOn))

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_modulus, 0, 0)
        grid.addWidget(self.qedit_modulus, 0, 1, 1, 2)

        grid.addWidget(self.qlbl_phaseinc, 1, 0)
        grid.addWidget(self.qedit_phaseinc, 1, 1)
        grid.addWidget(self.qbtn_phaseinc, 1, 2)

        grid.addWidget(self.qlbl_freq, 2, 0)
        grid.addWidget(self.qlbl_actual_frequency, 2, 1, 1, 2)
        grid.addWidget(self.qradio_pulses, 3, 0)
        grid.addWidget(self.qradio_square_wave, 3, 1, 1, 2)

        grid.addWidget(self.qbtn_divider_on, 4, 0, 1, 3)

        self.qgroupbox_divider.setLayout(grid)

        ######################################################################
        # Create the widgets which control the residuals streaming module:
        # Needs: data_delay, trigger_delay, boxcar_filter_size
        ######################################################################
        self.qgroupbox_streaming = Qt.QGroupBox('Residuals streaming settings')
        self.qgroupbox_streaming.setAutoFillBackground(True)

        if self.bPulses:
            output_freq = 2 * self.sl.dev.ADC_CLK_Hz / (
                self.clk_divider_modulus)
        else:
            # square wave mode:
            output_freq = 2 * self.sl.dev.ADC_CLK_Hz / (
                2 * (self.clk_divider_modulus))

        self.qlbl_data_delay = Qt.QLabel('Data delay, [samples at 100 MHz]:')
        self.qedit_data_delay = Qt.QLineEdit('1')
        self.qedit_data_delay.textChanged.connect(self.residualsClicked)
        self.qedit_data_delay.setMaximumWidth(60)

        self.qlbl_trigger_delay = Qt.QLabel(
            'Trigger delay, [samples at 100 MHz]:')
        self.qedit_trigger_delay = Qt.QLineEdit('1')
        self.qedit_trigger_delay.textChanged.connect(self.residualsClicked)
        self.qedit_trigger_delay.setMaximumWidth(60)

        self.qlbl_boxcar_size = Qt.QLabel(
            'Boxcar filter size, [samples at 100 MHz]:')
        self.qedit_boxcar_size = Qt.QLineEdit('10')
        self.qedit_boxcar_size.textChanged.connect(self.residualsClicked)
        self.qedit_boxcar_size.setMaximumWidth(60)

        # Saturated or modulo phase 0:
        self.qlbl_phase0 = Qt.QLabel('Phase residuals 0:')
        self.qchk_Saturation0 = Qt.QRadioButton('Saturation')
        self.qchk_Modulo0 = Qt.QRadioButton('Modulo')
        self.qphase0_group = Qt.QButtonGroup(self)
        self.qphase0_group.addButton(self.qchk_Saturation0)
        self.qphase0_group.addButton(self.qchk_Modulo0)

        self.qchk_Saturation0.setChecked(True)
        self.qchk_Modulo0.setChecked(False)

        self.qchk_Saturation0.clicked.connect(self.residualsClicked)
        self.qchk_Modulo0.clicked.connect(self.residualsClicked)

        # Saturated or modulo phase 1:
        self.qlbl_phase1 = Qt.QLabel('Phase residuals 1:')
        self.qchk_Saturation1 = Qt.QRadioButton('Saturation')
        self.qchk_Modulo1 = Qt.QRadioButton('Modulo')
        self.qphase1_group = Qt.QButtonGroup(self)
        self.qphase1_group.addButton(self.qchk_Saturation1)
        self.qphase1_group.addButton(self.qchk_Modulo1)

        self.qchk_Saturation1.setChecked(True)
        self.qchk_Modulo1.setChecked(False)

        self.qchk_Saturation1.clicked.connect(self.residualsClicked)
        self.qchk_Modulo1.clicked.connect(self.residualsClicked)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_data_delay, 0, 0, 1, 1)
        grid.addWidget(self.qedit_data_delay, 0, 1, 1, 2)
        grid.addWidget(self.qlbl_trigger_delay, 1, 0, 1, 1)
        grid.addWidget(self.qedit_trigger_delay, 1, 1, 1, 2)
        grid.addWidget(self.qlbl_boxcar_size, 2, 0, 1, 1)
        grid.addWidget(self.qedit_boxcar_size, 2, 1, 1, 2)

        grid.addWidget(self.qlbl_phase0, 3, 0)
        grid.addWidget(self.qchk_Saturation0, 3, 1)
        grid.addWidget(self.qchk_Modulo0, 3, 2)

        grid.addWidget(self.qlbl_phase1, 4, 0)
        grid.addWidget(self.qchk_Saturation1, 4, 1)
        grid.addWidget(self.qchk_Modulo1, 4, 2)

        self.qgroupbox_streaming.setLayout(grid)

        ######################################################################
        # Create the widgets which control the DDC settings
        ######################################################################
        self.qgroupbox_ddc = Qt.QGroupBox('DDC settings')
        self.qgroupbox_ddc.setAutoFillBackground(True)

        # Wideband/narrowband DDC0:
        self.qlbl_ddc0 = Qt.QLabel('DDC 0 filter BW:')
        self.qchk_Wideband0 = Qt.QRadioButton('Wideband (31 MHz)')
        self.qchk_Narrowband0 = Qt.QRadioButton('Narrowband (7.5 MHz)')
        self.qchk_WidebandFIR0 = Qt.QRadioButton('Wideband FIR (62 MHz)')
        self.qddc0_group = Qt.QButtonGroup(self)
        self.qddc0_group.addButton(self.qchk_Wideband0)
        self.qddc0_group.addButton(self.qchk_Narrowband0)
        self.qddc0_group.addButton(self.qchk_WidebandFIR0)

        self.qchk_Wideband0.setChecked(True)
        self.qchk_Narrowband0.setChecked(False)
        self.qchk_WidebandFIR0.setChecked(False)

        self.qchk_Wideband0.clicked.connect(self.ddcClicked)
        self.qchk_Narrowband0.clicked.connect(self.ddcClicked)
        self.qchk_WidebandFIR0.clicked.connect(self.ddcClicked)

        # DDC0 CORDIC or Quadrature
        self.qlbl_ddc0angle = Qt.QLabel('DDC 0 CORDIC or Quadrature:')
        self.qchk_cordic0 = Qt.QRadioButton('CORDIC')
        self.qchk_quadrature_msb0 = Qt.QRadioButton('Quadrature MSB')
        self.qchk_quadrature_lsb0 = Qt.QRadioButton('Quadrature LSB')
        self.qchk_inphase_msb0 = Qt.QRadioButton('In-Phase MSB')
        self.qchk_inphase_lsb0 = Qt.QRadioButton('In-Phase LSB')
        self.qddc0_group = Qt.QButtonGroup(self)
        self.qddc0_group.addButton(self.qchk_cordic0)
        self.qddc0_group.addButton(self.qchk_quadrature_msb0)
        self.qddc0_group.addButton(self.qchk_quadrature_lsb0)
        self.qddc0_group.addButton(self.qchk_inphase_msb0)
        self.qddc0_group.addButton(self.qchk_inphase_lsb0)

        self.qchk_cordic0.setChecked(True)
        self.qchk_quadrature_msb0.setChecked(False)
        self.qchk_quadrature_lsb0.setChecked(False)

        self.qchk_cordic0.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_msb0.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_lsb0.clicked.connect(self.ddcClicked)
        self.qchk_inphase_msb0.clicked.connect(self.ddcClicked)
        self.qchk_inphase_lsb0.clicked.connect(self.ddcClicked)

        # Wideband/narrowband DDC1:
        self.qlbl_ddc1 = Qt.QLabel('DDC 1 filter BW:')
        self.qchk_Wideband1 = Qt.QRadioButton('Wideband (31 MHz)')
        self.qchk_Narrowband1 = Qt.QRadioButton('Narrowband (7.5 MHz)')
        self.qchk_WidebandFIR1 = Qt.QRadioButton('Wideband FIR (62 MHz)')
        self.qddc1_group = Qt.QButtonGroup(self)
        self.qddc1_group.addButton(self.qchk_Wideband1)
        self.qddc1_group.addButton(self.qchk_Narrowband1)
        self.qddc1_group.addButton(self.qchk_WidebandFIR1)

        self.qchk_Wideband1.setChecked(True)
        self.qchk_Narrowband1.setChecked(False)
        self.qchk_WidebandFIR1.setChecked(False)

        self.qchk_Wideband1.clicked.connect(self.ddcClicked)
        self.qchk_Narrowband1.clicked.connect(self.ddcClicked)
        self.qchk_WidebandFIR1.clicked.connect(self.ddcClicked)

        # DDC1 CORDIC or Quadrature
        self.qlbl_ddc1angle = Qt.QLabel('DDC 1 CORDIC or Quadrature:')
        self.qchk_cordic1 = Qt.QRadioButton('CORDIC')
        self.qchk_quadrature_msb1 = Qt.QRadioButton('Quadrature MSB')
        self.qchk_quadrature_lsb1 = Qt.QRadioButton('Quadrature LSB')
        self.qchk_inphase_msb1 = Qt.QRadioButton('In-Phase MSB')
        self.qchk_inphase_lsb1 = Qt.QRadioButton('In-Phase LSB')
        self.qddc1_group = Qt.QButtonGroup(self)
        self.qddc1_group.addButton(self.qchk_cordic1)
        self.qddc1_group.addButton(self.qchk_quadrature_msb1)
        self.qddc1_group.addButton(self.qchk_quadrature_lsb1)
        self.qddc1_group.addButton(self.qchk_inphase_msb1)
        self.qddc1_group.addButton(self.qchk_inphase_lsb1)

        self.qchk_cordic1.setChecked(True)
        self.qchk_quadrature_msb1.setChecked(False)
        self.qchk_quadrature_lsb1.setChecked(False)

        self.qchk_cordic1.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_msb1.clicked.connect(self.ddcClicked)
        self.qchk_quadrature_lsb1.clicked.connect(self.ddcClicked)
        self.qchk_inphase_msb1.clicked.connect(self.ddcClicked)
        self.qchk_inphase_lsb1.clicked.connect(self.ddcClicked)

        # Put all the widgets into a grid layout
        grid = QtGui.QGridLayout()

        grid.addWidget(self.qlbl_ddc0, 0, 0)
        grid.addWidget(self.qchk_Wideband0, 0, 1)
        grid.addWidget(self.qchk_Narrowband0, 0, 2)
        grid.addWidget(self.qchk_WidebandFIR0, 0, 3)

        #FEATURE
        grid.addWidget(self.qlbl_ddc0angle, 1, 0)
        grid.addWidget(self.qchk_cordic0, 1, 1)
        grid.addWidget(self.qchk_quadrature_msb0, 1, 2)
        grid.addWidget(self.qchk_quadrature_lsb0, 1, 3)
        grid.addWidget(self.qchk_inphase_msb0, 2, 2)
        grid.addWidget(self.qchk_inphase_lsb0, 2, 3)

        grid.addWidget(self.qlbl_ddc1, 3, 0)
        grid.addWidget(self.qchk_Wideband1, 3, 1)
        grid.addWidget(self.qchk_Narrowband1, 3, 2)
        grid.addWidget(self.qchk_WidebandFIR1, 3, 3)

        #FEATURE
        grid.addWidget(self.qlbl_ddc1angle, 4, 0)
        grid.addWidget(self.qchk_cordic1, 4, 1)
        grid.addWidget(self.qchk_quadrature_msb1, 4, 2)
        grid.addWidget(self.qchk_quadrature_lsb1, 4, 3)
        grid.addWidget(self.qchk_inphase_msb1, 5, 2)
        grid.addWidget(self.qchk_inphase_lsb1, 5, 3)

        self.qgroupbox_ddc.setLayout(grid)

        vbox = Qt.QVBoxLayout()
        #FEATURE
        # vbox.addWidget(self.qgroupbox_divider)
        # vbox.addWidget(self.qgroupbox_streaming)
        vbox.addWidget(self.qgroupbox_ddc)
        vbox.addStretch(1)
        self.setLayout(vbox)

        # Adjust the size and position of the window
        #        self.resize(800, 600)
        self.center()
        self.setWindowTitle(self.custom_shorthand + ': Peripherals settings')