Beispiel #1
0
    def __init__(self):
        self.active_session: Optional[Session] = None
        self.sessions: Set[Session] = set()

        self._services_by_name = initialize("gaphor.appservices", application=self)

        transaction.subscribers.add(self._transaction_proxy)
Beispiel #2
0
    def __init__(self):
        self._active_session: Optional[Session] = None
        self.sessions: Set[Session] = set()

        self._services_by_name = initialize("gaphor.appservices",
                                            application=self)

        self.event_manager: EventManager = cast(
            EventManager, self._services_by_name["event_manager"])

        transaction.subscribers.add(self._transaction_proxy)
Beispiel #3
0
    def __init__(self, event_manager, properties={}):
        """Create a new Model Provider. It will provide all models defined as
        entrypoints under `[gaphor.modelinglanguages]`.

        The `properties` argument is optional, in which case the service
        will default to UML.
        """
        self.event_manager = event_manager
        self.properties = properties

        self._modeling_languages: Dict[str, ModelingLanguage] = initialize(
            "gaphor.modelinglanguages")
Beispiel #4
0
    def __init__(self, services=None):
        """Initialize the application."""
        services_by_name: Dict[str,
                               Service] = initialize("gaphor.services",
                                                     services)

        self.event_manager: EventManager = cast(
            EventManager, services_by_name["event_manager"])
        self.component_registry: ComponentRegistry = cast(
            ComponentRegistry, services_by_name["component_registry"])

        for name, srv in services_by_name.items():
            logger.info(f"Initializing service {name}")
            self.component_registry.register(name, srv)
            self.event_manager.handle(ServiceInitializedEvent(name, srv))