How to use the sardana.sardanaevent.EventType function in sardana

To help you get started, we’ve selected a few sardana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taurus-org / taurus / src / sardana / pool / pool.py View on Github external
old_names = set([ ctrl.name for ctrl in old_lib.get_controllers() ])
            changed_names = set.intersection(new_names, old_names)
            deleted_names = old_names.difference(new_names)
            new_names = new_names.difference(old_names)

            for new_name in new_names:
                new_elements.append(new_lib.get_controller(new_name))
            for changed_name in changed_names:
                changed_elements.append(new_lib.get_controller(changed_name))
            for deleted_name in deleted_names:
                deleted_elements.append(old_lib.get_controller(deleted_name))

        evt = { "new" : new_elements, "change" : changed_elements,
                "del" : deleted_elements }

        self.fire_event(EventType("ElementsChanged"), evt)

        if old_lib is not None:
            for pool_ctrl in init_pool_ctrls:
                pool_ctrl.re_init()
github sardana-org / sardana / src / sardana / pool / poolmotor.py View on Github external
def _set_step_per_unit(self, step_per_unit, propagate=1):
        self._step_per_unit = step_per_unit
        if propagate:
            self.fire_event(EventType("step_per_unit",
                                      priority=propagate), step_per_unit)
            # force ask controller for new position to send priority event
            self.get_position(cache=False, propagate=2)
github sardana-org / sardana / src / sardana / pool / poolmeasurementgroup.py View on Github external
def set_moveable(self, moveable, propagate=1, to_fqdn=True):
        self._moveable = moveable
        if self._moveable is not None:
            if to_fqdn:
                moveable = _to_fqdn(moveable, logger=self)
            self._moveable_obj = self.pool.get_element_by_full_name(moveable)
        self.fire_event(EventType("moveable", priority=propagate),
                        moveable)
github sardana-org / sardana / src / sardana / macroserver / macroserver.py View on Github external
new_names = set([macro.name for macro in new_lib.get_macros()])
            old_names = set([macro.name for macro in old_lib.get_macros()])
            changed_names = set.intersection(new_names, old_names)
            deleted_names = old_names.difference(new_names)
            new_names = new_names.difference(old_names)

            for new_name in new_names:
                new_elements.append(new_lib.get_macro(new_name))
            for changed_name in changed_names:
                changed_elements.append(new_lib.get_macro(changed_name))
            for deleted_name in deleted_names:
                deleted_elements.append(old_lib.get_macro(deleted_name))

        evt = {"new": new_elements, "change": changed_elements,
               "del": deleted_elements}
        self.fire_event(EventType("ElementsChanged"), evt)
        return new_lib
github sardana-org / sardana / src / sardana / pool / poolelement.py View on Github external
def _set_instrument(self, instrument, propagate=1):
        if self._instrument is not None:
            self._instrument().remove_element(self)
        new_instrument_name = ""
        if instrument is None:
            self._instrument = None
        else:
            self._instrument = weakref.ref(instrument)
            new_instrument_name = instrument.full_name
            instrument.add_element(self)
        if not propagate:
            return
        self.fire_event(EventType("instrument", priority=propagate),
                        new_instrument_name)
github sardana-org / sardana / src / sardana / pool / poolbaseelement.py View on Github external
def _set_state(self, state, propagate=1):
        self._state = state
        if not propagate:
            return
        if state == self._state_event:
            # current state is equal to last state_event. Skip event
            return
        self._state_event = state
        self.fire_event(EventType("state", priority=propagate), state)
github sardana-org / sardana / src / sardana / pool / poolmeasurementgroup.py View on Github external
def set_nb_starts(self, nb_starts, propagate=1):
        self._nb_starts = nb_starts
        if not propagate:
            return
        self.fire_event(EventType("nb_starts", priority=propagate),
                        nb_starts)
github sardana-org / sardana / src / sardana / pool / poolbasechannel.py View on Github external
def _set_value_ref_enabled(self, value_ref_enabled, propagate=1):
        self._value_ref_enabled = value_ref_enabled
        if not propagate:
            return
        self.fire_event(
            EventType("value_ref_enabled", priority=propagate),
            value_ref_enabled)
github sardana-org / sardana / src / sardana / pool / poolmotor.py View on Github external
def _set_base_rate(self, base_rate, propagate=1):
        self._base_rate = base_rate
        if not propagate:
            return
        self.fire_event(EventType("base_rate", priority=propagate), base_rate)