예제 #1
0
파일: Motor.py 프로젝트: cmft/sardana
    def init_device(self):
        PoolElementDevice.init_device(self)
        motor = self.motor
        if motor is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.motor = motor = \
                self.pool.create_element(type="Motor", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
            if self.instrument is not None:
                motor.set_instrument(self.instrument)
            # if in constructor, for all memorized no init attributes (position)
            # let poolmotor know their write values
            if self.in_constructor:
                try:
                    w_pos, w_ts = self.get_write_dial_position_from_db()
                    self.in_write_position = True
                    try:
                        motor.set_write_position(w_pos, timestamp=w_ts)
                    finally:
                        self.in_write_position = False
                except KeyError:
                    pass

        if self.Sleep_bef_last_read > 0:
            motor.set_instability_time(self.Sleep_bef_last_read / 1000.0)
        motor.add_listener(self.on_motor_changed)
        self.set_state(DevState.ON)
예제 #2
0
    def init_device(self):
        PoolElementDevice.init_device(self)
        motor = self.motor
        if motor is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.motor = motor = \
                self.pool.create_element(type="Motor", name=name,
                                         full_name=full_name, id=self.Id, axis=self.Axis,
                                         ctrl_id=self.Ctrl_id)
            if self.instrument is not None:
                motor.set_instrument(self.instrument)
            # if in constructor, for all memorized no init attributes (position)
            # let poolmotor know their write values
            if self.in_constructor:
                try:
                    w_pos, w_ts = self.get_write_dial_position_from_db()
                    self.in_write_position = True
                    try:
                        motor.set_write_position(w_pos, timestamp=w_ts)
                    finally:
                        self.in_write_position = False
                except KeyError:
                    pass

        if self.Sleep_bef_last_read > 0:
            motor.set_instability_time(self.Sleep_bef_last_read / 1000.0)
        motor.add_listener(self.on_motor_changed)
        self.set_state(DevState.ON)
예제 #3
0
    def init_device(self):
        PoolElementDevice.init_device(self)

        tg = self.tg
        if tg is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.tg = tg = \
                self.pool.create_element(type="TriggerGate",
                                         name=name, full_name=full_name, id=self.Id, axis=self.Axis,
                                         ctrl_id=self.Ctrl_id)

        tg.add_listener(self.on_tg_changed)
        self.set_state(DevState.ON)
예제 #4
0
    def init_device(self):
        PoolElementDevice.init_device(self)
        zerod = self.zerod
        if zerod is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.zerod = zerod = \
                self.pool.create_element(type="ZeroDExpChannel", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
        zerod.add_listener(self.on_zerod_changed)

        ## force a state read to initialize the state attribute
        #state = zerod.state
        self.set_state(DevState.ON)
예제 #5
0
    def init_device(self):
        PoolElementDevice.init_device(self)
        zerod = self.zerod
        if zerod is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.zerod = zerod = \
                self.pool.create_element(type="ZeroDExpChannel", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
        zerod.add_listener(self.on_zerod_changed)

        ## force a state read to initialize the state attribute
        #state = zerod.state
        self.set_state(DevState.ON)
예제 #6
0
    def init_device(self):
        PoolElementDevice.init_device(self)
        twod = self.twod
        if twod is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.twod = twod = \
                self.pool.create_element(type="TwoDExpChannel",
                    name=name, full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
            if self.instrument is not None:
                twod.set_instrument(self.instrument)
        twod.add_listener(self.on_twod_changed)

        ## force a state read to initialize the state attribute
        #state = ct.state
        self.set_state(DevState.ON)
예제 #7
0
    def init_device(self):
        PoolElementDevice.init_device(self)

        self.Elements = map(int, self.Elements)
        pseudo_counter = self.pseudo_counter
        if pseudo_counter is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.pseudo_counter = pseudo_counter = \
                self.pool.create_element(type="PseudoCounter", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id, user_elements=self.Elements)
            if self.instrument is not None:
                pseudo_counter.set_instrument(self.instrument)
        pseudo_counter.add_listener(self.on_pseudo_counter_changed)

        self.set_state(DevState.ON)
예제 #8
0
    def init_device(self):
        PoolElementDevice.init_device(self)

        self.Elements = map(int, self.Elements)
        pseudo_counter = self.pseudo_counter
        if pseudo_counter is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.pseudo_counter = pseudo_counter = \
                self.pool.create_element(type="PseudoCounter", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id, user_elements=self.Elements)
            if self.instrument is not None:
                pseudo_counter.set_instrument(self.instrument)
        pseudo_counter.add_listener(self.on_pseudo_counter_changed)

        self.set_state(DevState.ON)
예제 #9
0
    def init_device(self):
        PoolElementDevice.init_device(self)
        oned = self.oned
        if oned is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.oned = oned = \
                self.pool.create_element(type="OneDExpChannel",
                    name=name, full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
            if self.instrument is not None:
                oned.set_instrument(self.instrument)
        oned.add_listener(self.on_oned_changed)

        ## force a state read to initialize the state attribute
        #state = ct.state
        self.set_state(DevState.ON)
예제 #10
0
 def get_attributes_to_restore(self):
     """Make sure position is the last attribute to restore"""
     restore_attributes = PoolElementDevice.get_attributes_to_restore(self)
     try:
         restore_attributes.remove('Position')
         restore_attributes.append('Position')
     except ValueError:
         pass
     return restore_attributes
예제 #11
0
    def init_device(self):
        PoolElementDevice.init_device(self)

        ior = self.ior
        if ior is None:
            full_name = self.get_full_name()
            name = self.alias or full_name
            self.ior = ior = \
                self.pool.create_element(type="IORegister", name=name,
                    full_name=full_name, id=self.Id, axis=self.Axis,
                    ctrl_id=self.Ctrl_id)
            if self.instrument is not None:
                ior.set_instrument(self.instrument)
        ior.add_listener(self.on_ior_changed)

        ## force a state read to initialize the state attribute
        #state = ior.get_state(cache=False)
        self.set_state(DevState.ON)
예제 #12
0
파일: Motor.py 프로젝트: cmft/sardana
 def get_attributes_to_restore(self):
     """Make sure position is the last attribute to restore"""
     restore_attributes = PoolElementDevice.get_attributes_to_restore(self)
     try:
         restore_attributes.remove('Position')
         restore_attributes.append('Position')
     except ValueError:
         pass
     return restore_attributes
예제 #13
0
    def initialize_dynamic_attributes(self):
        attrs = PoolElementDevice.initialize_dynamic_attributes(self)

        detect_evts = "value",
        non_detect_evts = ()

        for attr_name in detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, True)
        for attr_name in non_detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, False)
예제 #14
0
    def initialize_dynamic_attributes(self):
        attrs = PoolElementDevice.initialize_dynamic_attributes(self)

        detect_evts = "value",
        non_detect_evts = ()

        for attr_name in detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, True)
        for attr_name in non_detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, False)
예제 #15
0
파일: Motor.py 프로젝트: cmft/sardana
    def initialize_dynamic_attributes(self):
        attrs = PoolElementDevice.initialize_dynamic_attributes(self)

        detect_evts = "position", "dialposition",
        non_detect_evts = "limit_switches", "step_per_unit", "offset", \
            "sign", "velocity", "acceleration", "deceleration", "base_rate", \
            "backlash"

        for attr_name in detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, True)
        for attr_name in non_detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, False)
예제 #16
0
    def initialize_dynamic_attributes(self):
        attrs = PoolElementDevice.initialize_dynamic_attributes(self)

        detect_evts = "position", "dialposition",
        non_detect_evts = "limit_switches", "step_per_unit", "offset", \
            "sign", "velocity", "acceleration", "deceleration", "base_rate", \
            "backlash"

        for attr_name in detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, True)
        for attr_name in non_detect_evts:
            if attr_name in attrs:
                self.set_change_event(attr_name, True, False)
예제 #17
0
파일: Motor.py 프로젝트: cmft/sardana
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For position attribute, listen to what the controller says for data
            # type (between long and float)
            pos = std_attrs.get('position')
            if pos is not None:
                _, data_info, attr_info = pos
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype
        return std_attrs, dyn_attrs
예제 #18
0
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For value attribute, listen to what the controller says for data
            # type (between long and float)
            value = std_attrs.get('value')
            if value is not None:
                _, data_info, attr_info = value
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype
        return std_attrs, dyn_attrs
예제 #19
0
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For value attribute, listen to what the controller says for data
            # type (between long, float or bool)
            value = std_attrs.get('value')
            if value is not None:
                _, data_info, attr_info = value
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype
        return std_attrs, dyn_attrs
예제 #20
0
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For value attribute, listen to what the controller says for data
            # type (between long and float) and length
            value = std_attrs.get('value')
            if value is not None:
                _, data_info, attr_info = value
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype
                shape = attr_info.maxdimsize
                data_info[0][3] = shape[0]
                data_info[0][4] = shape[1]
        return std_attrs, dyn_attrs
예제 #21
0
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For value attribute, listen to what the controller says for data
            # type (between long and float)
            value = std_attrs.get('value')
            if value is not None:
                attr_name, data_info, attr_info = value
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype

                # Add manually a 'CurrentValue' with the same time as 'Value'
                attr_name = 'CurrentValue'
                attr_info = attr_info.copy()
                attr_info.description = attr_name
                std_attrs[attr_name] = [attr_name, data_info, attr_info]

        return std_attrs, dyn_attrs
예제 #22
0
    def get_dynamic_attributes(self):
        cache_built = hasattr(self, "_dynamic_attributes_cache")

        std_attrs, dyn_attrs = \
            PoolElementDevice.get_dynamic_attributes(self)

        if not cache_built:
            # For value attribute, listen to what the controller says for data
            # type (between long and float)
            value = std_attrs.get('value')
            if value is not None:
                attr_name, data_info, attr_info = value
                ttype, _ = to_tango_type_format(attr_info.dtype)
                data_info[0][0] = ttype

                # Add manually a 'CurrentValue' with the same time as 'Value'
                attr_name = 'CurrentValue'
                attr_info = attr_info.copy()
                attr_info.description = attr_name
                std_attrs[attr_name] = [attr_name, data_info, attr_info]

        return std_attrs, dyn_attrs
예제 #23
0
 def __init__(self, dclass, name):
     self.in_write_position = False
     PoolElementDevice.__init__(self, dclass, name)
예제 #24
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     zerod = self.zerod
     if zerod is not None:
         zerod.remove_listener(self.on_zerod_changed)
예제 #25
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     oned = self.oned
     if oned is not None:
         oned.remove_listener(self.on_oned_changed)
예제 #26
0
 def __init__(self, dclass, name):
     PoolElementDevice.__init__(self, dclass, name)
예제 #27
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     ct = self.ct
     if ct is not None:
         ct.remove_listener(self.on_ct_changed)
예제 #28
0
 def _is_allowed(self, req_type):
     return PoolElementDevice._is_allowed(self, req_type)
예제 #29
0
 def __init__(self, dclass, name):
     PoolElementDevice.__init__(self, dclass, name)
예제 #30
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     pseudo_motor = self.pseudo_motor
     if pseudo_motor is not None:
         pseudo_motor.remove_listener(self.on_pseudo_motor_changed)
예제 #31
0
 def __init__(self, dclass, name):
     self.in_write_value = False
     PoolElementDevice.__init__(self, dclass, name)
예제 #32
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     ior = self.ior
     if ior is not None:
         ior.remove_listener(self.on_ior_changed)
예제 #33
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     oned = self.oned
     if oned is not None:
         oned.remove_listener(self.on_oned_changed)
예제 #34
0
 def __init__(self, dclass, name):
     """Constructor"""
     self.in_write_position = False
     PoolElementDevice.__init__(self, dclass, name)
예제 #35
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     twod = self.twod
     if twod is not None:
         twod.remove_listener(self.on_twod_changed)
예제 #36
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     tg = self.tg
     if tg is not None:
         tg.remove_listener(self.on_tg_changed)
예제 #37
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     zerod = self.zerod
     if zerod is not None:
         zerod.remove_listener(self.on_zerod_changed)
예제 #38
0
 def init(self, name):
     PoolElementDevice.init(self, name)
예제 #39
0
 def __init__(self, dclass, name):
     self.in_write_position = False
     PoolElementDevice.__init__(self, dclass, name)
예제 #40
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     pseudo_counter = self.pseudo_counter
     if pseudo_counter is not None:
         pseudo_counter.remove_listener(self.on_pseudo_counter_changed)
예제 #41
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     twod = self.twod
     if twod is not None:
         twod.remove_listener(self.on_twod_changed)
예제 #42
0
파일: Motor.py 프로젝트: cmft/sardana
 def __init__(self, dclass, name):
     """Constructor"""
     self.in_write_position = False
     PoolElementDevice.__init__(self, dclass, name)
예제 #43
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     motor = self.motor
     if motor is not None:
         motor.remove_listener(self.on_motor_changed)
예제 #44
0
 def init(self, name):
     PoolElementDevice.init(self, name)
예제 #45
0
파일: Motor.py 프로젝트: cmft/sardana
 def _is_allowed(self, req_type):
     return PoolElementDevice._is_allowed(self, req_type)
예제 #46
0
파일: Motor.py 프로젝트: cmft/sardana
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     motor = self.motor
     if motor is not None:
         motor.remove_listener(self.on_motor_changed)
예제 #47
0
 def delete_device(self):
     PoolElementDevice.delete_device(self)
     ct = self.ct
     if ct is not None:
         ct.remove_listener(self.on_ct_changed)