Create user defined AuiTabArt

Hi,

is it possible to design my own AuiTabArt for wx.aui.AuiNotebook? I know there are 2 preconfigured AuiTabArts (default and simple) but I'd like to have something more colourful or with free scalable angles.
I guess I have to inherit from PyAuiTabArt and use the DrawTab() function, but I don't know exactly how to implement this. Is there any documentation to this topic? Or has anybody done this before? I thought about something like the FlatNotebook from Andrea.

Thanks in advance,
Tim

Hi Tim,

is it possible to design my own AuiTabArt for wx.aui.AuiNotebook? I know there are 2
preconfigured AuiTabArts (default and simple) but I'd like to have something more
colourful or with free scalable angles.
I guess I have to inherit from PyAuiTabArt and use the DrawTab() function, but I don't
know exactly how to implement this. Is there any documentation to this topic? Or has
anybody done this before? I thought about something like the FlatNotebook from Andrea.

I did some work in the past weeks to create new tab arts for AUINotebook. What I did was based on FlatNotebook tab styles, but they are still not ready to be shared with the wxPython community. I'll see if I can polish them and post them somewhere.

Andrea.

···

_____________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
Cardinal Place
80, Victoria Street
SW1E 5JL London

Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.alice.it/infinity77/index.html
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
----------------------------------------------------------------------------------
This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, please advise us immediately if you are not the named addressee or the person responsible for delivering the message to the named addressee. The contents should not be disclosed to any other person nor copies taken. Unless expressly stated, any views, whether express or implied, are the sender's personal views, do not necessarily reflect the views of KPO or any of its directors and are not approved by KPO Group and this email is not an offer, solicitation, recommendation or agreement of any kind.

Hi All,

Hi Tim,

is it possible to design my own AuiTabArt for wx.aui.AuiNotebook? I know there are 2
preconfigured AuiTabArts (default and simple) but I'd like to have something more
colourful or with free scalable angles.
I guess I have to inherit from PyAuiTabArt and use the DrawTab() function, but I don't
know exactly how to implement this. Is there any documentation to this topic? Or has
anybody done this before? I thought about something like the FlatNotebook from Andrea.

I did some work in the past weeks to create new tab arts for AUINotebook. What I did was based on FlatNotebook tab styles, but they are still not ready to be shared with the wxPython community. I'll see if I can polish them and post them somewhere.

It looks like my other e-mail got eaten by some internet monster...

I have actually tried to re-run the AuiTabArts I implemented few weeks
ago... needless to say, they do not work :-D. The area reserved for
tabs is waaaaay too small.

It seems there are a couple of issues:

- AuiNotebook style flags can not be retrieved in the PyAuiTabArt
derived class, nor can the default bitmaps for buttons, arrows and so
on;
- Overridden methods like DrawTab and GetBestTabCtrlSize are never
called in the derived class.

I am using the latest pre-release, 2.8.9.2.pre20090128 (msw-unicode)
with Python 2.5.2 on Windows XP. I attach a very basic implementation
of my AuiTabArt for others to test and to discover my stupid mistakes.

Thank you for your suggestions.

Andrea.

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

PyAUITabArts2.py (4.71 KB)

···

On Mon, Feb 2, 2009 at 2:12 PM, Gavana, Andrea wrote:

Hi Andrea,

Andrea Gavana wrote:

Hi All,

> Hi Tim,
>
>> is it possible to design my own AuiTabArt for wx.aui.AuiNotebook? I know
there are 2
>> preconfigured AuiTabArts (default and simple) but I'd like to have something
more
>> colourful or with free scalable angles.
>> I guess I have to inherit from PyAuiTabArt and use the DrawTab() function,
but I don't
>> know exactly how to implement this. Is there any documentation to this topic?
Or has
>> anybody done this before? I thought about something like the FlatNotebook
from Andrea.
>
> I did some work in the past weeks to create new tab arts for AUINotebook.. What
I did was based on FlatNotebook tab styles, but they are still not ready to be
shared with the wxPython community. I'll see if I can polish them and post them
somewhere.

It looks like my other e-mail got eaten by some internet monster...

I have actually tried to re-run the AuiTabArts I implemented few weeks
ago... needless to say, they do not work :-D. The area reserved for
tabs is waaaaay too small..

That's very kind of you to try that stuff again. I've just reviewed your code and the code in aui.py. Some things I recognized (please correct me if I'm wrong):

1. Commenting your GetTabSize() function makes the tab area appear in normal height. I guess this function does not have to be overridden because the low level implementation should do just fine.

It seems there are a couple of issues:

- AuiNotebook style flags can not be retrieved in the PyAuiTabArt
derived class, nor can the default bitmaps for buttons, arrows and so
on;

2. I haven't played around with style flags. For me it's more important to find a general way to create user-defined tabs
at the moment.

- Overridden methods like DrawTab and GetBestTabCtrlSize are never
called in the derived class.

3. I've bugged each(!) function that is concerned with AuiNotebook (AuiNotebook, AuiTabArt, AuiTabContainer, AuiTabCtrl, PyAuiTabArt) with a print statement like 'class.function',args, kwargs. Here is the result of your test frame WITHOUT self.nb.SetArtProvider(AuiTabArt):

   AuiNotebook.__init__ (<__main__.TestPanel; proxy of <Swig Object of type 'wxPanel *' at 0xc3f600> >,) {}
   AuiNotebook.AddPage (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfb228> >, <wx._controls.TextCtrl; proxy of <Swig
      Object of type 'wxTextCtrl *' at 0xff15a8> >, 'Welcome') {}
   AuiNotebook.AddPage (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfb228> >, <wx._controls.TextCtrl; proxy of <Swig
      Object of type 'wxTextCtrl *' at 0x1d021d8> >, 'Tab Number 1') {}
   AuiNotebook.AddPage (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfb228> >, <wx._controls.TextCtrl; proxy of <Swig
      Object of type 'wxTextCtrl *' at 0x1d02458> >, 'Tab Number 2') {}
   AuiNotebook.AddPage (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfb228> >, <wx._controls.TextCtrl; proxy of <Swig
      Object of type 'wxTextCtrl *' at 0x1d026d8> >, 'Tab Number 3') {}
   AuiNotebook.AddPage (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfb228> >, <wx._controls.TextCtrl; proxy of <Swig
      Object of type 'wxTextCtrl *' at 0x1d02978> >, 'Tab Number 4') {}

As you can see, DrawTab is never called as well.. I guess all the draw stuff is handled by the low level implementation for both of the delivered styles and never calls DrawTab which makes it even more difficult. Your TestPanel with SetArtProvider(AuiTabArt) extends the shown output by:

   PyAuiTabArt.__init__ () {}
   PyAuiTabArt._setCallbackInfo (<__main__.AuiTabArt; proxy of <Swig Object of type 'wxPyAuiTabArt *' at 0x1cef318> >, <__main__.AuiTabArt; proxy of
      <Swig Object of type 'wxPyAuiTabArt *' at 0x1cef318> >, <class 'wx.aui.PyAuiTabArt'>) {}
   AuiNotebook.SetArtProvider (<wx.aui.AuiNotebook; proxy of <Swig Object of type 'wxAuiNotebook *' at 0x1cfab68> >, <__main__.AuiTabArt; proxy of
      <Swig Object of type 'wxPyAuiTabArt *' at 0x1cef318> >) {}

I don't know if this really helps but it shows very precise that a lot of the magic is done in the background. Does anyone has the source of _aui.pyc? Maybe this could help to de-mystify the AuiTabs=).

I am using the latest pre-release, 2.8.9.2.pre20090128 (msw-unicode)
with Python 2..5.2 on Windows XP. I attach a very basic implementation
of my AuiTabArt for others to test and to discover my stupid mistakes.

Thank you for your suggestions.

Andrea.

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

I've also played around with explicitly calling DrawTab but I got stuck in the missing documentation for all the parameters.

I hope all that brainstorming leads to some editable tab (and tab container) designs. So far,
Tim

···

On Mon, Feb 2, 2009 at 2:12 PM, Gavana, Andrea wrote:

Hi Tim,

Hi Andrea,
That's very kind of you to try that stuff again. I've just reviewed your code and the code in aui.py. Some things I recognized (please correct me if I'm wrong):

1. Commenting your GetTabSize() function makes the tab area appear in normal height. I guess this function does not have to be overridden because the low level implementation should do just fine.

I found a reason for that, in GetTabSize I was returning a tuple like this:

return wx.Size(tab_width, tab_height), x_extent

While the correct return statement should be:

return(tab_width, tab_height), x_extent

So this is fixed. In any case, none of the drawing methods get called,
as I posted in a message on wxPython-dev here:

http://lists.wxwidgets.org/pipermail/wxpython-dev/2009-February/004088.html

Let's see if the gurus have some suggestions...

Andrea.

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

···

On Tue, Feb 3, 2009 at 12:34 PM, Tim Kraemer wrote:

Hi,

so I'm very curious about hearing from the gurus=). I have one question to your small sample app: isn't it better to call self.nb.SetArtProvider() directly after instantiating the AuiNotebook? I've tried some things with changing fonts (not from the frame but inside the AuiTabArt class) and it only worked when SetArtProvider is called before the first tabs/pages are added.

Greetz
Tim

----- Ursprüngliche Mail ----

···

Von: Andrea Gavana <andrea.gavana@gmail.com>
An: wxpython-users@lists..wxwidgets.org
Gesendet: Dienstag, den 3. Februar 2009, 13:38:38 Uhr
Betreff: Re: [wxpython-users] Create user defined AuiTabArt

Hi Tim,

On Tue, Feb 3, 2009 at 12:34 PM, Tim Kraemer wrote:
> Hi Andrea,
> That's very kind of you to try that stuff again. I've just reviewed your code
and the code in aui.py. Some things I recognized (please correct me if I'm
wrong):
>
> 1. Commenting your GetTabSize() function makes the tab area appear in normal
height. I guess this function does not have to be overridden because the low
level implementation should do just fine.

I found a reason for that, in GetTabSize I was returning a tuple like this:

return wx.Size(tab_width, tab_height), x_extent

While the correct return statement should be:

return(tab_width, tab_height), x_extent

So this is fixed.. In any case, none of the drawing methods get called,
as I posted in a message on wxPython-dev here:

http://lists.wxwidgets.org/pipermail/wxpython-dev/2009-February/004088.html

Let's see if the gurus have some suggestions...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets…org/mailman/listinfo/wxpython-users

Hi Tim,

···

On Tue, Feb 3, 2009 at 12:54 PM, Tim Kraemer wrote:

Hi,

so I'm very curious about hearing from the gurus=). I have one question to your small sample app: isn't it better to call self.nb.SetArtProvider() directly after instantiating the AuiNotebook? I've tried some things with changing fonts (not from the frame but inside the AuiTabArt class) and it only worked when SetArtProvider is called before the first tabs/pages are added.

Yes, you're right... something did change, but the drawing methods are
still not called :frowning:

Andrea.

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