+3
-15
@@ -2,26 +2,15 @@ from contextlib import contextmanager
|
||||
import epics
|
||||
from slic.utils import typename
|
||||
from slic.utils.rangebar import RangeBar
|
||||
import time
|
||||
|
||||
|
||||
|
||||
class PV(epics.PV):
|
||||
|
||||
def __init__(self, pvname, *args, connection_timeout=2.0, **kwargs):
|
||||
super().__init__(pvname, *args, **kwargs)
|
||||
if not self.wait_for_connection(timeout=connection_timeout):
|
||||
raise TimeoutError(f"PV {pvname} not connected in {connection_timeout}s")
|
||||
|
||||
|
||||
def put(self, value, *args, show_progress=False, **kwargs):
|
||||
|
||||
if not show_progress:
|
||||
# Simple put with verification
|
||||
result = super().put(value, *args, **kwargs)
|
||||
return result
|
||||
return super().put(value, *args, **kwargs)
|
||||
|
||||
kwargs["wait"] = True
|
||||
kwargs["wait"] = True # enforce wait to show progress
|
||||
|
||||
start = self.get()
|
||||
stop = value
|
||||
@@ -31,8 +20,7 @@ class PV(epics.PV):
|
||||
rbar.show(value)
|
||||
|
||||
with self.use_callback(on_change):
|
||||
result = super().put(stop, *args, **kwargs)
|
||||
return result
|
||||
return super().put(stop, *args, **kwargs)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
||||
Reference in New Issue
Block a user