# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# class MplCanvas(FigureCanvasQTAgg):
#     def __init__(self, parent=None, ):
#         self.fig, self.ax = pyplot.subplots()
#         FigureCanvasQTAgg.__init__(self, self.fig)
#         self.setParent(parent)
#         self.setSizePolicy(QT.QSizePolicy.Expanding, QT.QSizePolicy.Expanding)
#         self.updateGeometry()
#         self.fig.set_facecolor('#FFFFFF')
# 
# Path: hearinglosssimulator/gui/myqt.py
# def DebugDecorator(func):
#     def wrapper(*args, **kargs):
#         print('DebugDecorator', *args, *kargs)
#         try:
#             ret = func(*args, **kargs)
#             return ret
#         except Exception as e:
#             print('#'*20)
#             print('# ERROR IN {}'.format(func) * 5 )
#             print('#', e)
#             print('#'*20)
#     return wrapper    


from hearinglosssimulator.gui.myqt import QT
from collections import OrderedDict
from hearinglosssimulator.gui.guitools import MplCanvas
from hearinglosssimulator.gui.myqt import DebugDecorator
import pyqtgraph as pg
import numpy as np
import scipy.interpolate
import json
import time
    import matplotlib.pyplot as plt
        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)

# Path: hearinglosssimulator/gui/myqt.py
# QT = ModuleProxy(['', 'Q', 'Qt'], [QtCore.Qt, QtCore, QtGui, QtWidgets])
# 
# Path: hearinglosssimulator/gui/guitools.py
# class MplCanvas(FigureCanvasQTAgg):
#     def __init__(self, parent=None, ):
#         self.fig, self.ax = pyplot.subplots()
#         FigureCanvasQTAgg.__init__(self, self.fig)
#         self.setParent(parent)
#         self.setSizePolicy(QT.QSizePolicy.Expanding, QT.QSizePolicy.Expanding)
#         self.updateGeometry()
#         self.fig.set_facecolor('#FFFFFF')
# 
# Path: hearinglosssimulator/gui/myqt.py
# def DebugDecorator(func):
#     def wrapper(*args, **kargs):
#         print('DebugDecorator', *args, *kargs)
#         try:
#             ret = func(*args, **kargs)
#             return ret
#         except Exception as e:
#             print('#'*20)
#             print('# ERROR IN {}'.format(func) * 5 )
#             print('#', e)
#             print('#'*20)
#     return wrapper    


# Path: hearinglosssimulator/gui/lossparameters.py
from hearinglosssimulator.gui.myqt import QT
from collections import OrderedDict
from hearinglosssimulator.gui.guitools import MplCanvas
from hearinglosssimulator.gui.myqt import DebugDecorator
import pyqtgraph as pg
import numpy as np
import scipy.interpolate
import json
import time
    import matplotlib.pyplot as plt

        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')