How to use the gaphas.state function in gaphas

To help you get started, we’ve selected a few gaphas 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 gaphor / gaphor / gaphor / services / undomanager.py View on Github external
def _register_undo_handlers(self):

        logger.debug("Registering undo handlers")

        self.event_manager.subscribe(self.undo_create_event)
        self.event_manager.subscribe(self.undo_delete_event)
        self.event_manager.subscribe(self.undo_attribute_change_event)
        self.event_manager.subscribe(self.undo_association_set_event)
        self.event_manager.subscribe(self.undo_association_add_event)
        self.event_manager.subscribe(self.undo_association_delete_event)

        #
        # Direct revert-statements from gaphas to the undomanager
        state.observers.add(state.revert_handler)

        state.subscribers.add(self._gaphas_undo_handler)
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
def _register_undo_handlers(self):

        logger.debug("Registering undo handlers")

        self.event_manager.subscribe(self.undo_create_event)
        self.event_manager.subscribe(self.undo_delete_event)
        self.event_manager.subscribe(self.undo_attribute_change_event)
        self.event_manager.subscribe(self.undo_association_set_event)
        self.event_manager.subscribe(self.undo_association_add_event)
        self.event_manager.subscribe(self.undo_association_delete_event)

        #
        # Direct revert-statements from gaphas to the undomanager
        state.observers.add(state.revert_handler)

        state.subscribers.add(self._gaphas_undo_handler)
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
def _unregister_undo_handlers(self):

        self.logger.debug('Unregistering undo handlers')

        self.component_registry.unregister_handler(self.undo_create_event)
        self.component_registry.unregister_handler(self.undo_delete_event)
        self.component_registry.unregister_handler(self.undo_attribute_change_event)
        self.component_registry.unregister_handler(self.undo_association_set_event)
        self.component_registry.unregister_handler(self.undo_association_add_event)
        self.component_registry.unregister_handler(self.undo_association_delete_event)

        state.observers.discard(state.revert_handler)

        state.subscribers.discard(self._gaphas_undo_handler)
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
        self.add_undo_action(lambda: state.saveapply(*event));
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
        self.add_undo_action(lambda: state.saveapply(*event))
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
def _unregister_undo_handlers(self):

        self.logger.debug('Unregistering undo handlers')

        self.component_registry.unregister_handler(self.undo_create_event)
        self.component_registry.unregister_handler(self.undo_delete_event)
        self.component_registry.unregister_handler(self.undo_attribute_change_event)
        self.component_registry.unregister_handler(self.undo_association_set_event)
        self.component_registry.unregister_handler(self.undo_association_add_event)
        self.component_registry.unregister_handler(self.undo_association_delete_event)

        state.observers.discard(state.revert_handler)

        state.subscribers.discard(self._gaphas_undo_handler)
github gaphor / gaphor / gaphor / services / undomanager.py View on Github external
def _register_undo_handlers(self):

        self.logger.debug('Registering undo handlers')

        self.component_registry.register_handler(self.undo_create_event)
        self.component_registry.register_handler(self.undo_delete_event)
        self.component_registry.register_handler(self.undo_attribute_change_event)
        self.component_registry.register_handler(self.undo_association_set_event)
        self.component_registry.register_handler(self.undo_association_add_event)
        self.component_registry.register_handler(self.undo_association_delete_event)

        #
        # Direct revert-statements from gaphas to the undomanager
        state.observers.add(state.revert_handler)

        state.subscribers.add(self._gaphas_undo_handler)