Commit 593a3bda authored by Matias Guijarro's avatar Matias Guijarro
Browse files

linting

parent f13ce3dd
...@@ -489,7 +489,7 @@ class Motion: ...@@ -489,7 +489,7 @@ class Motion:
return f"Moving {self.axis.name} from {start_} to {end_}" return f"Moving {self.axis.name} from {start_} to {end_}"
class Trajectory(object): class Trajectory:
""" Trajectory information """ Trajectory information
Represents a specific trajectory motion. Represents a specific trajectory motion.
...@@ -677,20 +677,9 @@ class Axis: ...@@ -677,20 +677,9 @@ class Axis:
self.__config = StaticConfig(config) self.__config = StaticConfig(config)
self.__settings = AxisSettings(self) self.__settings = AxisSettings(self)
self.__init_config_properties() self.__init_config_properties()
self.__no_offset = False
self._group_move = GroupMove() self._group_move = GroupMove()
self._beacon_channels = dict()
self._move_stop_channel = Channel(
f"axis.{self.name}.move_stop",
default_value=False,
callback=self._external_stop,
)
self._jog_velocity_channel = Channel(
f"axis.{self.name}.change_jog_velocity",
default_value=None,
callback=self._set_jog_velocity,
)
self._lock = gevent.lock.Semaphore() self._lock = gevent.lock.Semaphore()
self.__no_offset = False
try: try:
config.parent config.parent
...@@ -709,6 +698,19 @@ class Axis: ...@@ -709,6 +698,19 @@ class Axis:
self._polling_time = config.get("polling_time", DEFAULT_POLLING_TIME) self._polling_time = config.get("polling_time", DEFAULT_POLLING_TIME)
global_map.register(self, parents_list=["axes", controller]) global_map.register(self, parents_list=["axes", controller])
# create Beacon channels
self.settings.init_channels()
self._move_stop_channel = Channel(
f"axis.{self.name}.move_stop",
default_value=False,
callback=self._external_stop,
)
self._jog_velocity_channel = Channel(
f"axis.{self.name}.change_jog_velocity",
default_value=None,
callback=self._set_jog_velocity,
)
def __close__(self): def __close__(self):
try: try:
controller_close = self.__controller.close controller_close = self.__controller.close
......
...@@ -270,7 +270,7 @@ class Bus(AdvancedInstantiationInterface): ...@@ -270,7 +270,7 @@ class Bus(AdvancedInstantiationInterface):
raise ConnectionError( raise ConnectionError(
"Connection to Beacon server lost. " "Connection to Beacon server lost. "
+ "This is a serious problem! " + "This is a serious problem! "
+ "Please quite the bliss session and try to restart it. (" + "Quit the bliss session and try to restart it. ("
+ str(e) + str(e)
+ ")" + ")"
) )
...@@ -482,7 +482,7 @@ class Channel(AdvancedInstantiationInterface): ...@@ -482,7 +482,7 @@ class Channel(AdvancedInstantiationInterface):
def _fire_callbacks(self): def _fire_callbacks(self):
value = self._raw_value.value value = self._raw_value.value
callbacks = [_f for _f in [ref() for ref in self._callback_refs] if _f] callbacks = filter(None, [ref() for ref in self._callback_refs])
# Run callbacks # Run callbacks
for cb in callbacks: for cb in callbacks:
...@@ -491,7 +491,7 @@ class Channel(AdvancedInstantiationInterface): ...@@ -491,7 +491,7 @@ class Channel(AdvancedInstantiationInterface):
self._firing_callbacks = True self._firing_callbacks = True
cb(value) cb(value)
# Catch and display exception # Catch and display exception
except: except Exception:
sys.excepthook(*sys.exc_info()) sys.excepthook(*sys.exc_info())
# Clean up the flag # Clean up the flag
finally: finally:
...@@ -603,9 +603,9 @@ class EventChannel(AdvancedInstantiationInterface): ...@@ -603,9 +603,9 @@ class EventChannel(AdvancedInstantiationInterface):
def _set_raw_value(self, raw_value): def _set_raw_value(self, raw_value):
value = raw_value.value value = raw_value.value
callbacks = [_f for _f in [ref() for ref in self._callback_refs] if _f] callbacks = filter(None, [ref() for ref in self._callback_refs])
for cb in callbacks: for cb in callbacks:
try: try:
cb(value) cb(value)
except: except Exception:
sys.excepthook(*sys.exc_info()) sys.excepthook(*sys.exc_info())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment