diff --git a/isstools/gui.py b/isstools/gui.py index c98aa600..e7d3714f 100644 --- a/isstools/gui.py +++ b/isstools/gui.py @@ -64,8 +64,15 @@ class ScanGui(*uic.loadUiType(ui_path)): shutters_sig = QtCore.pyqtSignal() progress_sig = QtCore.pyqtSignal() - def __init__(self, plan_funcs = [], prep_traj_plan = None, RE = None, db = None, - hhm = None, shutters = {}, det_dict = {}, motors_dict = {}, + def __init__(self, plan_funcs = [], + prep_traj_plan = None, + RE = None, + db = None, + accelerator = None, + hhm = None, + shutters = {}, + det_dict = {}, + motors_dict = {}, general_scan_func = None, parent=None, *args, **kwargs): if 'write_html_log' in kwargs: @@ -136,6 +143,12 @@ def __init__(self, plan_funcs = [], prep_traj_plan = None, RE = None, db = None, self.motors_dict = motors_dict self.gen_scan_func = general_scan_func + # Initialize general settings + self.accelerator = accelerator + #print(self.accelerator.beam_current.value) + self.accelerator.beam_current.subscribe(self.labelBeamCurrentUpdate) + self.accelerator.status.subscribe(self.labelAcceleratorStatusUpdate) + #self.labelAcceleratorStatusUpdate(value = self.accelerator.status.value) # Initialize 'Beamline setup' tab # Looking for analog pizzaboxes: @@ -170,6 +183,7 @@ def __init__(self, plan_funcs = [], prep_traj_plan = None, RE = None, db = None, else: self.push_get_offsets.setEnabled(False) + # Initialize 'trajectories' tab self.hhm = hhm if self.hhm is not None: @@ -1814,7 +1828,23 @@ def autotune_function(self): print('[Autotune procedure] Complete') - + def labelBeamCurrentUpdate(self, **kwargs): + self.labelBeamCurrent.setText('Beam current is {:.1f} mA'.format(kwargs['value'])) + + + def labelAcceleratorStatusUpdate(self,**kwargs): + if kwargs['value'] == 0: + self.labelAcceleratorStatus.setText('Beam available') + self.labelAcceleratorStatus.setStyleSheet('color: rgb(19,139,67)') + elif kwargs['value'] == 1: + self.labelAcceleratorStatus.setText('Accelerator setup') + self.labelAcceleratorStatus.setStyleSheet('color: rgb(209,116,42)') + elif kwargs['value'] == 2: + self.labelAcceleratorStatus.setText('Accelerator studies') + self.labelAcceleratorStatus.setStyleSheet('color: rgb(209,116,42)') + elif kwargs['value'] == 3: + self.labelAcceleratorStatus.setText('Beam has dumped') + self.labelAcceleratorStatus.setStyleSheet('color: rgb(237,30,30)') def run_prep_traj(self): self.RE(self.prep_traj_plan()) diff --git a/isstools/ui/XLive.ui b/isstools/ui/XLive.ui index 6a436e1a..5be2ab57 100644 --- a/isstools/ui/XLive.ui +++ b/isstools/ui/XLive.ui @@ -45,7 +45,7 @@ - 0 + 4 @@ -5498,7 +5498,7 @@ b - Experiment + Current experiment @@ -5626,89 +5626,6 @@ b - - - - 400 - 10 - 371 - 131 - - - - - 9 - 50 - false - - - - Accelerator - - - - - 10 - 30 - 141 - 16 - - - - - 13 - 50 - false - - - - Beam current - - - - - - 230 - 30 - 31 - 16 - - - - - 13 - 50 - false - - - - mA - - - - - - 160 - 30 - 61 - 16 - - - - - 13 - 50 - false - - - - 000 - - - Qt::AlignCenter - - - @@ -5771,6 +5688,52 @@ b + + + + 390 + 10 + 341 + 20 + + + + + 11 + 50 + false + + + + Beam current + + + + + + 390 + 30 + 291 + 21 + + + + + 9 + 50 + false + + + + accelerator status + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + +