I remember some time ago seeing some code for a panel stack, that is, a bunch of panels that take up the same space on screen, but can me moved to the top of the stack.
My Google-Fu is failing me here. Does anyone remember this?
I’m asking because I am building an editor for an XML data file. The file has about four levels of complex, repeatable children, and I want the editors for these children and grandchildren to be manageable, and to appear as needed without creating several layers of modal dialog boxes.
On Tue, May 15, 2012 at 1:03 PM, Josh English <joshua.r.english@gmail.com> wrote:
My memory may be hallucinating on me here...
I remember some time ago seeing some code for a panel stack, that is, a
bunch of panels that take up the same space on screen, but can me moved to
the top of the stack.
My Google-Fu is failing me here. Does anyone remember this?
On Tuesday, May 15, 2012 12:03:26 PM UTC-5, Josh English wrote:
My memory may be hallucinating on me here…
I remember some time ago seeing some code for a panel stack, that is, a bunch of panels that take up the same space on screen, but can me moved to the top of the stack.
My Google-Fu is failing me here. Does anyone remember this?
I’m asking because I am building an editor for an XML data file. The file has about four levels of complex, repeatable children, and I want the editors for these children and grandchildren to be manageable, and to appear as needed without creating several layers of modal dialog boxes.
You can do this be placing all the panels in a BoxSizer and only Show()ing one at a time, calling Hide() on all the others. Can put this in a single method with something like this
On Tuesday, May 15, 2012 12:03:26 PM UTC-5, Josh English wrote:
My memory may be hallucinating on me here…
I remember some time ago seeing some code for a panel stack, that is, a bunch of panels that take up the same space on screen, but can me moved to the top of the stack.
My Google-Fu is failing me here. Does anyone remember this?
I’m asking because I am building an editor for an XML data file. The file has about four levels of complex, repeatable children, and I want the editors for these children and grandchildren to be manageable, and to appear as needed without creating several layers of modal dialog boxes.
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
You can add panels to sizers later after some time, if you stored the references in a list or a dictionary you could loop over them and call Show(True) on the one you want to show and Show(False) on the rest.
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
Don’t think I explained it that well, but I put together a quick demo which should show you what I meant. There’s a bit of problem with the combo box if you show or remove with nothing selected in the combo but you can ignore that
On Wednesday, 16 May 2012 23:12:15 UTC+1, Josh English wrote:
Mike and Paul,
Thanks. I read the article and liked it.
But…
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
On Wednesday, 16 May 2012 23:12:15 UTC+1, Josh English wrote:
Mike and Paul,
Thanks. I read the article and liked it.
But…
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
Don’t think I explained it that well, but I put together a quick demo which should show you what I meant. There’s a bit of problem with the combo box if you show or remove with nothing selected in the combo but you can ignore that
On Thursday, May 17, 2012 6:07:47 AM UTC-5, Paul wrote:
On Wednesday, 16 May 2012 23:12:15 UTC+1, Josh English wrote:
Mike and Paul,
Thanks. I read the article and liked it.
But…
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
Don’t think I explained it that well, but I put together a quick demo which should show you what I meant. There’s a bit of problem with the combo box if you show or remove with nothing selected in the combo but you can ignore that
The idea’s the same as in your tutorial, i did reply initially before checking it out though. The demo just shows how you can create and destroy panels dynamically.
On Thursday, May 17, 2012 6:07:47 AM UTC-5, Paul wrote:
On Wednesday, 16 May 2012 23:12:15 UTC+1, Josh English wrote:
Mike and Paul,
Thanks. I read the article and liked it.
But…
upon further consideration of what I really need, I think what I really need a way to create and destroy my sub-editor panels dynamically. Because the objects being edited are passed back and forth through Validators, I need a good way to track which bit is being edited at any given time.
I would love to be able to create a panel, slide it over the current panel, but that’s GUI sugar I don’t think I can do just yet.
Don’t think I explained it that well, but I put together a quick demo which should show you what I meant. There’s a bit of problem with the combo box if you show or remove with nothing selected in the combo but you can ignore that
Hm thanks, I get the error though when calling GetValue() on the combo when it’s empty
wx._core.PyAssertionError: C++ assertion “IsValid(n)” failed at /BUILD/wxPython-src-2.8.12.1/src/mac/carbon/choice.cpp(242) in GetString(): wxChoice::GetString(): invalid index
I’m still fighting a conceptual problem that I probably don’t really need to be fighting with, yet I am.
Because my data structure is tree-like, I’m working on the assumption that my GUI must also be tree-like. That could mean using a TreeCtrl, but also in how panels relate to one another.
Right now I’m getting by with modal dialog boxes because they are easy and one modal dialog can call another modal dialog.
I’m also using Validators to transfer information between these dialogs and their parents.
Here’s the brick wall:
If I have four separate panels to edit my data, in four separate classes, then I imagine the workflow as:
ParentNode is edited by ParentEditor. Clicking on a list representing certain ChildNodes brings up the ChildNode in a ChildEditor. Should this be a brand new instance of the ChildEditor, or a global instance? If I make a new instance (which seems easiest with Validators) and show it on top of the ParentEditor … and here’s where it gets confusing. The Frame needs to be the parent of all of these panels to easily show and hide them. Then I also have to keep track of a logical parent for each panel as they are created.
And I have to be able to control this (in this application) to at least four levels of the data tree.
And here it is. The second editor comes up normally, but the controls aren’t responsive. This seems strange. I’m hiding the old panel, showing the new, attaching it to the sizer and telling the sizer to Layout(). Still, no reaction when I click on the text field or double click on an item in the listbox.
And here it is. The second editor comes up normally, but the controls aren’t responsive. This seems strange. I’m hiding the old panel, showing the new, attaching it to the sizer and telling the sizer to Layout(). Still, no reaction when I click on the text field or double click on an item in the listbox.
The reason it doesn’t work is because you have parenting issues going on. You already have a panel as the main panel for the Frame class. However, when you load the OpportunityPanel, you try to make it a “top level” panel too (for lack of a better term). Thus, you have two panels vying for the same space. You should make OpportunityPanel a child of the top panel like you did with the ScenePanel. I tried changing your code so that your panel init in the frame went from something like
panel = wx.Panel()
to
self.panel = wx.Panel()
and then changed line 209 to be
newp = panelClass(self.panel, dataparent)
Then it worked on my system.
Mike
···
On Friday, May 18, 2012 3:00:48 PM UTC-5, Josh English wrote:
On Fri, May 18, 2012 at 1:59 PM, Mike Driscoll kyosohma@gmail.com wrote:
The reason it doesn’t work is because you have parenting issues going on. You already have a panel as the main panel for the Frame class. However, when you load the OpportunityPanel, you try to make it a “top level” panel too (for lack of a better term). Thus, you have two panels vying for the same space. You should make OpportunityPanel a child of the top panel like you did with the ScenePanel. I tried changing your code so that your panel init in the frame went from something like