You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
I've recently upgraded to Spyder 4 and this cookie cutter doesn't work. I've figured out what to change to fix it. I've started a new plugin and I'll make notes below on the changes required to make the plugin work in both Spyder 3 and Spyder 4.
Line 26 - QObject.init(self, parent) - QObject isn't imported so this fails. Also, the next line is SpyderPluginWidget.init(self, parent). Won't this inherit the QObject constructor? I commented this line out.
The location of the tabify function changes depending on the version of spyder so I changed the on_first_registration function to:
def on_first_registration(self):
"""Action to be performed on first plugin registration."""
# Define where the plugin is going to be tabified next to
# As default, it will be tabbed next to the ipython console
if self.spyder_version==3:
self.main.tabify_plugins(self.main.help, self)
else:
self.tabify(self.main.help)
Likewise the add_dock_widget function has moved in Spyder 4 - so I change the register_plugin function to:
def register_plugin(self):
"""Register plugin in Spyder's main window."""
if self.spyder_version==3:
self.main.add_dockwidget(self)
else:
self.add_dockwidget()
After that it seems to work.
Now, I'll admit that detecting the Spyder version on the basis of whether or not the initialize_plugin call works is pretty lame - so please let me know if there's a better way.
Making Spyder Plugins is a really cool way to extend the power of a great tool. Thanks for developing this system!
Simon
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there.
I've recently upgraded to Spyder 4 and this cookie cutter doesn't work. I've figured out what to change to fix it. I've started a new plugin and I'll make notes below on the changes required to make the plugin work in both Spyder 3 and Spyder 4.
Line 26 - QObject.init(self, parent) - QObject isn't imported so this fails. Also, the next line is SpyderPluginWidget.init(self, parent). Won't this inherit the QObject constructor? I commented this line out.
I then add the following two lines:
After that it seems to work.
Now, I'll admit that detecting the Spyder version on the basis of whether or not the initialize_plugin call works is pretty lame - so please let me know if there's a better way.
Making Spyder Plugins is a really cool way to extend the power of a great tool. Thanks for developing this system!
Simon
The text was updated successfully, but these errors were encountered: