Commit 9cf7a126 authored by Benjamin Mummery's avatar Benjamin Mummery 💻

Merge branch 'ui_dev' of ssh://ohwr.org:7999/project/hev into ui_dev

parents b5b95d4c 75254e5f
Pipeline #1842 canceled with stages
......@@ -525,8 +525,8 @@ class NativeUI(HEVClient, QMainWindow):
button_widget.pressed.connect(self.clinical_handler.commandSent)
elif isinstance(button_widget, CancelButtonWidget):
# mode = self.mode_handler.get_mode(key)
button_widget.clicked.connect(self.mode_handler.commandSent)
button_widget.pressed.connect(self.clinical_handler.commandSent)
button_widget.clicked.connect(lambda i=key: self.mode_handler.commandSent(i))
button_widget.pressed.connect(lambda i=key: self.clinical_handler.commandSent(i))
for key, spin_widget in self.clinical_handler.limSpinDict.items():
spin_widget.simpleSpin.manualChanged.connect(
......
......@@ -64,6 +64,7 @@ class ModeHandler(PayloadHandler):
def active_payload(self, *args) -> int:
target_data = self.get_db()
print(target_data)
outdict = {}
for key in self.relevantKeys:
......@@ -126,7 +127,9 @@ class ModeHandler(PayloadHandler):
self.NativeUI.q_send_cmd(*command)
if 'SET_MODE' in command:
self.modeSwitched.emit(command[-1])
self.commandSent()
if 'SET_TARGET' in command[0]:
mode = self.get_mode(command[0])
self.commandSent(mode)
return 0
def handle_cancel_pressed(self, buttonMode: str):
......@@ -151,14 +154,21 @@ class ModeHandler(PayloadHandler):
self.refresh_button_colour()
self.refresh_main_button_colour()
def commandSent(self):
def commandSent(self, key = 'CURRENT'):
self.commandList = []
print('going to use ')
print(key)
mode = self.get_mode(key)
if mode == 'CURRENT':
mode == self.NativeUI.currentMode
for widget in self.spinDict:
if self.activeMode in widget:
if mode.replace("/", "_").replace("-", "_") in widget.replace("/", "_").replace("-", "_"):#self.NativeUI.currentMode.replace("/", "_").replace("-", "_") in widget:
print('setting false ' + widget)
self.spinDict[widget].manuallyUpdated = False
for widget in self.mainSpinDict:
self.mainSpinDict[widget].manuallyUpdated = False
self.NativeUI.q_send_cmd('GET_TARGETS', mode.replace("/", "_").replace("-", "_"))
self.active_payload()
self.refresh_button_colour()
self.refresh_main_button_colour()
......@@ -238,5 +248,7 @@ class ModeHandler(PayloadHandler):
def get_mode(self, key: str):
"""Get mode from the widget's corresponding key."""
for mode in self.modeList + ["CURRENT"]:
if mode in key:
if mode.replace("/", "_").replace("-", "_") in key.replace("/", "_").replace("-", "_"):
return mode
print('failed to get mode out of')
print(key)
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