Changing plugin settings programmatically

Hi,

LaserJock asked on irc if it was possible to change engine settings
using python. To make this work in a generic way for plugins, I was
thinking of something like:

virtual QList Plugin::options() (or attributes, ??)

(we could also return a list of PluginOptions with min/max values, defaults, ??)

virtual QVariant Plugin::option(const QString &name)
virtual void Plugin::setOption(const QString &name, const QVariant &value)

Plugin implementations can implement various options as needed…

Any comments on this?

Cheers,
Tim

Tim Vandermeersch wrote:

Hi,

LaserJock asked on irc if it was possible to change engine settings
using python. To make this work in a generic way for plugins, I was
thinking of something like:

virtual QList Plugin::options() (or attributes, ??)

(we could also return a list of PluginOptions with min/max values, defaults, ??)

virtual QVariant Plugin::option(const QString &name)
virtual void Plugin::setOption(const QString &name, const QVariant &value)

Plugin implementations can implement various options as needed…

Any comments on this?

I think the solution I have been using in various places works very
well. You can use QSettings to set and retrieve settings of the plugins.
See the orbitalextension code for some examples. You just need to ensure
the plugin exposes the settings you wish to change.

On Sun, Feb 1, 2009 at 4:12 AM, Marcus D. Hanwell marcus@cryos.org wrote:

Tim Vandermeersch wrote:

Hi,

LaserJock asked on irc if it was possible to change engine settings
using python. To make this work in a generic way for plugins, I was
thinking of something like:

virtual QList Plugin::options() (or attributes, ??)

(we could also return a list of PluginOptions with min/max values,
defaults, ??)

virtual QVariant Plugin::option(const QString &name)
virtual void Plugin::setOption(const QString &name, const QVariant &value)

Plugin implementations can implement various options as needed…

Any comments on this?

I think the solution I have been using in various places works very well.
You can use QSettings to set and retrieve settings of the plugins. See the
orbitalextension code for some examples. You just need to ensure the plugin
exposes the settings you wish to change.

Ah yes, didn’t think of that… LaserJock: do you know how to do this?
I’ll add more examples/tutorials soon…