From 3c5f90e0e3df8a0c7b730b8a35140690b8f14f82 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:28:24 +0200 Subject: [PATCH] refefactor: motor_by_string removed, motor names passed directly to dev[motor_name] --- .../examples/motor_movement/motor_example.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bec_widgets/examples/motor_movement/motor_example.py b/bec_widgets/examples/motor_movement/motor_example.py index b700ef14..dfebf571 100644 --- a/bec_widgets/examples/motor_movement/motor_example.py +++ b/bec_widgets/examples/motor_movement/motor_example.py @@ -461,16 +461,11 @@ class MotorControl(QThread): self.action = None self._initialize_motor() - def motor_by_string(self, motor_x_name: str, motor_y_name: str) -> tuple: - motor_x_index = self.all_motors_names.index(motor_x_name) - motor_y_index = self.all_motors_names.index(motor_y_name) - - motor_x = self.all_motors[motor_x_index] - motor_y = self.all_motors[motor_y_index] - return motor_x, motor_y - def connect_motors(self, motor_x_name: str, motor_y_name: str) -> None: - self.motor_x, self.motor_y = self.motor_by_string(motor_x_name, motor_y_name) + self.motor_x, self.motor_y = ( + dev[motor_x_name], + dev[motor_y_name], + ) # self.motor_by_string(motor_x_name, motor_y_name) (self.current_x, self.current_y) = self.get_coordinates()