# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# def get_dict_from_group_param(param, cascade = False):
#     assert param.type() == 'group'
#     d = {}
#     for p in param.children():
#         if p.type() == 'group':
#             if cascade:
#                 d[p.name()] = get_dict_from_group_param(p, cascade = True)
#             continue
#         else:
#             d[p.name()] = p.value()
#     return d


from hearinglosssimulator.gui.myqt import QT
from hearinglosssimulator.gui.guitools import get_dict_from_group_param
import pyqtgraph as pg
import numpy as np
import sounddevice as sd
    {'name': 'speaker_gain', 'type': 'float', 'value':0., 'limits': (-63.5, 24.), 'step' :0.5, 'suffix': 'dB', 'siPrefix': True},
    {'name': 'microphone_gain', 'type': 'float', 'value':20.,  'limits': (-12, 20.), 'step' :0.5, 'suffix': 'dB', 'siPrefix': True},
    
    
]


class WifiDeviceParameter(QT.QWidget):
    def __init__(self, parent = None):
        QT.QWidget.__init__(self, parent)
        mainlayout  =QT.QVBoxLayout()
        self.setLayout(mainlayout)
        self.resize(400, 400)
        
        #~ self.client = client
        
        self.params = pg.parametertree.Parameter.create(name='wifi_device', type='group', children=_params)
        
        self.tree_params = pg.parametertree.ParameterTree(parent  = self)
        self.tree_params.header().hide()
        self.tree_params.setParameters(self.params, showTop=True)
        mainlayout.addWidget(self.tree_params)
    
    def set_configuration(self, **params):
        try: 
            for k, v in params.items():
                self.params[k] = v
        except Exception as e: 
            print('erreur WifiDeviceParameter.set_configuration', e)
    

# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# def get_dict_from_group_param(param, cascade = False):
#     assert param.type() == 'group'
#     d = {}
#     for p in param.children():
#         if p.type() == 'group':
#             if cascade:
#                 d[p.name()] = get_dict_from_group_param(p, cascade = True)
#             continue
#         else:
#             d[p.name()] = p.value()
#     return d


# Path: hearinglosssimulator/gui/wifidevice/wifideviceparameters.py
from hearinglosssimulator.gui.myqt import QT
from hearinglosssimulator.gui.guitools import get_dict_from_group_param
import pyqtgraph as pg
import numpy as np
import sounddevice as sd

    {'name': 'speaker_gain', 'type': 'float', 'value':0., 'limits': (-63.5, 24.), 'step' :0.5, 'suffix': 'dB', 'siPrefix': True},
    {'name': 'microphone_gain', 'type': 'float', 'value':20.,  'limits': (-12, 20.), 'step' :0.5, 'suffix': 'dB', 'siPrefix': True},
    
    
]


class WifiDeviceParameter(QT.QWidget):
    def __init__(self, parent = None):
        QT.QWidget.__init__(self, parent)
        mainlayout  =QT.QVBoxLayout()
        self.setLayout(mainlayout)
        self.resize(400, 400)
        
        #~ self.client = client
        
        self.params = pg.parametertree.Parameter.create(name='wifi_device', type='group', children=_params)
        
        self.tree_params = pg.parametertree.ParameterTree(parent  = self)
        self.tree_params.header().hide()
        self.tree_params.setParameters(self.params, showTop=True)
        mainlayout.addWidget(self.tree_params)
    
    def set_configuration(self, **params):
        try: 
            for k, v in params.items():
                self.params[k] = v
        except Exception as e: 
            print('erreur WifiDeviceParameter.set_configuration', e)
    

    def get_configuration(self):