From 28358f53857ad67a20b9e37e6b95baf71c6c8d2c Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Sat, 22 Aug 2020 19:53:39 +0200 Subject: [PATCH] Added calibration settings --- lasp/lasp_common.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lasp/lasp_common.py b/lasp/lasp_common.py index e3a7c58..3c3ec95 100644 --- a/lasp/lasp_common.py +++ b/lasp/lasp_common.py @@ -51,6 +51,7 @@ class Qty: level_ref_name: str level_ref_value: str + class SIQtys: N = Qty(name='Number', unit_name='No unit / full scale', @@ -95,6 +96,36 @@ class SIQtys: def getCurrent(cb): return SIQtys.types[cb.currentIndex()] +@dataclass +class CalSetting: + name: str + cal_value: float + qty: Qty + +class CalibrationSettings: + one = CalSetting('94 dB SPL', 1.0, SIQtys.AP) + two = CalSetting('114 dB SPL', 10.0, SIQtys.AP) + + types = (one, two) + default = one + default_index = 0 + + @staticmethod + def fillComboBox(cb): + """ + Fill FreqWeightings to a combobox + + Args: + cb: QComboBox to fill + """ + cb.clear() + for ty in CalibrationSettings.types: + cb.addItem(f'{ty.name}') + cb.setCurrentIndex(CalibrationSettings.default_index) + + @staticmethod + def getCurrent(cb): + return CalibrationSettings.types[cb.currentIndex()] lasp_appdir = appdirs.user_data_dir('Lasp', 'ASCEE') @@ -106,6 +137,7 @@ if not os.path.exists(lasp_appdir): sys.exit(1) + class Shelve: def load(self, key, default_value): """