Skip to content

Commit

Permalink
Add accelerator pvs object to GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli Stavitski committed Oct 25, 2017
1 parent e5fe125 commit 5dad5d7
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 88 deletions.
36 changes: 33 additions & 3 deletions isstools/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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())
Expand Down
133 changes: 48 additions & 85 deletions isstools/ui/XLive.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<widget class="QWidget" name="tab_11">
<attribute name="title">
Expand Down Expand Up @@ -5498,7 +5498,7 @@ b</string>
</font>
</property>
<property name="title">
<string notr="true">Experiment</string>
<string notr="true">Current experiment</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
Expand Down Expand Up @@ -5626,89 +5626,6 @@ b</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_12">
<property name="geometry">
<rect>
<x>400</x>
<y>10</y>
<width>371</width>
<height>131</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="title">
<string notr="true">Accelerator</string>
</property>
<widget class="QLabel" name="label_181">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>141</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Beam current</string>
</property>
</widget>
<widget class="QLabel" name="label_182">
<property name="geometry">
<rect>
<x>230</x>
<y>30</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>mA</string>
</property>
</widget>
<widget class="QLabel" name="labelBeamCurrent">
<property name="geometry">
<rect>
<x>160</x>
<y>30</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
<widget class="QLabel" name="labelCurrentTime">
<property name="geometry">
<rect>
Expand Down Expand Up @@ -5771,6 +5688,52 @@ b</string>
<string/>
</property>
</widget>
<widget class="QLabel" name="labelBeamCurrent">
<property name="geometry">
<rect>
<x>390</x>
<y>10</y>
<width>341</width>
<height>20</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Beam current</string>
</property>
</widget>
<widget class="QLabel" name="labelAcceleratorStatus">
<property name="geometry">
<rect>
<x>390</x>
<y>30</y>
<width>291</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>accelerator status</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
Expand Down

0 comments on commit 5dad5d7

Please sign in to comment.