# 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': 'high_freq', 'type': 'float', 'value': 15000.,  'suffix': 'Hz', 'siPrefix': True},
    
    {'name': 'tau_level', 'type': 'float', 'value': 0.005,  'suffix': 's', 'siPrefix': True},
    {'name': 'level_max', 'type': 'float', 'value': 100.,  'suffix': 'dBSpl', 'siPrefix': True},
    {'name': 'level_step', 'type': 'float', 'value': 1.,  'suffix': 'dBSpl', 'siPrefix': True},
    
    {'name': 'chunksize', 'type': 'int', 'value': 1024 },
    {'name': 'backward_chunksize', 'type': 'int', 'value': 2048 },
    
]


class SimulatorParameter(QT.QWidget):
    def __init__(self, with_all_params=True, parent = None):
        QT.QWidget.__init__(self, parent)
        mainlayout  =QT.QVBoxLayout()
        self.setLayout(mainlayout)
        self.resize(400, 400)

        if with_all_params:
            children = _params
        else:
            children = _params[1:-2]
        
        self.params = pg.parametertree.Parameter.create(name='simulator', type='group', children=children)
        
        #~ layout = QT.QVBoxLayout()
        #~ self.setLayout(layout)

        self.tree_params = pg.parametertree.ParameterTree(parent  = self)

# 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/simulatorparameters.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': 'high_freq', 'type': 'float', 'value': 15000.,  'suffix': 'Hz', 'siPrefix': True},
    
    {'name': 'tau_level', 'type': 'float', 'value': 0.005,  'suffix': 's', 'siPrefix': True},
    {'name': 'level_max', 'type': 'float', 'value': 100.,  'suffix': 'dBSpl', 'siPrefix': True},
    {'name': 'level_step', 'type': 'float', 'value': 1.,  'suffix': 'dBSpl', 'siPrefix': True},
    
    {'name': 'chunksize', 'type': 'int', 'value': 1024 },
    {'name': 'backward_chunksize', 'type': 'int', 'value': 2048 },
    
]


class SimulatorParameter(QT.QWidget):
    def __init__(self, with_all_params=True, parent = None):
        QT.QWidget.__init__(self, parent)
        mainlayout  =QT.QVBoxLayout()
        self.setLayout(mainlayout)
        self.resize(400, 400)

        if with_all_params:
            children = _params
        else:
            children = _params[1:-2]
        
        self.params = pg.parametertree.Parameter.create(name='simulator', type='group', children=children)
        
        #~ layout = QT.QVBoxLayout()
        #~ self.setLayout(layout)

        self.tree_params = pg.parametertree.ParameterTree(parent  = self)

        self.tree_params.header().hide()