diff --git a/slic/core/adjustable/convenience.py b/slic/core/adjustable/convenience.py index f6a137de..26c35486 100644 --- a/slic/core/adjustable/convenience.py +++ b/slic/core/adjustable/convenience.py @@ -1,5 +1,3 @@ -import colorama - class SpecConvenience: @@ -44,20 +42,3 @@ class SpecConvenience: -class DefaultRepresentation: - - def _get_name(self): - if self.alias: - return self.alias.get_full_name() - elif self.name: - return self.name - else: - return self.Id - - def __repr__(self): - s = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')+': ' - s += f"{colorama.Style.BRIGHT}{self._get_name()}{colorama.Style.RESET_ALL} at {colorama.Style.BRIGHT}{self.get_current_value():g}{colorama.Style.RESET_ALL}" - return s - - - diff --git a/slic/devices/general/adjustable.py b/slic/devices/general/adjustable.py index 1d76f749..807fee19 100644 --- a/slic/devices/general/adjustable.py +++ b/slic/devices/general/adjustable.py @@ -5,7 +5,7 @@ from enum import IntEnum, auto import colorama import time import datetime -from .convenience import SpecConvenience, DefaultRepresentation +from .convenience import SpecConvenience class PvRecord: @@ -139,7 +139,7 @@ class PvEnum(SpecConvenience): -class AdjustableVirtual(SpecConvenience, DefaultRepresentation): +class AdjustableVirtual(SpecConvenience): def __init__( self, @@ -204,4 +204,20 @@ class AdjustableVirtual(SpecConvenience, DefaultRepresentation): adj.set_current_value(val) + #TODO: below from DefaultRepresentation + + def _get_name(self): + if self.alias: + return self.alias.get_full_name() + elif self.name: + return self.name + else: + return self.Id + + def __repr__(self): + s = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')+': ' + s += f"{colorama.Style.BRIGHT}{self._get_name()}{colorama.Style.RESET_ALL} at {colorama.Style.BRIGHT}{self.get_current_value():g}{colorama.Style.RESET_ALL}" + return s + +