A patch for wxAui in python version

Hi, Andrea:

The aui in python version is very good for me to make customization. I like it. Thanks for your make it avaible!

When I trying it, I found some issues and provide patch in attachment, please review!

The issue are:

  1. When close button is closed in side’s notebook, all page will be closed. The steps maybe:

a) page is removed from notebook firstly

b) call ClosePane(page)

The issue exist from a) -> b), page is removed from notebook, but the notebook_id and dock_direction is forget to be cleared.

  1. DrawFocusRect() is not a member for RendererNative class.

  2. For AuiSimpleTabArt class, when popup the window list, the caption should be get via “page.caption”

I like the SimpleTabArt but I think it is not suitable used for side’s notebook if tab is in bottom, looks very strange.

Thank

Patches:

Index: framemanager.py

···

===================================================================
— framemanager.py (revision 20)
+++ framemanager.py (working copy)
@@ -3997,6 +3997,8 @@
window = notebook.GetPage(0)

           notebook.RemovePage(0)
           info = self.GetPane(window)
  •          info.notebook_id = -1
    
  •          info.dock_direction = AUI_DOCK_NONE
             if info.IsOk():
                # Note: this could change our paneInfo reference ...
    
                self.ClosePane(info)
    

Index: tabart.py

— tabart.py (revision 20)
+++ tabart.py (working copy)
@@ -1120,7 +1120,7 @@

                             selected_textx, selected_texty)

         focusRect.Inflate(2, 2)
  •        wx.RendererNative.Get().DrawFocusRect(wnd, dc, focusRect, 0)
    
  •        #wx.RendererNative.Get().DrawFocusRect(wnd, dc, focusRect, 0)
    
    
       out_button_rect = wx.Rect()       
       # draw close button if necessary
    

@@ -1283,7 +1283,7 @@
for i, page in enumerate(pages):

         if useImages:
  •            menuItem = wx.MenuItem(menuPopup, 1000+i, caption)
    
  •            menuItem = wx.MenuItem(menuPopup, 1000+i, page.caption)
               if page.bitmap:
                   menuItem.SetBitmap(page.bitmap)
    

@@ -1291,7 +1291,7 @@

         else:
  •            menuPopup.AppendCheckItem(1000+i, caption)
    
  •            menuPopup.AppendCheckItem(1000+i, page.caption)
              
           menuPopup.Enable(1000+i, page.enabled)
    

Ken

Hi Ken,

2009/6/29 ken lu:

Hi, Andrea:
The aui in python version is very good for me to make customization. I
like it. Thanks for your make it avaible!
When I trying it, I found some issues and provide patch in attachment,
please review!
The issue are:
1) When close button is closed in side's notebook, all page will be
closed. The steps maybe:
a) page is removed from notebook firstly
b) call ClosePane(page)

    The issue exist from a\) \-> b\), page is removed from notebook, but

the notebook_id and dock_direction is forget to be cleared.
2) DrawFocusRect() is not a member for RendererNative class.
3) For AuiSimpleTabArt class, when popup the window list, the caption
should be get via "page.caption"

I like the SimpleTabArt but I think it is not suitable used for side's

notebook if tab is in bottom, looks very strange.

Thank you for the patches. Anyway, have you created your patches using
AUI from wxPython SVN? From the patches line numbers, it doesn't look
like you used the SVN version. I have applied a slight modification of
your patches, namely:

1) Setting the notebook_id = -1 and dock_direction = AUI_DOCK_NONE in
framemenager should be done only if info.IsOk();
2) I believe that when Robin finds some time, the DrawFocusRect method
will be added to wx.RendererNative in wxPython, so that we can
uncomment the call to DrawFocusRect;
3) The caption in AuiSimpleTabArt is already correct, if you look at
the code this is what I do:

        for i, page in enumerate(pages):

            caption = page.caption

            # if there is no caption, make it a space. This will prevent
            # an assert in the menu code.
            if caption == "":
                caption = " "

            if useImages:
                menuItem = wx.MenuItem(menuPopup, 1000+i, caption)

Thank you for the patches!

Andrea.

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