wip
This commit is contained in:
33
zoom.py
33
zoom.py
@@ -68,7 +68,9 @@ class Zoom(QGroupBox, Ui_Zoom):
|
||||
# pv.callbacks ... = self.zoom_update_cb
|
||||
# check also: pv.clear_auto_monitor() # disconnect PV monitor callback -> program exit faster.
|
||||
buttons=((1, "1"), (200, "200"), (400, "400"), (600, "600"), (800, "800"), (1000, "1000"),)
|
||||
current_zoom_value = self.get_zoom()
|
||||
|
||||
zoom=QApplication.instance()._zoom
|
||||
current_zoom_value = zoom.get_rb()
|
||||
|
||||
# zoom widgets
|
||||
layout = QVBoxLayout()
|
||||
@@ -269,11 +271,11 @@ class Zoom(QGroupBox, Ui_Zoom):
|
||||
self._zoom_spinner.blockSignals(False)
|
||||
self.zoomChanged.emit(float(value))
|
||||
|
||||
def get_zoom(self) -> int:
|
||||
zoom=QApplication.instance()._zoom
|
||||
pos = zoom.get()
|
||||
_log.debug("get_zoom(epics) => {}".format(pos))
|
||||
return pos
|
||||
# def get_zoom(self) -> int:
|
||||
# zoom=QApplication.instance()._zoom
|
||||
# pos = zoom.get()
|
||||
# _log.debug("get_zoom(epics) => {}".format(pos))
|
||||
# return pos
|
||||
|
||||
# def zoom_update_cb(self, pvname, value, char_value, **kwargs):
|
||||
# self._zoom_spinner.blockSignals(True)
|
||||
@@ -304,24 +306,33 @@ class QopticZoom(object):
|
||||
self._pv[name]=pv
|
||||
return pv
|
||||
|
||||
def get(self) -> int:
|
||||
def get_rb(self) -> int:
|
||||
# get_rb somtimes lags. therefore get_sp will get the last set_point without usage of pvs
|
||||
try:
|
||||
pv = self.getPv('POS_RB')
|
||||
pv = self.getPv('POS_RB') #default do not get the RBV, because this might be delayed
|
||||
except AttributeError:
|
||||
val=self._val; _log.debug('simulated mode:{}'.format(val))
|
||||
return val
|
||||
else:
|
||||
pv=self.getPv('POS_RB')
|
||||
return pv.get()
|
||||
return pv.get()
|
||||
|
||||
def get_sp(self) -> int:
|
||||
try:
|
||||
val=self._val
|
||||
except AttributeError:
|
||||
pv=self.getPv('POS_RB') # default do not get the RBV, because this might be delayed
|
||||
self._val=val=pv.get()
|
||||
return val
|
||||
|
||||
|
||||
def set(self, val: int):
|
||||
try:
|
||||
pv=self.getPv('POS_SP')
|
||||
except AttributeError:
|
||||
_log.debug('simulated mode:{}'.format(val))
|
||||
self._val=val #simulated mode
|
||||
else:
|
||||
pv.put(val)
|
||||
self._val=val
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user