Commit 262a8713 authored by Tiago Sarmento's avatar Tiago Sarmento

tweaks

parent 563cb887
Pipeline #1840 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(
......
......@@ -126,7 +126,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,10 +153,16 @@ 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
......@@ -238,5 +246,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