OS4-style plugin with GUI loading problem
Dear Sebastiaan,
I am trying to load your OS4 example plugin from your personal git as a starting point for my new plugin. This code contains a GUI class.
When loading, it complains about the class name:
AttributeError: module 'example_plugin' has no attribute 'qtexample_plugin'
Then I tried the old style naming:
'class qtexample_plugin(ExamplePlugin, QtAutoPlugin):'
Now the plugin loads with the following error:
Traceback (most recent call last):
File "D:\opensesame_4.0.5\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 749, in dropEvent
self.drop_event_item_new(data, e)
File "D:\opensesame_4.0.5\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 730, in drop_event_item_new
item.open_tab()
File "D:\opensesame_4.0.5\Lib\site-packages\libqtopensesame\items\qtitem.py", line 129, in open_tab
self.tabwidget.add(self.widget(), self.item_icon(), self.name)
^^^^^^^^^^^^^
File "D:\opensesame_4.0.5\Lib\site-packages\libqtopensesame\items\qtitem.py", line 39, in inner
self.init_edit_widget()
File "C:\Users\xxxx\Documents\OS_Plugins\opensesame-plugin-example\opensesame_plugins\example\example_plugin\example_plugin.py", line 74, in init_edit_widget
super().init_edit_widget()
File "D:\opensesame_4.0.5\Lib\site-packages\libqtopensesame\items\qtautoplugin.py", line 64, in init_edit_widget
for c in self.plugin_attribute('controls'):
TypeError: 'NoneType' object is not iterable
It looks like 'controls' is not passed to the init widget. I am using exactly the same as your __init__.py script.
Do you have a hint what is wrong with the plugin example code?
Comments
Hi @MartinS ,
Good to hear that you're making your own plugin! I'm not sure what example you're using, but the up-to-date example is here:
I noticed that the link is incorrect on the documentation site, so I'll fix that.
A GUI class is not necessary in principle, unless you have specific GUI elements that you want to implement (beyond the default GUI controls that the plugin creates automatically). Is that the case?
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thanks for your reply. I am using the same code as yours from the git you mention.
Yes, I want to make use of GUI elements. I assume that the plugin example is the bare minimum that should load in OS4 out of the box. Am I assuming this correct? When I load the example, it comes with the error:
OS4 is expecting a class name other than:
according to the Creating a (4.0) Plugin tutorial.
Best,
Martin
Hi @MartinS ,
I assume that the plugin example is the bare minimum that should load in OS4 out of the box. Am I assuming this correct?
Yes but there's also a dummy GUI class by way of example.
When I load the example, it comes with the error:
Based on this error it seems that you're not running the example plugin (or perhaps an older version of the example). Can you try again with the latest snapshot from GitHub? You'll see that it works and then you can take it from there.
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @MartinS ,
I just ried it again, and the updated example plugin does (also) work. One thing that comes to mind though, is that you haven't installed the plugin as a Python package but rather using the old-style way of specifying a plugin folder, in which case OpenSesame tries to load it as an old-style plugin.
In your case, the following folder should be in the Python path so that OpenSesame can find the plugin:
C:\Users\xxxx\Documents\OS_Plugins\opensesame-plugin-example
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Great! The example plugin works now, by adding the plugin path to the python path. This is nice for future releasing of plugins as a python package for seamless integration.
Thanks a lot!
Best,
Martin