You are here

plugin architecture: separating GUI from engine

It seems to me that more plugins should be divided into separate components for engine and GUI. Note that both would be plugins in the PDB. However, an engine component would not show up in the menus. A GUI component would show up in the menus and call on an engine component.

This seems possible now. Gimp documentation says when registering a plugin you don't have to include a menu path (I haven't tried it, don't know if many plugins use this.) So one could separate the engine and GUI.

I suppose this is advocating a convention, not an enforced requirement.

It is sometimes desireable to change one without the other. The creator of the engine might be more interested in, and better at, image processing algorithms than at UI design, and vice versa.

Also, the GUI and engine could be in different languages. For example, GUI in Python, engine in C. That might attract more developers to contribute.

For example, the resynthesizer plugin. It is written in C++. It has a GUI implemented in the same source file as the engine. There are also separate plugin scripts (Smart remove selection... smart_remove.scm, written in Scheme) that call the resynthesizer plugin. I think the resynthesizer plugin has a bug in its interface definition that prevents a python script from calling it. If the resynthesizer plugin had its GUI separate from its engine, then you could fix and release the engine without touching the GUI component. Also, someone might want to rewrite the built-in GUI for resynthesizer (since to my mind, it is not intuitive.) If the gui and engine were separate, one could rewrite the GUI without fear of damaging the engine, and rewrite it in another language, possible even a framework for GUIs.

For another example, enhancement 423654, improving the GUI for the Erode Dilate plugin. If the GUI were separate from the engine, this might be easier to do.

If GUI's were separate from engines, it might be easier to control chaos in the GIMP menus. Many of the GUIs would be scripts (not needing compilation). Some all-powerful, all-seeing, GUI lord could alter the menus for plugins without needing to recompile a thing.

GtkUIManager does support placeholders for menus. Thus you could re-place menu entries by editing the menu XML files.

Making this work for third-party plug-ins could require some more thought. Maybe you'd want to research a bit about the possibilities and propose a concept that would support this.

BTW, did you ever have a look at some plug-ins written in C? Aside from being in the same file and thus affected by errors at compile time, I do not see how you would damage any "engine" of a plug-in when rewriting its GUI. 

Subscribe to Comments for "plugin architecture: separating GUI from engine"