def __init__(self, client=None, parent=None):
        QT.QWidget.__init__(self, parent)

        self.client = client

        self.resize(600, 600)

        mainlayout = QT.QVBoxLayout()
        self.setLayout(mainlayout)

        self.devicewidget = WifiDeviceWidget(client=client)
        mainlayout.addWidget(self.devicewidget)

        ##
        mainlayout.addWidget(QT.QLabel(u'<h1><b>Audio params</b>'))
        h = QT.QHBoxLayout()
        mainlayout.addLayout(h)
        but = QT.QPushButton('Get params from device')
        h.addWidget(but)
        but.clicked.connect(self.get_params_from_device)
        but = QT.QPushButton('Set params to device')
        h.addWidget(but)
        but.clicked.connect(self.set_params_to_device)
        self.wifiDeviceParameter = WifiDeviceParameter()
        mainlayout.addWidget(self.wifiDeviceParameter)

        ##
        mainlayout.addWidget(QT.QLabel(u'<h1><b>ssid</b>'))
        but = QT.QPushButton('Apply ssid')
        mainlayout.addWidget(but)
        but.clicked.connect(self.set_ssid)
        self.edit_ssid = QT.QLineEdit()
        mainlayout.addWidget(self.edit_ssid)

        ##
        mainlayout.addWidget(QT.QLabel(u'<h1><b>Audio loop</b>'))
        h = QT.QHBoxLayout()
        mainlayout.addLayout(h)
        but = QT.QPushButton('Start')
        h.addWidget(but)
        but.clicked.connect(self.start_audio)
        but = QT.QPushButton('Stop')
        h.addWidget(but)
        but.clicked.connect(self.stop_audio)

        self.thread_audio_loop = ThreadAudioStream(client.client_protocol,
                                                   parent=self)
        self.thread_audio_loop.connection_broken.connect(
            self.client.on_connection_broken)
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        QT.QWidget.__init__(self, parent)
        mainlayout = QT.QVBoxLayout()
        self.setLayout(mainlayout)

        h = QT.QHBoxLayout()
        mainlayout.addLayout(h)

        self.tab = QT.QTabWidget()
        h.addWidget(self.tab)

        ears = ('left', 'right')
        self.hl_params = {}
        for ear in ears:
            p = OneChannelHearingLossParameter()
            self.hl_params[ear] = p
            self.tab.addTab(p, ear)

        v = QT.QVBoxLayout()
        h.addLayout(v)

        v.addWidget(QT.QLabel('Hear level presets:'))
        self.combo_hearing_level_preset = QT.QComboBox()
        self.combo_hearing_level_preset.setMinimumHeight(48)
        v.addWidget(self.combo_hearing_level_preset)
        self.combo_hearing_level_preset.addItems(hearing_level_preset.keys())
        self.combo_hearing_level_preset.currentIndexChanged.connect(
            self.on_change_preset)
        v.addWidget(QT.QLabel('Compression healthiness:'))
        self.combo_compression_loss_preset = QT.QComboBox()
        self.combo_compression_loss_preset.setMinimumHeight(48)
        v.addWidget(self.combo_compression_loss_preset)
        self.combo_compression_loss_preset.addItems(compression_ratio.keys())
        self.combo_compression_loss_preset.setCurrentIndex(2)
        self.combo_compression_loss_preset.currentIndexChanged.connect(
            self.on_change_preset)
        v.addSpacing(30)
        but = QT.QPushButton(u'Copy L>R')
        v.addWidget(but)
        but.clicked.connect(self.copy_l_to_r)
        but = QT.QPushButton(u'Load')
        v.addWidget(but)
        but.clicked.connect(self.load)
        but = QT.QPushButton(u'Save')
        v.addWidget(but)
        but.clicked.connect(self.save)
        v.addStretch()

        self.nb_channel = 2
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        QT.QWidget.__init__(self, parent)
        mainlayout = QT.QVBoxLayout()
        self.setLayout(mainlayout)

        self.canvas = MplCanvas()
        mainlayout.addWidget(self.canvas)

        self.mode = 'simple'

        h = QT.QHBoxLayout()
        mainlayout.addLayout(h)
        h.addSpacerItem(QT.QSpacerItem(130, 0))
        g = QT.QGridLayout()
        h.addLayout(g)
        self.spin_passive_loss = {}
        self.spin_comp_degree = {}
        for i in range(n):
            g.addWidget(QT.QLabel('{} Hz'.format(freqs[i])), 0, i)
            self.spin_passive_loss[i] = s = pg.SpinBox(suffix='dBLoss',
                                                       bounds=[0, 120],
                                                       step=1)
            g.addWidget(s, 1, i)
            s.sigValueChanged.connect(self.on_spinbox_changed)
            self.spin_comp_degree[i] = s = pg.SpinBox(suffix='%',
                                                      bounds=[0, 100],
                                                      step=10)
            g.addWidget(s, 2, i)
            s.sigValueChanged.connect(self.on_spinbox_changed)

        h.addSpacerItem(QT.QSpacerItem(110, 0))

        self.compression_degree = np.array([1.] * n)
        self.passive_loss_db = np.array([0.] * n)
        self.hearing_level = None

        self.lines = plot_hearingloss(self.canvas.ax,
                                      self.hearing_level,
                                      self.compression_degree,
                                      self.passive_loss_db,
                                      mode=self.mode)

        self.refresh_spinbox()