Settings divided in tabs
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Settings divided in tabs
Hi,
Has someone experience in how to divide/split settings in a configuration dialogue for a plug-in or action into a tabbed view?
Using as example wx.Notebook???
I have too many settings in the view and need to clean up/organise it better
Best regards, Walter
Has someone experience in how to divide/split settings in a configuration dialogue for a plug-in or action into a tabbed view?
Using as example wx.Notebook???
I have too many settings in the view and need to clean up/organise it better
Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: Settings divided in tabs
You probably had a hard time finding info because you were searching the wrong terms. wxWidgets calls them notebooks, not tabs. Here's some info.
Brett
Brett
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: Settings divided in tabs
Brett, thanks, I did find that page in the meantime
Hope you can advice me further with my next steps
I have attached a simple working plug-in sample based on the one that is described at our forum in the developer documentation and with the addition of a wx.Notebook in the settings for the action
From here I would like to do the following:
- make it possible to use eg's own SpinIntCtrl and SpinNumCtrl on the notebook pages
- have action settings distributed on several notebook pages and return them back to the action class when changed
Any advice is very appreciated
Best regards & thanks for your help,
Walter
Hope you can advice me further with my next steps
I have attached a simple working plug-in sample based on the one that is described at our forum in the developer documentation and with the addition of a wx.Notebook in the settings for the action
From here I would like to do the following:
- make it possible to use eg's own SpinIntCtrl and SpinNumCtrl on the notebook pages
- have action settings distributed on several notebook pages and return them back to the action class when changed
Any advice is very appreciated
Best regards & thanks for your help,
Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: Settings divided in tabs
Walter,
Sorry, I'm not an expert on wxWidgets. Here's the best I can offer.
#2 is more tricky. The problem is that the notebook tabs aren't instantiated until they are opened. So any variables defined on them won't be assigned unless the user actually looks at the tab. Now since the plugin passes in all of the initial values, you should be ok using them (they are non-local variables). Just make sure the settings effect the non-local values and I think you'll be ok.
Brett
Sorry, I'm not an expert on wxWidgets. Here's the best I can offer.
#1 I don't think is a problem, as eg's UI classes are just wrappers around the wxWidgets classes.krambriw wrote: - make it possible to use eg's own SpinIntCtrl and SpinNumCtrl on the notebook pages
- have action settings distributed on several notebook pages and return them back to the action class when changed
#2 is more tricky. The problem is that the notebook tabs aren't instantiated until they are opened. So any variables defined on them won't be assigned unless the user actually looks at the tab. Now since the plugin passes in all of the initial values, you should be ok using them (they are non-local variables). Just make sure the settings effect the non-local values and I think you'll be ok.
Brett
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: Settings divided in tabs
When I try to add something like p = self.SpinIntCtrl(....) in one of the wx.Panel classes I get an error message that it is not an attribute of the page object#1 I don't think is a problem, as eg's UI classes are just wrappers around the wxWidgets classes
Also p = eg.SpinIntCtrl(....) gives a lot of error messages
Do you have a code sample? Shall I have the action variables in the init of the page? Like#2 is more tricky. The problem is that the notebook tabs aren't instantiated until they are opened. So any variables
def __init__(self, parent, action.Variable1, action.Variable2, etc)
I feel I'm not clever enough for this...
It would be so simple, and it would make sense, that the eg.ConfigPanel would support multiple tabs itself....
Best regards & thanks,
Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: Settings divided in tabs
Sorry, I can't provide much more help without building it myself. I'm not an expert in wxWidgets.
A simple class might look like this:
In this case, ctrl is whichever control you have the let's the user set the value. The problem is that if that control is part of a tab that isn't opened, it won't be defined.
So instead, you need to bind the control to a function that sets (in my example) myString = ctrl.GetValue(). You know ctrl will exist, because the bound function won't be called unless the tab is open. And since myString isn't local, it will be available for panel.SetResult:
Get the idea?
Brett
This would be the form you need.krambriw wrote:Also p = eg.SpinIntCtrl(....) gives a lot of error messages
Check out EG's about dialog class, it uses a notebook.krambriw wrote:Do you have a code sample?
I'm not sure what you mean by action.Variable one.krambriw wrote:Shall I have the action variables in the init of the page? Like
def __init__(self, parent, action.Variable1, action.Variable2, etc)
A simple class might look like this:
Code: Select all
class MyAction(eg.ActionClass):
name = "MyAction"
description = "Does my action"
def __call__(self, myString="Hello"):
print myString
def Configure(self, myString="Hello"):
panel = eg.ConfigPanel(self)
....
while panel.Affirmed():
panel.SetResult(ctrl.GetValue())
So instead, you need to bind the control to a function that sets (in my example) myString = ctrl.GetValue(). You know ctrl will exist, because the bound function won't be called unless the tab is open. And since myString isn't local, it will be available for panel.SetResult:
Code: Select all
while panel.Affirmed():
panel.SetResult(myString)
Brett
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: Settings divided in tabs
Thanks Brett, I'm actually giving up on this trial, I could not make it work even after extensive attempts...
Another approach which I think would also be better is to see if one could modify the ConfigPanel.py to support multiple setting pages
It was fairly easy to add another page simply by adding this line
However, next problem would be to define on what page the various settings should "land"
With something like this in my dreams
...but I believe this will be impossible now when Bitmonster says he left the project
Best regards, Walter

Another approach which I think would also be better is to see if one could modify the ConfigPanel.py to support multiple setting pages
It was fairly easy to add another page simply by adding this line
Code: Select all
dialog.notebook.AddPage(self, "SettingsII")
With something like this in my dreams
Code: Select all
panel = eg.ConfigPanel(3) #The number defines the number of setting pages to initiate
.
.
.
panel(0).sizer.Add(sizer_0, 0, wx.EXPAND)
panel(1).sizer.Add(sizer_1, 0, wx.EXPAND)
panel(2).sizer.Add(sizer_2, 0, wx.EXPAND)
...but I believe this will be impossible now when Bitmonster says he left the project

Best regards, Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM
Re: Settings divided in tabs
You may not be aware, I am creating a fork of EventGhost. One of the changes is to switch from wxWidgets to PyQt. Couple nice things about PyQt
it has a nice UI (Qt Designer) for building your own UIs
the syntax is (in my opinion) cleaner. Bitmonster created a bunch of small wrapper classes about wx widgets - this isn't necessary with PyQt, I just use their classes. So there's no need to modify the core to build what you want
So I agree that adding notebooks to the EG core probably won't happen, there should be another option at some point.
Brett
it has a nice UI (Qt Designer) for building your own UIs
the syntax is (in my opinion) cleaner. Bitmonster created a bunch of small wrapper classes about wx widgets - this isn't necessary with PyQt, I just use their classes. So there's no need to modify the core to build what you want
So I agree that adding notebooks to the EG core probably won't happen, there should be another option at some point.
Brett
-
- Plugin Developer
- Posts: 2570
- Joined: Sat Jun 30, 2007 2:51 pm
- Location: Stockholm, Sweden
- Contact:
Re: Settings divided in tabs
Hi Brett, sounds interesting
BTW I hope you preserve the backward compatibility. Would be nice (required) that existing eg plugins will work without modification
BestR Walter
BTW I hope you preserve the backward compatibility. Would be nice (required) that existing eg plugins will work without modification
BestR Walter
My released plugins
https://drive.google.com/drive/folders/ ... y01eVBKeHM
https://drive.google.com/drive/folders/ ... y01eVBKeHM