示例#1
0
    def start(self):
        """Collect all extensions and generate resolver for each backend."""
        self._plots = ExtensionsCollector(
            workbench=self.workbench,
            point="oculy.plotting.plots",
            ext_class=Plot,
            validate_ext=make_extension_validator(base_cls=Plot,
                                                  fn_names=("get_cls", )),
        )
        self._plots.start()

        self._backends = ExtensionsCollector(
            workbench=self.workbench,
            point="oculy.plotting.rendering-backends",
            ext_class=Backend,
            validate_ext=make_extension_validator(
                base_cls=Backend,
                attributes=("priority", ),
                fn_names=("proxies", "plot_proxies", "colormaps"),
            ),
        )

        self._backends.start()

        self._populate_resolvers()
        self._backends.observe("contributions", self._populate_resolvers)
示例#2
0
    def start(self) -> None:
        """Start the plugin life-cycle.

        This method is called by the framework at the appropriate time. It
        should never be called by user code.

        """
        core = self.workbench.get_plugin("enaml.workbench.core")
        core.invoke_command("glaze.errors.enter_error_gathering")

        validator = make_extension_validator(Mask, (), ("func",))
        self._masks = ExtensionsCollector(
            workbench=self.workbench,
            point=MASKING_POINT,
            ext_class=Mask,
            validate_ext=validator,
        )
        self._masks.observe("contributions", self._update_masks)

        self._masks.start()

        validator = make_extension_validator(Node, (), ("func",))
        self.nodes = ExtensionsCollector(
            workbench=self.workbench,
            point=NODES_POINT,
            ext_class=Node,
            validate_ext=validator,
        )

        self.nodes.start()

        core.invoke_command("glaze.errors.exit_error_gathering")
示例#3
0
    def start(self) -> None:
        """Start the plugin lifecycle and collect themes and extensions."""
        super(IconManagerPlugin, self).start()

        checker = make_extension_validator(IconTheme, (), ())
        self._icon_themes = ExtensionsCollector(
            workbench=self.workbench,
            point=ICON_THEME_POINT,
            ext_class=IconTheme,
            validate_ext=checker,
        )
        self._icon_themes.start()
        self._list_icon_themes({})

        if self.current_theme not in self.icon_themes:
            self.current_theme = self.icon_themes[0]

        if self.fallback_theme not in self.icon_themes:
            self.fallback_theme = "glaze.FontAwesome"

        checker = make_extension_validator(IconThemeExtension, (), ("theme", ))
        self._icon_theme_extensions = ExtensionsCollector(
            workbench=self.workbench,
            point=ICON_THEME_EXTENSION_POINT,
            ext_class=IconThemeExtension,
            validate_ext=checker,
        )
        self._icon_theme_extensions.start()
        self._add_extensions_to_selected_theme({})

        self._bind_observers()
示例#4
0
    def start(self) -> None:
        """Start the plugin life-cycle.

        This method is called by the framework at the appropriate time. It
        should never be called by user code.

        """
        core = self.workbench.get_plugin("enaml.workbench.core")
        core.invoke_command("glaze.errors.enter_error_gathering")

        validator = make_extension_validator(Loader,
                                             ("get_cls", "get_config_view"),
                                             ("file_extensions", ))
        self.loaders = ExtensionsCollector(
            workbench=self.workbench,
            point=LOADER_POINT,
            ext_class=Loader,
            validate_ext=validator,
        )

        self.loaders.start()

        # Ensure the list of supported extensions is up to date
        self._update_supported_extensions(None)

        self.observe("custom_loader_extensions",
                     self._update_supported_extensions)
        self.loaders.observe("contributions",
                             self._update_supported_extensions)

        core.invoke_command("glaze.errors.exit_error_gathering")
示例#5
0
    def start(self) -> None:
        """Start the plugin life-cycle.

        This method is called by the framework at the appropriate time. It
        should never be called by user code.

        """
        validator = make_extension_validator(AppStartup, ("run", ), ())
        self.startup = ExtensionsCollector(
            workbench=self.workbench,
            point=STARTUP_POINT,
            ext_class=AppStartup,
            validate_ext=validator,
        )

        validator = make_extension_validator(AppClosing, ("validate", ), ())
        self.closing = ExtensionsCollector(
            workbench=self.workbench,
            point=CLOSING_POINT,
            ext_class=AppClosing,
            validate_ext=validator,
        )

        validator = make_extension_validator(AppClosed, ("clean", ), ())
        self.closed = ExtensionsCollector(
            workbench=self.workbench,
            point=CLOSED_POINT,
            ext_class=AppClosed,
            validate_ext=validator,
        )

        self.startup.observe("contributions", self._update_heap)
        self.closed.observe("contributions", self._update_heap)
        self.startup.start()
        self.closing.start()
        self.closed.start()