I'm writing an application that will use plugins. In the plugin I want to include a widget that allows the options for that plugin to be setup. The plugin will also include methods to operate on the data.
What is is the best way to include a widget in a plugin?
Below is pseudo code for what I've tried to do.
My original plan was to make the options widget:
class myOptionsWidget(QWidget):
“””
create widget for plug in options “””
….
Next I planned on including the widget in my plugin:
class myPlugin
def __init__(self):
self.optionWidget = myOptionsWidget()
self.pluginNum = 1
….
def getOptionWidget(self):
return(self.optionWidget)
Then at the top level I'd do something like
a = myPlugin()
form = createForm(option=a.getOptionWidget()) …
where createForm would create the form and include my plugin options widget.
But when I try "a = myPlugin()" I get the error "QWidget: Must construct a QApplication before a QpaintDevice" so this method won't work. I know I would store the widget as a string and call eval on it but I'd rather not do that in case later on I want to convert the program to C++.
What is the best way to write a plugin that includes a widget that has the options?
Brian