Skip to content

Commit

Permalink
Remove the need for a accelerator object
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Luvizotto authored and xf07bm committed Nov 2, 2017
1 parent b8f44ca commit f6bfa14
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions isstools/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def __init__(self, plan_funcs = [],
else:
self.set_gains_offsets_scan = None

if 'sample_stages' in kwargs:
self.sample_stages = kwargs['sample_stages']
del kwargs['sample_stages']
else:
self.sample_stages = []

super().__init__(*args, **kwargs)
self.setupUi(self)
print(QtWidgets.QApplication.instance())
Expand Down Expand Up @@ -149,11 +155,10 @@ def __init__(self, plan_funcs = [],
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)
if accelerator is not None:
self.accelerator = accelerator
self.accelerator.beam_current.subscribe(self.labelBeamCurrentUpdate)
self.accelerator.status.subscribe(self.labelAcceleratorStatusUpdate)

# Initialize 'Beamline setup' tab
# Looking for analog pizzaboxes:
Expand Down Expand Up @@ -617,18 +622,18 @@ def toggle_shutter():
self.push_save_csv.clicked.connect(self.save_csv)

#checking which xystage to use:
if self.motors_dict['samplexy_x']['object'].connected and\
self.motors_dict['samplexy_y']['object'].connected:
self.stage_x = 'samplexy_x'
self.stage_y = 'samplexy_y'
elif self.motors_dict['huber_stage_z']['object'].connected and\
self.motors_dict['huber_stage_y']['object'].connected:
self.stage_x = 'huber_stage_z'
self.stage_y = 'huber_stage_y'
else:
self.stage_x = ''
self.stage_y = ''
for stage in self.sample_stages:
if stage['x'] in self.motors_dict and stage['y'] in self.motors_dict:
if self.motors_dict[stage['x']]['object'].connected and\
self.motors_dict[stage['y']]['object'].connected:
self.stage_x = stage['x']
self.stage_y = stage['y']
break
if self.stage_x == '' or self.stage_y == '':
print('No stage set! Batch mode will not work!')


# Start QTimer to display current day and time
self.timerCurrentTime= QtCore.QTimer(self)
self.timerCurrentTime.setInterval(1000)
Expand Down

0 comments on commit f6bfa14

Please sign in to comment.