PluginFactory creation

Hi all,

I am trying to create custom plugins using PluginFactory, all based on the example provided from the PluginFactory API reference. I noticed that each time I create a new plugin, the create_plugin of the previous plugins is called again. Is that the intended behavior? Could we somehow stop this from happening?

Thank you

Comments

  • Hi all.

    Looking back at the documentation, my issue may lie in the fact that I do not have a menu entry but only trigger it by code (creating only a hidden tool button in the toolbar), and for each view I create, it also creates a new plugin (?). So probably, the solution may be in this line in the documentation:
    Provide global functionality (independent from the layout view) using configure or menu_activated

    Guessing that the latter may need a menu, does anyone know how I can "configure" the plugin to provide it as a global functionality?

    Chris

  • Hi Chris,

    yes it is intended that "create_plugin" is called. In fact this is called pretty often, specifically if a layout view refreshes.

    If you provide some sample code, maybe it is easier to understand what you are trying to do.

    "configure" is a way to send key/value pairs to a plugin class. There is a global configuration parameter space that can be written using Application#set_config. The key/values are dispatched to all plugin instances and the factory itself. So basically that is a way to pass information from the application to the plugin.

    But having one plugin per view is the core concept of the Plugin API. So why would you use a plugin if you're not interested in creating one per view?

    Matthias

Sign In or Register to comment.