moving config dialog to app_config
This commit is contained in:
185
app_config.py
185
app_config.py
@@ -9,7 +9,9 @@ import logging
|
|||||||
_log = logging.getLogger(__name__)
|
_log = logging.getLogger(__name__)
|
||||||
|
|
||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
|
from PyQt5.QtWidgets import QApplication, QLineEdit
|
||||||
import os, json, yaml
|
import os, json, yaml
|
||||||
|
import GenericDialog
|
||||||
|
|
||||||
class AppCfg(QSettings):
|
class AppCfg(QSettings):
|
||||||
|
|
||||||
@@ -175,3 +177,186 @@ class AppCfg(QSettings):
|
|||||||
# return str(p)
|
# return str(p)
|
||||||
|
|
||||||
|
|
||||||
|
def dlg_geometry(self,obj):
|
||||||
|
SPN=GenericDialog.Spinner
|
||||||
|
app=QApplication.instance()
|
||||||
|
cfg=app._cfg
|
||||||
|
w, h = map(float,cfg.value(AppCfg.GEO_BEAM_SZ))
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="geometry",
|
||||||
|
message="Enter the size of the beam in microns",
|
||||||
|
inputs={
|
||||||
|
"bw": ("beam width um" ,w,SPN(w, min=1, max=200, suffix=" \u00B5m"),),
|
||||||
|
"bh": ("beam height um",h,SPN(h, min=1, max=200, suffix=" \u00B5m"),),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("Updating beamsize to {}".format(results))
|
||||||
|
bm_sz= (results["bw"], results["bh"])
|
||||||
|
_log.debug("types {}".format(type(w)))
|
||||||
|
cfg.setValue(AppCfg.GEO_BEAM_SZ, bm_sz)
|
||||||
|
cfg.sync()
|
||||||
|
bm=obj._goBeamMarker
|
||||||
|
bm.setSize(bm_sz)
|
||||||
|
#self._beammark.set_beam_size((w, h))
|
||||||
|
|
||||||
|
def dlg_posttube_references(self):
|
||||||
|
SPN=GenericDialog.Spinner
|
||||||
|
app=QApplication.instance()
|
||||||
|
cfg=app._cfg
|
||||||
|
x_up = cfg.value(AppCfg.PST_X_UP , 0.0,type=float)
|
||||||
|
y_up = cfg.value(AppCfg.PST_Y_UP , 0.0,type=float)
|
||||||
|
x_down = cfg.value(AppCfg.PST_X_DOWN, 0.0,type=float)
|
||||||
|
y_down = cfg.value(AppCfg.PST_Y_DOWN, 0.0,type=float)
|
||||||
|
dx = cfg.value(AppCfg.PST_DX , 0.0,type=float)
|
||||||
|
dy = cfg.value(AppCfg.PST_DY , 0.0,type=float)
|
||||||
|
tz_in = cfg.value(AppCfg.PST_TZ_IN , 0.0,type=float)
|
||||||
|
tz_out = cfg.value(AppCfg.PST_TZ_OUT, 0.0,type=float)
|
||||||
|
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="Post Sample Tube Configuration",
|
||||||
|
message="Enter the relative displacements for X and Y to move the post sample tube either in or out.",
|
||||||
|
inputs={
|
||||||
|
AppCfg.PST_X_UP : ("Up X" , x_up , SPN(x_up , decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_Y_UP : ("Up Y" , y_up , SPN(y_up , decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_X_DOWN: ("Down X" , x_down, SPN(x_down, decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_Y_DOWN: ("Down Y" , y_down, SPN(y_down, decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_DX : ("out delta X" , dx , SPN(dx , decimals=3, min=-32.0, max=32.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_DY : ("out delta Y" , dy , SPN(dy , decimals=3, min=-32.0, max=32.0, suffix=" mm"), ),
|
||||||
|
AppCfg.PST_TZ_IN : ("tube Z in position" , tz_in , SPN(tz_in , decimals=3, min=-8.0 , max=1.0 , suffix=" mm"), ),
|
||||||
|
AppCfg.PST_TZ_OUT: ("tube Z OUT position", tz_out, SPN(tz_out, decimals=3, min=-8.0 , max=1.0 , suffix=" mm"), ),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting post-sample-tube displacements {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
cfg.setValue(k, v)
|
||||||
|
cfg.sync()
|
||||||
|
|
||||||
|
def dlg_collimator_reference_positions(self):
|
||||||
|
SPN=GenericDialog.Spinner
|
||||||
|
app=QApplication.instance()
|
||||||
|
cfg=app._cfg
|
||||||
|
x_out = cfg.value(AppCfg.COL_DX , 0.0,type=float)
|
||||||
|
y_out = cfg.value(AppCfg.COL_DY , 0.0,type=float)
|
||||||
|
x_in = cfg.value(AppCfg.COL_X_IN, 0.0,type=float)
|
||||||
|
y_in = cfg.value(AppCfg.COL_Y_IN, 0.0,type=float)
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="Collimator configuration",
|
||||||
|
message="Enter reference positions for the collimator",
|
||||||
|
inputs={
|
||||||
|
AppCfg.COL_DX: ("Collimator out deltaX", x_out, SPN(x_out, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
||||||
|
AppCfg.COL_DY: ("Collimator out deltaY", y_out, SPN(y_out, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
||||||
|
AppCfg.COL_X_IN: ("Collimator in X", x_in, SPN(x_in, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
||||||
|
AppCfg.COL_Y_IN: ("Collimator in Y", y_in, SPN(y_in, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting collimator reference positions {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
cfg.setValue(k, v)
|
||||||
|
cfg.sync()
|
||||||
|
|
||||||
|
def dlg_backlight_positions(self):
|
||||||
|
SPN=GenericDialog.Spinner
|
||||||
|
app=QApplication.instance()
|
||||||
|
cfg=app._cfg
|
||||||
|
p_in = cfg.value(AppCfg.BKLGT_IN,0,type=int)
|
||||||
|
p_out = cfg.value(AppCfg.BKLGT_OUT,0,type=int)
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="Back Light configuration",
|
||||||
|
message="Enter reference positions for the backlight",
|
||||||
|
inputs={
|
||||||
|
AppCfg.BKLGT_IN: ("In position" , p_in , SPN(p_in, min=-30000, max=10), ),
|
||||||
|
AppCfg.BKLGT_OUT: ("Out position", p_out, SPN(p_out, min=-1000, max=10), ),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting back light reference positions {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
cfg.setValue(k, v)
|
||||||
|
cfg.sync()
|
||||||
|
|
||||||
|
def dlg_cryojet_positions(self):
|
||||||
|
p_in = settings.value(CRYOJET_NOZZLE_IN, type=float)
|
||||||
|
p_out = settings.value(CRYOJET_NOZZLE_OUT, type=float)
|
||||||
|
motion_enabled = option(CRYOJET_MOTION_ENABLED)
|
||||||
|
d = GenericDialog(
|
||||||
|
title="Cryojet Nozzle Configuration",
|
||||||
|
message="Enter reference positions for the cryojet nozzle position",
|
||||||
|
inputs={
|
||||||
|
CRYOJET_NOZZLE_IN: ("In position", p_in, Spinner(p_in, min=3, max=15)),
|
||||||
|
CRYOJET_NOZZLE_OUT: ("Out position",p_out,Spinner(p_out, min=-1000, max=10),),
|
||||||
|
CRYOJET_MOTION_ENABLED: ("Move Cryojet in Transitions",motion_enabled,Checkbox(motion_enabled, "move cryojet"),),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting cryojet reference positions {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
settings.setValue(k, v)
|
||||||
|
settings.sync()
|
||||||
|
|
||||||
|
def dlg_deltatau_parameters(self):
|
||||||
|
SPN=GenericDialog.Spinner
|
||||||
|
CB=GenericDialog.Checkbox
|
||||||
|
app=QApplication.instance()
|
||||||
|
cfg=app._cfg
|
||||||
|
#dt1 = cfg.value(AppCfg.DT_HOST,'SAR-CPPM-EXPMX1')
|
||||||
|
dt1 = cfg.value(AppCfg.DT_HOST,'localhost:10001:10002')
|
||||||
|
dt2 = cfg.value(AppCfg.DT_VEL_SCL, 1, type=float)
|
||||||
|
dt3 = cfg.option(AppCfg.DT_SHOW_PLOTS)
|
||||||
|
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="Delta Tau Parameters",
|
||||||
|
message="These parameters affect the data collection.",
|
||||||
|
inputs={
|
||||||
|
AppCfg.DT_HOST:("host name (host[:port:port_gather])", dt1, QLineEdit(),),
|
||||||
|
AppCfg.DT_VEL_SCL: ("Velocity Scale (1=optimal, 0=zero vel at target)", dt2,SPN(dt2, min=0, max=1, suffix=""),),
|
||||||
|
AppCfg.DT_SHOW_PLOTS: ("show plots after collection", dt3,CB(dt3, "active"),),
|
||||||
|
#DELTATAU_SORT_POINTS: ("Sort pointshoot/prelocated coords", b,CB(b, "sort points"),),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting delta tau parameters {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
cfg.setValue(k, v)
|
||||||
|
cfg.sync()
|
||||||
|
|
||||||
|
def dlg_tell_mount_positions(self):
|
||||||
|
AUTODRY_ENABLED = "tell/autodry_enabled"
|
||||||
|
AUTODRY_MAXMOUNTS = "tell/autodry_max_number_of_mounts"
|
||||||
|
AUTODRY_MAXTIME = "tell/autodry_max_time"
|
||||||
|
|
||||||
|
SECS_HOURS = 60 * 60
|
||||||
|
|
||||||
|
enabled = option(AUTODRY_ENABLED)
|
||||||
|
maxtime = settings.value(AUTODRY_MAXTIME, type=float) / SECS_HOURS
|
||||||
|
maxmounts = settings.value(AUTODRY_MAXMOUNTS, type=int)
|
||||||
|
|
||||||
|
d = GenericDialog.GenericDialog(
|
||||||
|
title="TELL Settings",
|
||||||
|
message="These control some features of the TELL sample changer",
|
||||||
|
inputs={
|
||||||
|
AUTODRY_ENABLED: ("Auto dry", enabled,
|
||||||
|
Checkbox(enabled, "enabled")),
|
||||||
|
AUTODRY_MAXMOUNTS: ("Max. num. mounts between dry",maxmounts,
|
||||||
|
Spinner(maxmounts, decimals=0, min=1, max=100, suffix=" mounts"),),
|
||||||
|
AUTODRY_MAXTIME: ("Max. time between dry",maxtime,
|
||||||
|
Spinner(maxtime, decimals=1, min=0.5, max=5, suffix=" hours"),),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if d.exec():
|
||||||
|
results = d.results
|
||||||
|
_log.info("setting tell parameters {}".format(results))
|
||||||
|
for k, v in results.items():
|
||||||
|
if k == AUTODRY_MAXTIME:
|
||||||
|
v = v * SECS_HOURS
|
||||||
|
settings.setValue(k, v)
|
||||||
|
settings.sync()
|
||||||
|
|
||||||
|
|||||||
13
deltatau.py
13
deltatau.py
@@ -17,9 +17,7 @@ class Deltatau:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
app=QApplication.instance()
|
app=QApplication.instance()
|
||||||
cfg=app._cfg
|
cfg=app._cfg
|
||||||
# cfg.setValue(AppCfg.DELTATAU_HOST, 'SAR-CPPM-EXPMX1')
|
host=cfg.value(AppCfg.DT_HOST)
|
||||||
cfg.setValue(AppCfg.DELTATAU_HOST, 'localhost:10001:10002')
|
|
||||||
host=cfg.value(AppCfg.DELTATAU_HOST)
|
|
||||||
|
|
||||||
hpp=host.split(':')
|
hpp=host.split(':')
|
||||||
param={'host':hpp[0]}
|
param={'host':hpp[0]}
|
||||||
@@ -28,7 +26,12 @@ class Deltatau:
|
|||||||
if len(hpp)>2:
|
if len(hpp)>2:
|
||||||
param['fast_gather_port']=int(hpp[2])
|
param['fast_gather_port']=int(hpp[2])
|
||||||
_log.info(' -> ssh-tunneling PPComm({host}:{port} {host}:{fast_gather_port})'.format(**param))
|
_log.info(' -> ssh-tunneling PPComm({host}:{port} {host}:{fast_gather_port})'.format(**param))
|
||||||
self._comm=comm=PPComm(**param)
|
|
||||||
self._gather=gather=Gather(comm)
|
try:
|
||||||
|
self._comm=comm=PPComm(**param)
|
||||||
|
self._gather=gather=Gather(comm)
|
||||||
|
except AttributeError as e:
|
||||||
|
_log.critical('can not connect to deltatau')
|
||||||
|
return
|
||||||
verbose=0xff
|
verbose=0xff
|
||||||
self._shapepath=sp=shapepath.ShapePath(comm, gather, verbose, sync_mode=1, sync_flag=3)
|
self._shapepath=sp=shapepath.ShapePath(comm, gather, verbose, sync_mode=1, sync_flag=3)
|
||||||
233
swissmx.py
233
swissmx.py
@@ -95,7 +95,6 @@ import pyqtUsrObj as UsrGO
|
|||||||
|
|
||||||
#from CustomROI import BeamMark, Grid, CrystalCircle #ZAC: orig. code
|
#from CustomROI import BeamMark, Grid, CrystalCircle #ZAC: orig. code
|
||||||
|
|
||||||
import GenericDialog
|
|
||||||
#from GenericDialog import GenericDialog #ZAC: orig. code
|
#from GenericDialog import GenericDialog #ZAC: orig. code
|
||||||
#from dialogs.PreferencesDialog import PreferencesDialog #ZAC: orig. code
|
#from dialogs.PreferencesDialog import PreferencesDialog #ZAC: orig. code
|
||||||
#from epics_widgets import zoom #ZAC: orig. code
|
#from epics_widgets import zoom #ZAC: orig. code
|
||||||
@@ -2267,7 +2266,7 @@ class Main(QMainWindow, Ui_MainWindow):
|
|||||||
dp.plot_gather(mode=11)
|
dp.plot_gather(mode=11)
|
||||||
|
|
||||||
#plt.show(block=False)
|
#plt.show(block=False)
|
||||||
plt.show(block=True)
|
#plt.show(block=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@@ -2931,9 +2930,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
|||||||
self.shortcut = QShortcut(QKeySequence(Qt.Key_F12), self)
|
self.shortcut = QShortcut(QKeySequence(Qt.Key_F12), self)
|
||||||
self.shortcut.activated.connect(self.show_window_configuration)
|
self.shortcut.activated.connect(self.show_window_configuration)
|
||||||
|
|
||||||
self.shortcut = QShortcut(QKeySequence(Qt.Key_F5), self)
|
|
||||||
self.shortcut.activated.connect(self.generic_dialog)
|
|
||||||
|
|
||||||
self.shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_B), self)
|
self.shortcut = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_B), self)
|
||||||
self.shortcut.activated.connect(lambda: self._beammark.toggle_handle())
|
self.shortcut.activated.connect(lambda: self._beammark.toggle_handle())
|
||||||
|
|
||||||
@@ -2941,47 +2937,47 @@ class Main(QMainWindow, Ui_MainWindow):
|
|||||||
self.shortcut.activated.connect(self.camera_pause_toggle)
|
self.shortcut.activated.connect(self.camera_pause_toggle)
|
||||||
|
|
||||||
# adding a menu entry to one of the menus
|
# adding a menu entry to one of the menus
|
||||||
action = QAction("Beam Marker Size", self)
|
action = QAction("geometry", self)
|
||||||
action.setToolTip("Update the beam marker size on GUI; *not* the actual beam size!")
|
action.setToolTip("Update optical center, beam marker size etc.")
|
||||||
action.setStatusTip("Update the beam marker size on GUI; *not* the actual beam size!")
|
action.setStatusTip("Update optical center, beam marker size etc.")
|
||||||
action.triggered.connect(self.set_beam_size_marker_dialog)
|
action.triggered.connect(lambda x: cfg.dlg_geometry(self))
|
||||||
self.menuAdvanced.addAction(action)
|
self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
action = QAction("Backlight Reference Positions", self)
|
action = QAction("Backlight Reference Positions", self)
|
||||||
action.setToolTip("Update the reference positions for the backlight")
|
action.setToolTip("Update the reference positions for the backlight")
|
||||||
action.setStatusTip("Update the reference positions for the backlight")
|
action.setStatusTip("Update the reference positions for the backlight")
|
||||||
action.triggered.connect(self.set_backlight_positions_dialog)
|
action.triggered.connect(cfg.dlg_backlight_positions)
|
||||||
self.menuAdvanced.addAction(action)
|
self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
action = QAction("Collimator Reference Positions", self)
|
action = QAction("Collimator Reference Positions", self)
|
||||||
action.setToolTip("Update the reference positions for the collimator")
|
action.setToolTip("Update the reference positions for the collimator")
|
||||||
action.setStatusTip("Update the reference positions for the collimator")
|
action.setStatusTip("Update the reference positions for the collimator")
|
||||||
action.triggered.connect(self.set_collimator_reference_positions)
|
action.triggered.connect(cfg.dlg_collimator_reference_positions)
|
||||||
self.menuAdvanced.addAction(action)
|
|
||||||
|
|
||||||
action = QAction("Cryojet Reference Positions", self)
|
|
||||||
action.setToolTip("Update the reference positions for the cryojet nozzle position")
|
|
||||||
action.setStatusTip("Update the reference positions for the cryojet nozzle position")
|
|
||||||
action.triggered.connect(self.set_cryojet_positions_dialog)
|
|
||||||
self.menuAdvanced.addAction(action)
|
self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
action = QAction("Post sample tube Reference Positions", self)
|
action = QAction("Post sample tube Reference Positions", self)
|
||||||
action.setToolTip("Update the reference positions for the post tube")
|
action.setToolTip("Update the reference positions for the post tube")
|
||||||
action.setStatusTip("Update the reference positions for the post tube")
|
action.setStatusTip("Update the reference positions for the post tube")
|
||||||
action.triggered.connect(self.set_posttube_references_dialog)
|
action.triggered.connect(cfg.dlg_posttube_references)
|
||||||
self.menuAdvanced.addAction(action)
|
self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
action = QAction("Delta Tau Parameters", self)
|
action = QAction("Delta Tau Parameters", self)
|
||||||
action.setToolTip("Parameters affecting the Delta Tau")
|
action.setToolTip("Parameters affecting the Delta Tau")
|
||||||
action.setStatusTip("Parameters affecting the Delta Tau")
|
action.setStatusTip("Parameters affecting the Delta Tau")
|
||||||
action.triggered.connect(self.set_deltatau_parameters)
|
action.triggered.connect(cfg.dlg_deltatau_parameters)
|
||||||
self.menuAdvanced.addAction(action)
|
self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
action = QAction("Tell Mount Positions", self)
|
#action = QAction("Cryojet Reference Positions", self)
|
||||||
action.setToolTip("Mount positions for TELL sample changer")
|
#action.setToolTip("Update the reference positions for the cryojet nozzle position")
|
||||||
action.setStatusTip("Parameters affecting the Delta Tau")
|
#action.setStatusTip("Update the reference positions for the cryojet nozzle position")
|
||||||
action.triggered.connect(self.set_tell_mount_positions)
|
#action.triggered.connect(self.set_cryojet_positions_dialog)
|
||||||
self.menuAdvanced.addAction(action)
|
#self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
|
#action = QAction("Tell Mount Positions", self)
|
||||||
|
#action.setToolTip("Mount positions for TELL sample changer")
|
||||||
|
#action.setStatusTip("Parameters affecting the Delta Tau")
|
||||||
|
#action.triggered.connect(cfg.dlg_tell_mount_positions)
|
||||||
|
#self.menuAdvanced.addAction(action)
|
||||||
|
|
||||||
def daq_method_prelocated_remove_markers(self):
|
def daq_method_prelocated_remove_markers(self):
|
||||||
try:
|
try:
|
||||||
@@ -3066,195 +3062,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
|||||||
fx_motor.move_motor_to_position(x)
|
fx_motor.move_motor_to_position(x)
|
||||||
fy_motor.move_motor_to_position(y)
|
fy_motor.move_motor_to_position(y)
|
||||||
|
|
||||||
def set_beam_size_marker_dialog(self):
|
|
||||||
SPN=GenericDialog.Spinner
|
|
||||||
app=QApplication.instance()
|
|
||||||
cfg=app._cfg
|
|
||||||
w, h = map(float,cfg.value(AppCfg.GEO_BEAM_SZ))
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="geometry",
|
|
||||||
message="Enter the size of the beam in microns",
|
|
||||||
inputs={
|
|
||||||
"bw": ("beam width um" ,w,SPN(w, min=1, max=200, suffix=" \u00B5m"),),
|
|
||||||
"bh": ("beam height um",h,SPN(h, min=1, max=200, suffix=" \u00B5m"),),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("Updating beamsize to {}".format(results))
|
|
||||||
bm_sz= (results["bw"], results["bh"])
|
|
||||||
_log.debug("types {}".format(type(w)))
|
|
||||||
cfg.setValue(AppCfg.GEO_BEAM_SZ, bm_sz)
|
|
||||||
bm=self._goBeamMarker
|
|
||||||
bm.setSize(bm_sz)
|
|
||||||
#self._beammark.set_beam_size((w, h))
|
|
||||||
cfg.sync()
|
|
||||||
|
|
||||||
def set_posttube_references_dialog(self):
|
|
||||||
SPN=GenericDialog.Spinner
|
|
||||||
app=QApplication.instance()
|
|
||||||
cfg=app._cfg
|
|
||||||
x_up = cfg.value(AppCfg.PST_X_UP , 0.0,type=float)
|
|
||||||
y_up = cfg.value(AppCfg.PST_Y_UP , 0.0,type=float)
|
|
||||||
x_down = cfg.value(AppCfg.PST_X_DOWN, 0.0,type=float)
|
|
||||||
y_down = cfg.value(AppCfg.PST_Y_DOWN, 0.0,type=float)
|
|
||||||
dx = cfg.value(AppCfg.PST_DX , 0.0,type=float)
|
|
||||||
dy = cfg.value(AppCfg.PST_DY , 0.0,type=float)
|
|
||||||
tz_in = cfg.value(AppCfg.PST_TZ_IN , 0.0,type=float)
|
|
||||||
tz_out = cfg.value(AppCfg.PST_TZ_OUT, 0.0,type=float)
|
|
||||||
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="Post Sample Tube Configuration",
|
|
||||||
message="Enter the relative displacements for X and Y to move the post sample tube either in or out.",
|
|
||||||
inputs={
|
|
||||||
AppCfg.PST_X_UP : ("Up X" , x_up , SPN(x_up , decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_Y_UP : ("Up Y" , y_up , SPN(y_up , decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_X_DOWN: ("Down X" , x_down, SPN(x_down, decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_Y_DOWN: ("Down Y" , y_down, SPN(y_down, decimals=3, min=-45.0, max=15.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_DX : ("out delta X" , dx , SPN(dx , decimals=3, min=-32.0, max=32.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_DY : ("out delta Y" , dy , SPN(dy , decimals=3, min=-32.0, max=32.0, suffix=" mm"), ),
|
|
||||||
AppCfg.PST_TZ_IN : ("tube Z in position" , tz_in , SPN(tz_in , decimals=3, min=-8.0 , max=1.0 , suffix=" mm"), ),
|
|
||||||
AppCfg.PST_TZ_OUT: ("tube Z OUT position", tz_out, SPN(tz_out, decimals=3, min=-8.0 , max=1.0 , suffix=" mm"), ),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting post-sample-tube displacements {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
cfg.setValue(k, v)
|
|
||||||
cfg.sync()
|
|
||||||
|
|
||||||
def set_collimator_reference_positions(self):
|
|
||||||
SPN=GenericDialog.Spinner
|
|
||||||
app=QApplication.instance()
|
|
||||||
cfg=app._cfg
|
|
||||||
x_out = cfg.value(AppCfg.COL_DX , 0.0,type=float)
|
|
||||||
y_out = cfg.value(AppCfg.COL_DY , 0.0,type=float)
|
|
||||||
x_in = cfg.value(AppCfg.COL_X_IN, 0.0,type=float)
|
|
||||||
y_in = cfg.value(AppCfg.COL_Y_IN, 0.0,type=float)
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="Collimator configuration",
|
|
||||||
message="Enter reference positions for the collimator",
|
|
||||||
inputs={
|
|
||||||
AppCfg.COL_DX: ("Collimator out deltaX", x_out, SPN(x_out, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
|
||||||
AppCfg.COL_DY: ("Collimator out deltaY", y_out, SPN(y_out, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
|
||||||
AppCfg.COL_X_IN: ("Collimator in X", x_in, SPN(x_in, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
|
||||||
AppCfg.COL_Y_IN: ("Collimator in Y", y_in, SPN(y_in, decimals=3, min=-15.9, max=15.9, suffix=" mm"),),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting collimator reference positions {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
cfg.setValue(k, v)
|
|
||||||
cfg.sync()
|
|
||||||
|
|
||||||
def set_backlight_positions_dialog(self):
|
|
||||||
SPN=GenericDialog.Spinner
|
|
||||||
app=QApplication.instance()
|
|
||||||
cfg=app._cfg
|
|
||||||
p_in = cfg.value(AppCfg.BKLGT_IN,0,type=int)
|
|
||||||
p_out = cfg.value(AppCfg.BKLGT_OUT,0,type=int)
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="Back Light configuration",
|
|
||||||
message="Enter reference positions for the backlight",
|
|
||||||
inputs={
|
|
||||||
AppCfg.BKLGT_IN: ("In position" , p_in , SPN(p_in, min=-30000, max=10), ),
|
|
||||||
AppCfg.BKLGT_OUT: ("Out position", p_out, SPN(p_out, min=-1000, max=10), ),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting back light reference positions {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
cfg.setValue(k, v)
|
|
||||||
cfg.sync()
|
|
||||||
|
|
||||||
def set_cryojet_positions_dialog(self):
|
|
||||||
p_in = settings.value(CRYOJET_NOZZLE_IN, type=float)
|
|
||||||
p_out = settings.value(CRYOJET_NOZZLE_OUT, type=float)
|
|
||||||
motion_enabled = option(CRYOJET_MOTION_ENABLED)
|
|
||||||
d = GenericDialog(
|
|
||||||
title="Cryojet Nozzle Configuration",
|
|
||||||
message="Enter reference positions for the cryojet nozzle position",
|
|
||||||
inputs={
|
|
||||||
CRYOJET_NOZZLE_IN: ("In position", p_in, Spinner(p_in, min=3, max=15)),
|
|
||||||
CRYOJET_NOZZLE_OUT: ("Out position",p_out,Spinner(p_out, min=-1000, max=10),),
|
|
||||||
CRYOJET_MOTION_ENABLED: ("Move Cryojet in Transitions",motion_enabled,Checkbox(motion_enabled, "move cryojet"),),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting cryojet reference positions {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
settings.setValue(k, v)
|
|
||||||
settings.sync()
|
|
||||||
|
|
||||||
def set_deltatau_parameters(self):
|
|
||||||
SPN=GenericDialog.Spinner
|
|
||||||
CB=GenericDialog.Checkbox
|
|
||||||
app=QApplication.instance()
|
|
||||||
cfg=app._cfg
|
|
||||||
#dt1 = cfg.value(AppCfg.DT_HOST,'SAR-CPPM-EXPMX1')
|
|
||||||
dt1 = cfg.value(AppCfg.DT_HOST,'localhost:10001:10002')
|
|
||||||
dt2 = cfg.value(AppCfg.DT_VEL_SCL, 1, type=float)
|
|
||||||
dt3 = cfg.option(AppCfg.DT_SHOW_PLOTS)
|
|
||||||
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="Delta Tau Parameters",
|
|
||||||
message="These parameters affect the data collection.",
|
|
||||||
inputs={
|
|
||||||
AppCfg.DT_HOST:("host name (host[:port:port_gather])", dt1, QLineEdit(),),
|
|
||||||
AppCfg.DT_VEL_SCL: ("Velocity Scale (1=optimal, 0=zero vel at target)", dt2,SPN(dt2, min=0, max=1, suffix=""),),
|
|
||||||
AppCfg.DT_SHOW_PLOTS: ("show plots after collection", dt3,CB(dt3, "active"),),
|
|
||||||
#DELTATAU_SORT_POINTS: ("Sort pointshoot/prelocated coords", b,CB(b, "sort points"),),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting delta tau parameters {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
cfg.setValue(k, v)
|
|
||||||
cfg.sync()
|
|
||||||
|
|
||||||
def set_tell_mount_positions(self):
|
|
||||||
AUTODRY_ENABLED = "tell/autodry_enabled"
|
|
||||||
AUTODRY_MAXMOUNTS = "tell/autodry_max_number_of_mounts"
|
|
||||||
AUTODRY_MAXTIME = "tell/autodry_max_time"
|
|
||||||
|
|
||||||
SECS_HOURS = 60 * 60
|
|
||||||
|
|
||||||
enabled = option(AUTODRY_ENABLED)
|
|
||||||
maxtime = settings.value(AUTODRY_MAXTIME, type=float) / SECS_HOURS
|
|
||||||
maxmounts = settings.value(AUTODRY_MAXMOUNTS, type=int)
|
|
||||||
|
|
||||||
d = GenericDialog.GenericDialog(
|
|
||||||
title="TELL Settings",
|
|
||||||
message="These control some features of the TELL sample changer",
|
|
||||||
inputs={
|
|
||||||
AUTODRY_ENABLED: ("Auto dry", enabled,
|
|
||||||
Checkbox(enabled, "enabled")),
|
|
||||||
AUTODRY_MAXMOUNTS: ("Max. num. mounts between dry",maxmounts,
|
|
||||||
Spinner(maxmounts, decimals=0, min=1, max=100, suffix=" mounts"),),
|
|
||||||
AUTODRY_MAXTIME: ("Max. time between dry",maxtime,
|
|
||||||
Spinner(maxtime, decimals=1, min=0.5, max=5, suffix=" hours"),),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
_log.info("setting tell parameters {}".format(results))
|
|
||||||
for k, v in results.items():
|
|
||||||
if k == AUTODRY_MAXTIME:
|
|
||||||
v = v * SECS_HOURS
|
|
||||||
settings.setValue(k, v)
|
|
||||||
settings.sync()
|
|
||||||
|
|
||||||
def generic_dialog(self, title="test", message=""):
|
|
||||||
d = GenericDialog(title="Beamsize", message="some message")
|
|
||||||
if d.exec():
|
|
||||||
results = d.results
|
|
||||||
print(results)
|
|
||||||
|
|
||||||
def toggle_maximized(self):
|
def toggle_maximized(self):
|
||||||
if self.isMaximized():
|
if self.isMaximized():
|
||||||
self.showNormal()
|
self.showNormal()
|
||||||
|
|||||||
Reference in New Issue
Block a user