a better widget for nesting notebooks?

For a change I don't need help (yet). I managed to nest a notebook within another notebook on my first try, and it looks decent. Better than I thought, actually, but I'm just wondering if there is some other custom control already available that creates this nested effect.

Basically what I'd like is a parent tab (for separate people), and then within that tab a bunch of subtabs for things like personal information, work info, addresses, etc. The nested notebooks seem like a good way to do it, but perhaps there's something else as well.

Thanks.

Hello John,

For a change I don't need help (yet). I managed to nest a notebook
within another notebook on my first try, and it looks decent. Better
than I thought, actually, but I'm just wondering if there is some other
custom control already available that creates this nested effect.

Take a look at this layout:

http://xoomer.alice.it/infinity77/luna1.jpg

And, if you like it, take a closer look to FlatNotebook:

http://xoomer.alice.it/infinity77/eng/freeware.html#flatnotebook

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 10/11/06, John Salerno <johnjsal@nospamgmail.com> wrote:

Andrea Gavana wrote:

And, if you like it, take a closer look to FlatNotebook:

http://xoomer.alice.it/infinity77/eng/freeware.html#flatnotebook

yeah, seems like this is coming out just in time for me! :slight_smile:

does "drop in replacement" really mean that I can simply use your class instead of Notebook, with no other changes? does it work with XRC?

thanks

Andrea Gavana wrote:

> And, if you like it, take a closer look to FlatNotebook:
>
> http://xoomer.alice.it/infinity77/eng/freeware.html#flatnotebook

yeah, seems like this is coming out just in time for me! :slight_smile:

well, IIUC it would be officially inside the next wxPython pre-release
as a "new widget", if Robin finds the time to apply the patches I
sent. Otherwise I am pretty sure he will add it to the 2.7 release
that will come out shortly after.

does "drop in replacement" really mean that I can simply use your class
instead of Notebook, with no other changes?

Almost. There might be some method with different *args input (I mean
the keyword name, not the order in which you input the parameters or
their number, they are the same). At the moment I have fixed correctly
the AddPage, InsertPage and similar to have the same keyword name as
wx.Notebook, but there might be other methods that require fixing. It
should work for the vast majority of cases, but if you find anything
strange, pleas let me know,

does it work with XRC?

I have no idea. I would assume that it doesn't, because at the moment
there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
but I could probably steal some ideas from the great work Julianne has
done with NotebookCtrl and try to implement it. I really don't know, I
never use xrc, I prefer to be able to look at the code I write in my
editor.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

Andrea Gavana wrote:

I have no idea. I would assume that it doesn't, because at the moment
there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
but I could probably steal some ideas from the great work Julianne has
done with NotebookCtrl and try to implement it. I really don't know, I
never use xrc, I prefer to be able to look at the code I write in my
editor.

I'm guessing there's also no C++ class called wxFlatNotebook, right? That's probably something needed.

Oh well, I'm still trying to decide if I should use XRC or keep handwriting my GUI code. :slight_smile:

P.S. The widget looks awesome.

Andrea Gavana wrote:

Andrea Gavana wrote:

> And, if you like it, take a closer look to FlatNotebook:
>
> http://xoomer.alice.it/infinity77/eng/freeware.html#flatnotebook

yeah, seems like this is coming out just in time for me! :slight_smile:

well, IIUC it would be officially inside the next wxPython pre-release
as a "new widget", if Robin finds the time to apply the patches I
sent. Otherwise I am pretty sure he will add it to the 2.7 release
that will come out shortly after.

The patches have been applied, but not checked in yet. That will happen in a little while after some more testing.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

John Salerno wrote:

Andrea Gavana wrote:

I have no idea. I would assume that it doesn't, because at the moment
there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
but I could probably steal some ideas from the great work Julianne has
done with NotebookCtrl and try to implement it. I really don't know, I
never use xrc, I prefer to be able to look at the code I write in my
editor.

I'm guessing there's also no C++ class called wxFlatNotebook, right? That's probably something needed.

XRC can be extended from Python with a custom handler class that knows how to create the instance and apply the attributes defined in the xml. See the demo for an example.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hello John,

> I have no idea. I would assume that it doesn't, because at the moment
> there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
> but I could probably steal some ideas from the great work Julianne has
> done with NotebookCtrl and try to implement it. I really don't know, I
> never use xrc, I prefer to be able to look at the code I write in my
> editor.

I'm guessing there's also no C++ class called wxFlatNotebook, right?
That's probably something needed.

Yes, I have stolen the idea from Eran, a poster in the wxWidgets
Forum. At the moment, I am following the CVS modifications of this
widget, although all the very latest improvements (mostly related to
wx.aui integration) have been added to the wxPython version today (I
will upload the new version tomorrow, if I have some time).

Oh well, I'm still trying to decide if I should use XRC or keep
handwriting my GUI code. :slight_smile:

Well, that's just a matter of taste... but you could also try to
create your layouts using some GUI builder (like wxGlade, Boa). For
complex layouts they come in handy, unless you know sizers so well
that you can code complex things with them blindly :smiley:
Uhm, well, now that I think about it, wxGlade is dead with wxPython
2.7... I would be nice to try to upgrade it to handle also wxPython
2.7. But we can also wait for the promised new brilliant Boa
Constructor release.

P.S. The widget looks awesome.

Thanks, I am glad you like it :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

John Salerno wrote:
> Andrea Gavana wrote:
>
>> I have no idea. I would assume that it doesn't, because at the moment
>> there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
>> but I could probably steal some ideas from the great work Julianne has
>> done with NotebookCtrl and try to implement it. I really don't know, I
>> never use xrc, I prefer to be able to look at the code I write in my
>> editor.
>
> I'm guessing there's also no C++ class called wxFlatNotebook, right?
> That's probably something needed.

XRC can be extended from Python with a custom handler class that knows
how to create the instance and apply the attributes defined in the xml.
See the demo for an example.

Yes, but this handling is missing also in the C++ version. There is
nothing right now about XRC, in wxFlatNotebook nor in FlatNotebook. It
should be written from scratch. I'll try and see what I can put
together, maybe I can pass the wxPython implementation to wxWidgets
guys :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

Robin Dunn wrote:

John Salerno wrote:

Andrea Gavana wrote:

I have no idea. I would assume that it doesn't, because at the moment
there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
but I could probably steal some ideas from the great work Julianne has
done with NotebookCtrl and try to implement it. I really don't know, I
never use xrc, I prefer to be able to look at the code I write in my
editor.

I'm guessing there's also no C++ class called wxFlatNotebook, right? That's probably something needed.

XRC can be extended from Python with a custom handler class that knows how to create the instance and apply the attributes defined in the xml. See the demo for an example.

I'd think you could probably do it with subclassing as well. Create a regular notebook widget, then identify its subclass as a FlatNotebook. You might have to fiddle with the naming and import statements to enable the loader to find the right class. (I think there's an example of this in the demo as well.)

···

--
Don Dwiggins
Advanced Publishing Technology

Don Dwiggins wrote:

Robin Dunn wrote:

John Salerno wrote:

Andrea Gavana wrote:

I have no idea. I would assume that it doesn't, because at the moment
there is no class FlatNotebookWindowHandler(xrc.XmlResourceHandler),
but I could probably steal some ideas from the great work Julianne has
done with NotebookCtrl and try to implement it. I really don't know, I
never use xrc, I prefer to be able to look at the code I write in my
editor.

I'm guessing there's also no C++ class called wxFlatNotebook, right? That's probably something needed.

XRC can be extended from Python with a custom handler class that knows how to create the instance and apply the attributes defined in the xml. See the demo for an example.

I'd think you could probably do it with subclassing as well. Create a regular notebook widget, then identify its subclass as a FlatNotebook. You might have to fiddle with the naming and import statements to enable the loader to find the right class. (I think there's an example of this in the demo as well.)

Actually that won't work in this case. When using the subclass attribute XRC will make an instance of the class using the subclass, but will still call the Create() method using the class. (There are various ugly C++ reasons for this that I won't go into here.) Since wx.FlatNotebook derives from wx.Panel and not wx.Notebook, then the wrong Create will be called, and there will probably be some serious runtime problems.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!