Commit b5b95d4c authored by Benjamin Mummery's avatar Benjamin Mummery 💻

bugfix: measurement_handler now possesses a self.NativeUI attribute so that…

bugfix: measurement_handler now possesses a self.NativeUI attribute so that 'self.NativeUI.currentMode = cycle_data['ventilation_mode']' can actually function
parent 563cb887
......@@ -189,7 +189,7 @@ class NativeUI(HEVClient, QMainWindow):
# Set up the handlers
self.battery_handler = BatteryHandler()
self.data_handler = DataHandler(plot_history_length=1000)
self.measurement_handler = MeasurementHandler()
self.measurement_handler = MeasurementHandler(self)
self.personal_handler = PersonalHandler(self)
self.mode_handler = ModeHandler(self) # , self.mode_confirm_popup)
self.expert_handler = ExpertHandler(self)
......@@ -554,7 +554,7 @@ class NativeUI(HEVClient, QMainWindow):
self.clinical_handler.handle_cancelbutton_click
)
button_widget.clicked.connect(
lambda: self.mode_handler.handle_cancel_pressed('CURRENT')
lambda: self.mode_handler.handle_cancel_pressed("CURRENT")
)
for widget in self.clinical_handler.setSpinDict.values():
......
......@@ -14,10 +14,15 @@ class MeasurementHandler(PayloadHandler):
UpdateMeasurements = Signal(dict)
def __init__(self, *args, **kwargs):
def __init__(self, NativeUI, *args, **kwargs):
super().__init__(["CYCLE", "READBACK"], *args, **kwargs)
self.NativeUI = NativeUI
def active_payload(self, *args, **kwargs) -> int:
"""
Overwrite the base PayloadHandler active_payload class that is triggered
whenever a new payload is passed to the handler.
"""
cycle_data = self.get_db()
outdict = {}
......@@ -38,6 +43,6 @@ class MeasurementHandler(PayloadHandler):
outdict[key] = cycle_data[key]
except KeyError:
logging.debug("Invalid key %s in measurement database", key)
self.NativeUI.currentMode = cycle_data['ventilation_mode']
self.NativeUI.currentMode = cycle_data["ventilation_mode"]
self.UpdateMeasurements.emit(outdict)
return 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment