made add/remove callback method names consistent with their PV equivalent

This commit is contained in:
2020-07-29 13:57:49 +02:00
parent b20d1474b4
commit fa085478f5
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -123,11 +123,11 @@ class Motor(Adjustable):
print(f"{low} < {val} < {high}")
def add_value_callback(self, callback, index=None):
def add_callback(self, callback, index=None):
return self.pvs.readback.add_callback(callback=callback, index=index)
def clear_value_callback(self, index=None):
if index:
def remove_callback(self, index=None):
if index is not None:
self.pvs.readback.remove_callback(index)
else:
self.pvs.readback.clear_callbacks()
+2 -2
View File
@@ -15,14 +15,14 @@ def update_changes(Adj):
def cbfoo(**kwargs):
print(get_position_str(start, value, kwargs["value"]), end="\r")
cb_id = self.add_value_callback(cbfoo)
cb_id = self.add_callback(cbfoo)
self._currentChange = self.set_target_value(value)
self._currentChange.wait()
except KeyboardInterrupt:
self._currentChange.stop()
print(f"\nAborted change at (~) {self.get_current_value():1.5g}")
finally:
self.clear_value_callback(cb_id)
self.remove_callback(cb_id)
return self._currentChange
def update_change_relative(self, value, *args, **kwargs):