Open dan123456-eng opened 2 years ago
Our team works with 3 different layouts. I'm trying to save these 3 layouts as default, to be loaded when installing the plugin. I'm trying to do this because our team is reasonably great and everyone uses the plugin.
Hi @dan123456-eng to be able to load layouts you can programatically create them as a part of a plugin. An example of that is at https://github.com/spyder-ide/plugin-examples/tree/master/spyder-custom-layout
Basically, for each layout, you will need to create a class that extends BaseGridLayoutType
from spyder.plugins.layout.api
as in https://github.com/spyder-ide/plugin-examples/blob/6cc9fda9623e9cfc506713d11cd7b8cb938d4001/spyder-custom-layout/spyder_custom_layout/spyder/api.py#L22-L23
And then reference those classes in your plugin class definition using the CUSTOM_LAYOUTS
constant as in https://github.com/spyder-ide/plugin-examples/blob/6cc9fda9623e9cfc506713d11cd7b8cb938d4001/spyder-custom-layout/spyder_custom_layout/spyder/plugin.py#L37
If you have more questions regarding this let us know!
Hello @dalthviz thank you for your assistance. I'll follow your instructions. If any more questions come up, I'll talk to you. Tks
Hello @dalthviz've already done a draft here. But when I try to put my plugin in the layout I can not. Can you help?
We use the structure below for Spyder plugins:
self.add_area([Plugins.Explorer], 1, 0, visible=True, default=True)
self.add_area([Plugins.OutlineExplorer], 0, 0, visible=True)
Plugins of third parties is the same thing? For instance: self.add_area([Plugins.Myplugin], 0, 0, visible=True)
Hi again @dan123456-eng , sure :+1:, do you have your plugin code in a repo you can share/give us access to or maybe you could post the code here as a .zip
file for us to check it locally?
@dalthviz Our repository is not public yet. I can only put a few excerpts. I am sorry! I'll ask my project manager to show complete files.
We use the structure below for Spyder plugins:
self.add_area([Plugins.Explorer], 1, 0, visible=True, default=True) self.add_area([Plugins.OutlineExplorer], 0, 0, visible=True)
Plugins of third parties is the same thing? For instance: self.add_area([Plugins.Myplugin], 0, 0, visible=True)
I see, no worries :+1: and regarding the use of the add_area
for third-party plugin you will need to pass instead of [Plugins.MyPlugin]
the name of your plugin as is declared in the NAME
constant I think (so something like ['myplugin_name']
if in your plugin you defined NAME='myplugin_name'
). The Plugins
class is an utility class that has as attributtes the constants used as names but only for the internal plugins so it doesn't have the third-party plugins names I think.
I'll try these tips.
@dalthviz The example below worked:
from spyder_pymr.dock_log import DockLog self.add_area([DockLog.NAME], 1, 0, visible=True, default=True)
Thanks!
Problem Description
Currently I save the layouts in "View/Window layouts/Save current layout" all right. Have how to save the layouts to an external file and load them as the "SpyderLayout, HorizontalSplitLayout, VerticalSplitLayout, RLayout,MatlabLayout " ?
Versions