8 ID_CreateTree 
= wx
.ID_HIGHEST
+1 
   9 ID_CreateGrid 
= ID_CreateTree
+2 
  10 ID_CreateText 
= ID_CreateTree
+3 
  11 ID_CreateHTML 
= ID_CreateTree
+4 
  12 ID_CreateSizeReport 
= ID_CreateTree
+5 
  13 ID_GridContent 
= ID_CreateTree
+6 
  14 ID_TextContent 
= ID_CreateTree
+7 
  15 ID_TreeContent 
= ID_CreateTree
+8 
  16 ID_HTMLContent 
= ID_CreateTree
+9 
  17 ID_SizeReportContent 
= ID_CreateTree
+10 
  18 ID_CreatePerspective 
= ID_CreateTree
+11 
  19 ID_CopyPerspective 
= ID_CreateTree
+12 
  20 ID_AllowFloating 
= ID_CreateTree
+13 
  21 ID_AllowActivePane 
= ID_CreateTree
+14 
  22 ID_TransparentHint 
= ID_CreateTree
+15 
  23 ID_TransparentHintFade 
= ID_CreateTree
+16 
  24 ID_TransparentDrag 
= ID_CreateTree
+17 
  25 ID_NoGradient 
= ID_CreateTree
+18 
  26 ID_VerticalGradient 
= ID_CreateTree
+19 
  27 ID_HorizontalGradient 
= ID_CreateTree
+20 
  28 ID_Settings 
= ID_CreateTree
+21 
  29 ID_About 
= ID_CreateTree
+22 
  30 ID_FirstPerspective 
= ID_CreatePerspective
+1000 
  32 #---------------------------------------------------------------------- 
  33 def GetMondrianData(): 
  35 '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\ 
  36 \x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00qID\ 
  37 ATX\x85\xed\xd6;\n\x800\x10E\xd1{\xc5\x8d\xb9r\x97\x16\x0b\xad$\x8a\x82:\x16\ 
  38 o\xda\x84pB2\x1f\x81Fa\x8c\x9c\x08\x04Z{\xcf\xa72\xbcv\xfa\xc5\x08 \x80r\x80\ 
  39 \xfc\xa2\x0e\x1c\xe4\xba\xfaX\x1d\xd0\xde]S\x07\x02\xd8>\xe1wa-`\x9fQ\xe9\ 
  40 \x86\x01\x04\x10\x00\\(Dk\x1b-\x04\xdc\x1d\x07\x14\x98;\x0bS\x7f\x7f\xf9\x13\ 
  41 \x04\x10@\xf9X\xbe\x00\xc9 \x14K\xc1<={\x00\x00\x00\x00IEND\xaeB`\x82'  
  44 def GetMondrianBitmap(): 
  45     return wx
.BitmapFromImage(GetMondrianImage()) 
  48 def GetMondrianImage(): 
  49     stream 
= cStringIO
.StringIO(GetMondrianData()) 
  50     return wx
.ImageFromStream(stream
) 
  53 def GetMondrianIcon(): 
  55     icon
.CopyFromBitmap(GetMondrianBitmap()) 
  59 class PyAUIFrame(wx
.Frame
): 
  61     def __init__(self
, parent
, id=-1, title
="", pos
=wx
.DefaultPosition
, 
  62                  size
=wx
.DefaultSize
, style
=wx
.DEFAULT_FRAME_STYLE |
 
  66         wx
.Frame
.__init
__(self
, parent
, id, title
, pos
, size
, style
) 
  68         # tell FrameManager to manage this frame         
  69         self
._mgr 
= wx
.aui
.FrameManager() 
  70         self
._mgr
.SetManagedWindow(self
) 
  72         self
._perspectives 
= [] 
  76         self
.SetIcon(GetMondrianIcon()) 
  82         file_menu
.Append(wx
.ID_EXIT
, "Exit") 
  85         view_menu
.Append(ID_CreateText
, "Create Text Control") 
  86         view_menu
.Append(ID_CreateHTML
, "Create HTML Control") 
  87         view_menu
.Append(ID_CreateTree
, "Create Tree") 
  88         view_menu
.Append(ID_CreateGrid
, "Create Grid") 
  89         view_menu
.Append(ID_CreateSizeReport
, "Create Size Reporter") 
  90         view_menu
.AppendSeparator() 
  91         view_menu
.Append(ID_GridContent
, "Use a Grid for the Content Pane") 
  92         view_menu
.Append(ID_TextContent
, "Use a Text Control for the Content Pane") 
  93         view_menu
.Append(ID_HTMLContent
, "Use an HTML Control for the Content Pane") 
  94         view_menu
.Append(ID_TreeContent
, "Use a Tree Control for the Content Pane") 
  95         view_menu
.Append(ID_SizeReportContent
, "Use a Size Reporter for the Content Pane")     
  97         options_menu 
= wx
.Menu() 
  98         options_menu
.AppendCheckItem(ID_AllowFloating
, "Allow Floating") 
  99         options_menu
.AppendCheckItem(ID_TransparentHint
, "Transparent Hint") 
 100         options_menu
.AppendCheckItem(ID_TransparentHintFade
, "Transparent Hint Fade-in") 
 101         options_menu
.AppendCheckItem(ID_TransparentDrag
, "Transparent Drag") 
 102         options_menu
.AppendCheckItem(ID_AllowActivePane
, "Allow Active Pane") 
 103         options_menu
.AppendSeparator() 
 104         options_menu
.AppendRadioItem(ID_NoGradient
, "No Caption Gradient") 
 105         options_menu
.AppendRadioItem(ID_VerticalGradient
, "Vertical Caption Gradient") 
 106         options_menu
.AppendRadioItem(ID_HorizontalGradient
, "Horizontal Caption Gradient") 
 107         options_menu
.AppendSeparator() 
 108         options_menu
.Append(ID_Settings
, "Settings Pane") 
 110         self
._perspectives
_menu 
= wx
.Menu() 
 111         self
._perspectives
_menu
.Append(ID_CreatePerspective
, "Create Perspective") 
 112         self
._perspectives
_menu
.Append(ID_CopyPerspective
, "Copy Perspective Data To Clipboard") 
 113         self
._perspectives
_menu
.AppendSeparator() 
 114         self
._perspectives
_menu
.Append(ID_FirstPerspective
+0, "Default Startup") 
 115         self
._perspectives
_menu
.Append(ID_FirstPerspective
+1, "All Panes") 
 116         self
._perspectives
_menu
.Append(ID_FirstPerspective
+2, "Vertical Toolbar") 
 118         help_menu 
= wx
.Menu() 
 119         help_menu
.Append(ID_About
, "About...") 
 121         mb
.Append(file_menu
, "File") 
 122         mb
.Append(view_menu
, "View") 
 123         mb
.Append(self
._perspectives
_menu
, "Perspectives") 
 124         mb
.Append(options_menu
, "Options") 
 125         mb
.Append(help_menu
, "Help") 
 129         self
.statusbar 
= self
.CreateStatusBar(2, wx
.ST_SIZEGRIP
) 
 130         self
.statusbar
.SetStatusWidths([-2, -3]) 
 131         self
.statusbar
.SetStatusText("Ready", 0) 
 132         self
.statusbar
.SetStatusText("Welcome To wxPython!", 1) 
 134         # min size for the frame itself isn't completely done. 
 135         # see the end up FrameManager::Update() for the test 
 136         # code. For now, just hard code a frame minimum size 
 137         self
.SetMinSize(wx
.Size(400, 300)) 
 139         # create some toolbars 
 140         tb1 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 141                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 142         tb1
.SetToolBitmapSize(wx
.Size(48,48)) 
 143         tb1
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
)) 
 145         tb1
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 146         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 147         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 148         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 151         tb2 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 152                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 153         tb2
.SetToolBitmapSize(wx
.Size(16,16)) 
 154         tb2_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 155         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 156         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 157         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 158         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 160         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 161         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 163         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 164         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 165         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 166         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 169         tb3 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 170                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 171         tb3
.SetToolBitmapSize(wx
.Size(16,16)) 
 172         tb3_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 173         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 174         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 175         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 176         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 178         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 179         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 182         tb4 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 183                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_HORZ_TEXT
) 
 184         tb4
.SetToolBitmapSize(wx
.Size(16,16)) 
 185         tb4_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 186         tb4
.AddLabelTool(101, "Item 1", tb4_bmp1
) 
 187         tb4
.AddLabelTool(101, "Item 2", tb4_bmp1
) 
 188         tb4
.AddLabelTool(101, "Item 3", tb4_bmp1
) 
 189         tb4
.AddLabelTool(101, "Item 4", tb4_bmp1
) 
 191         tb4
.AddLabelTool(101, "Item 5", tb4_bmp1
) 
 192         tb4
.AddLabelTool(101, "Item 6", tb4_bmp1
) 
 193         tb4
.AddLabelTool(101, "Item 7", tb4_bmp1
) 
 194         tb4
.AddLabelTool(101, "Item 8", tb4_bmp1
) 
 197         tb5 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 198                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_VERTICAL
) 
 199         tb5
.SetToolBitmapSize(wx
.Size(48, 48)) 
 200         tb5
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
))  
 202         tb5
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 203         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 204         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 205         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 208         # add a bunch of panes 
 209         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 210                           Name("test1").Caption("Pane Caption").Top()) 
 212         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 213                           Name("test2").Caption("Client Size Reporter"). 
 214                           Bottom().Position(1)) 
 216         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 217                           Name("test3").Caption("Client Size Reporter"). 
 220         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 221                           Name("test4").Caption("Pane Caption"). 
 224         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 225                           Name("test5").Caption("Pane Caption"). 
 228         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 229                           Name("test6").Caption("Client Size Reporter"). 
 232         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 233                           Name("test7").Caption("Client Size Reporter"). 
 236         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo(). 
 237                           Name("test8").Caption("Tree Pane"). 
 238                           Left().Layer(1).Position(1)) 
 240         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 241                           Name("test9").Caption("Min Size 200x100"). 
 242                           BestSize(wx
.Size(200,100)).MinSize(wx
.Size(200,100)). 
 245         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo(). 
 246                           Name("test10").Caption("Text Pane"). 
 247                           Bottom().Layer(1).Position(1)) 
 249         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 250                           Name("test11").Caption("Fixed Pane"). 
 251                           Bottom().Layer(1).Position(2).Fixed()) 
 253         self
._mgr
.AddPane(SettingsPanel(self
, self
), wx
.aui
.PaneInfo(). 
 254                           Name("settings").Caption("Dock Manager Settings"). 
 255                           Dockable(False).Float().Hide()) 
 257         # create some center panes 
 259         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.PaneInfo().Name("grid_content"). 
 262         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo().Name("tree_content"). 
 265         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo().Name("sizereport_content"). 
 268         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo().Name("text_content"). 
 271         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.PaneInfo().Name("html_content"). 
 274         # add the toolbars to the manager 
 276         self
._mgr
.AddPane(tb1
, wx
.aui
.PaneInfo(). 
 277                           Name("tb1").Caption("Big Toolbar"). 
 279                           LeftDockable(False).RightDockable(False)) 
 281         self
._mgr
.AddPane(tb2
, wx
.aui
.PaneInfo(). 
 282                           Name("tb2").Caption("Toolbar 2"). 
 283                           ToolbarPane().Top().Row(1). 
 284                           LeftDockable(False).RightDockable(False)) 
 286         self
._mgr
.AddPane(tb3
, wx
.aui
.PaneInfo(). 
 287                           Name("tb3").Caption("Toolbar 3"). 
 288                           ToolbarPane().Top().Row(1).Position(1). 
 289                           LeftDockable(False).RightDockable(False)) 
 291         self
._mgr
.AddPane(tb4
, wx
.aui
.PaneInfo(). 
 292                           Name("tb4").Caption("Sample Bookmark Toolbar"). 
 293                           ToolbarPane().Top().Row(2). 
 294                           LeftDockable(False).RightDockable(False)) 
 296         self
._mgr
.AddPane(tb5
, wx
.aui
.PaneInfo(). 
 297                           Name("tbvert").Caption("Sample Vertical Toolbar"). 
 298                           ToolbarPane().Left().GripperTop(). 
 299                           TopDockable(False).BottomDockable(False)) 
 301         self
._mgr
.AddPane(wx
.Button(self
, -1, "Test Button"), 
 302                           wx
.aui
.PaneInfo().Name("tb5"). 
 303                           ToolbarPane().Top().Row(2).Position(1). 
 304                           LeftDockable(False).RightDockable(False)) 
 306         # make some default perspectives 
 308         self
._mgr
.GetPane("tbvert").Hide() 
 310         perspective_all 
= self
._mgr
.SavePerspective() 
 312         all_panes 
= self
._mgr
.GetAllPanes() 
 314         for ii 
in xrange(len(all_panes
)): 
 315             if not all_panes
[ii
].IsToolbar(): 
 318         self
._mgr
.GetPane("tb1").Hide() 
 319         self
._mgr
.GetPane("tb5").Hide() 
 320         self
._mgr
.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0) 
 321         self
._mgr
.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) 
 322         self
._mgr
.GetPane("html_content").Show() 
 324         perspective_default 
= self
._mgr
.SavePerspective() 
 326         for ii 
in xrange(len(all_panes
)): 
 327             if not all_panes
[ii
].IsToolbar(): 
 330         self
._mgr
.GetPane("tb1").Hide() 
 331         self
._mgr
.GetPane("tb5").Hide() 
 332         self
._mgr
.GetPane("tbvert").Show() 
 333         self
._mgr
.GetPane("grid_content").Show() 
 334         self
._mgr
.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0) 
 335         self
._mgr
.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) 
 336         self
._mgr
.GetPane("html_content").Show() 
 338         perspective_vert 
= self
._mgr
.SavePerspective() 
 340         self
._perspectives
.append(perspective_default
) 
 341         self
._perspectives
.append(perspective_all
) 
 342         self
._perspectives
.append(perspective_vert
) 
 344         self
._mgr
.GetPane("tbvert").Hide() 
 345         self
._mgr
.GetPane("grid_content").Hide() 
 347         # "commit" all changes made to FrameManager    
 350         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 351         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 352         self
.Bind(wx
.EVT_CLOSE
, self
.OnClose
) 
 354         # Show How To Use The Closing Panes Event 
 355         self
.Bind(wx
.aui
.EVT_AUI_PANEBUTTON
, self
.OnPaneButton
) 
 357         self
.Bind(wx
.EVT_MENU
, self
.OnCreateTree
, id=ID_CreateTree
) 
 358         self
.Bind(wx
.EVT_MENU
, self
.OnCreateGrid
, id=ID_CreateGrid
) 
 359         self
.Bind(wx
.EVT_MENU
, self
.OnCreateText
, id=ID_CreateText
) 
 360         self
.Bind(wx
.EVT_MENU
, self
.OnCreateHTML
, id=ID_CreateHTML
) 
 361         self
.Bind(wx
.EVT_MENU
, self
.OnCreateSizeReport
, id=ID_CreateSizeReport
) 
 362         self
.Bind(wx
.EVT_MENU
, self
.OnCreatePerspective
, id=ID_CreatePerspective
) 
 363         self
.Bind(wx
.EVT_MENU
, self
.OnCopyPerspective
, id=ID_CopyPerspective
) 
 364         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowFloating
) 
 365         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentHint
) 
 366         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentHintFade
) 
 367         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentDrag
) 
 368         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowActivePane
) 
 369         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_NoGradient
) 
 370         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_VerticalGradient
) 
 371         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_HorizontalGradient
) 
 372         self
.Bind(wx
.EVT_MENU
, self
.OnSettings
, id=ID_Settings
) 
 373         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_GridContent
) 
 374         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TreeContent
) 
 375         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TextContent
) 
 376         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_SizeReportContent
) 
 377         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_HTMLContent
) 
 378         self
.Bind(wx
.EVT_MENU
, self
.OnClose
, id=wx
.ID_EXIT
) 
 379         self
.Bind(wx
.EVT_MENU
, self
.OnAbout
, id=ID_About
) 
 381         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_AllowFloating
) 
 382         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentHint
) 
 383         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentHintFade
) 
 384         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentDrag
) 
 385         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_NoGradient
) 
 386         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_VerticalGradient
) 
 387         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_HorizontalGradient
) 
 389         self
.Bind(wx
.EVT_MENU_RANGE
, self
.OnRestorePerspective
, id=ID_FirstPerspective
, 
 390                   id2
=ID_FirstPerspective
+1000) 
 393     def OnPaneButton(self
, event
): 
 395         caption 
= event
.GetPane().caption
 
 397         if caption 
in ["Tree Pane", "Dock Manager Settings", "Fixed Pane"]: 
 398             msg 
= "Are You Sure You Want To Close This Pane?" 
 399             dlg 
= wx
.MessageDialog(self
, msg
, "PyAUI Question", 
 400                                    wx
.YES_NO | wx
.NO_DEFAULT | wx
.CANCEL | wx
.ICON_QUESTION
) 
 402             if dlg
.ShowModal() in [wx
.ID_NO
, wx
.ID_CANCEL
]: 
 411     def OnClose(self
, event
): 
 419     def OnAbout(self
, event
): 
 421         msg 
= "wx.aui Demo\n" + \
 
 422               "An advanced window management library for wxWidgets\n" + \
 
 423               "(c) Copyright 2005-2006, Kirix Corporation" 
 424         dlg 
= wx
.MessageDialog(self
, msg
, "About wx.aui Demo", 
 425                                wx
.OK | wx
.ICON_INFORMATION
) 
 430     def GetDockArt(self
): 
 432         return self
._mgr
.GetArtProvider() 
 440     def OnEraseBackground(self
, event
): 
 445     def OnSize(self
, event
): 
 450     def OnSettings(self
, event
): 
 452         # show the settings pane, and float it 
 453         floating_pane 
= self
._mgr
.GetPane("settings").Float().Show() 
 455         if floating_pane
.floating_pos 
== wx
.DefaultPosition
: 
 456             floating_pane
.FloatingPosition(self
.GetStartPosition()) 
 461     def OnGradient(self
, event
): 
 465         if event
.GetId() == ID_NoGradient
: 
 466             gradient 
= wx
.aui
.AUI_GRADIENT_NONE
 
 467         elif event
.GetId() == ID_VerticalGradient
: 
 468             gradient 
= wx
.aui
.AUI_GRADIENT_VERTICAL
 
 469         elif event
.GetId() == ID_HorizontalGradient
: 
 470             gradient 
= wx
.aui
.AUI_GRADIENT_HORIZONTAL
 
 472         self
._mgr
.GetArtProvider().SetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
, gradient
) 
 476     def OnManagerFlag(self
, event
): 
 480 ##         if wx.Platform != "__WXMSW__" and wx.Platform != '__WXMAC__': 
 481 ##             if event.GetId() == ID_TransparentDrag or \ 
 482 ##                event.GetId() == ID_TransparentHint or \ 
 483 ##                event.GetId() == ID_TransparentHintFade: 
 485 ##                 wx.MessageBox("This option is presently only available on wxMSW and wxMac") 
 488         if event
.GetId() == ID_AllowFloating
: 
 489             flag 
= wx
.aui
.AUI_MGR_ALLOW_FLOATING
 
 491         elif event
.GetId() == ID_TransparentDrag
: 
 492             flag 
= wx
.aui
.AUI_MGR_TRANSPARENT_DRAG
 
 494         elif event
.GetId() == ID_TransparentHint
: 
 495             flag 
= wx
.aui
.AUI_MGR_TRANSPARENT_HINT
 
 497         elif event
.GetId() == ID_TransparentHintFade
: 
 498             flag 
= wx
.aui
.AUI_MGR_TRANSPARENT_HINT_FADE
 
 500         elif event
.GetId() == ID_AllowActivePane
: 
 501             flag 
= wx
.aui
.AUI_MGR_ALLOW_ACTIVE_PANE
 
 503         self
._mgr
.SetFlags(self
._mgr
.GetFlags() ^ flag
) 
 506     def OnUpdateUI(self
, event
): 
 508         flags 
= self
._mgr
.GetFlags() 
 510         if event
.GetId() == ID_NoGradient
: 
 511             event
.Check(((self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_NONE
) and \
 
 512                         [True] or [False])[0]) 
 514         elif event
.GetId() == ID_VerticalGradient
: 
 515             event
.Check(((self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_VERTICAL
) and \
 
 516                         [True] or [False])[0]) 
 518         elif event
.GetId() == ID_HorizontalGradient
: 
 519             event
.Check(((self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_HORIZONTAL
) and \
 
 520                         [True] or [False])[0]) 
 522         elif event
.GetId() == ID_AllowFloating
: 
 523             event
.Check(((flags 
& wx
.aui
.AUI_MGR_ALLOW_FLOATING
) and [True] or [False])[0]) 
 525         elif event
.GetId() == ID_TransparentDrag
: 
 526             event
.Check(((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_DRAG
) and [True] or [False])[0]) 
 528         elif event
.GetId() == ID_TransparentHint
: 
 529             event
.Check(((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_HINT
) and [True] or [False])[0]) 
 531         elif event
.GetId() == ID_TransparentHintFade
: 
 532             event
.Check(((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_HINT_FADE
) and [True] or [False])[0]) 
 535     def OnCreatePerspective(self
, event
): 
 537         dlg 
= wx
.TextEntryDialog(self
, "Enter a name for the new perspective:", "AUI Test") 
 539         dlg
.SetValue(("Perspective %d")%(len(self
._perspectives
)+1)) 
 540         if dlg
.ShowModal() != wx
.ID_OK
: 
 543         if len(self
._perspectives
) == 0: 
 544             self
._perspectives
_menu
.AppendSeparator() 
 546         self
._perspectives
_menu
.Append(ID_FirstPerspective 
+ len(self
._perspectives
), dlg
.GetValue()) 
 547         self
._perspectives
.append(self
._mgr
.SavePerspective()) 
 550     def OnCopyPerspective(self
, event
): 
 552         s 
= self
._mgr
.SavePerspective() 
 554         if wx
.TheClipboard
.Open(): 
 556             wx
.TheClipboard
.SetData(wx
.TextDataObject(s
)) 
 557             wx
.TheClipboard
.Close() 
 559     def OnRestorePerspective(self
, event
): 
 561         self
._mgr
.LoadPerspective(self
._perspectives
[event
.GetId() - ID_FirstPerspective
]) 
 564     def GetStartPosition(self
): 
 568         pt 
= self
.ClientToScreen(wx
.Point(0, 0)) 
 570         return wx
.Point(pt
.x 
+ x
, pt
.y 
+ x
) 
 573     def OnCreateTree(self
, event
): 
 575         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo(). 
 576                           Name("Test").Caption("Tree Control"). 
 577                           Float().FloatingPosition(self
.GetStartPosition()). 
 578                           FloatingSize(wx
.Size(150, 300))) 
 582     def OnCreateGrid(self
, event
): 
 584         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.PaneInfo(). 
 585                           Name("Test").Caption("Grid"). 
 586                           Float().FloatingPosition(self
.GetStartPosition()). 
 587                           FloatingSize(wx
.Size(300, 200))) 
 591     def OnCreateHTML(self
, event
): 
 593         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.PaneInfo(). 
 594                           Name("Test").Caption("HTML Content"). 
 595                           Float().FloatingPosition(self
.GetStartPosition()). 
 596                           FloatingSize(wx
.Size(300, 200))) 
 600     def OnCreateText(self
, event
): 
 602         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo(). 
 603                           Name("Test").Caption("Text Control"). 
 604                           Float().FloatingPosition(self
.GetStartPosition())) 
 608     def OnCreateSizeReport(self
, event
): 
 610         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 611                           Name("Test").Caption("Client Size Reporter"). 
 612                           Float().FloatingPosition(self
.GetStartPosition())) 
 616     def OnChangeContentPane(self
, event
): 
 618         self
._mgr
.GetPane("grid_content").Show(event
.GetId() == ID_GridContent
) 
 619         self
._mgr
.GetPane("text_content").Show(event
.GetId() == ID_TextContent
) 
 620         self
._mgr
.GetPane("tree_content").Show(event
.GetId() == ID_TreeContent
) 
 621         self
._mgr
.GetPane("sizereport_content").Show(event
.GetId() == ID_SizeReportContent
) 
 622         self
._mgr
.GetPane("html_content").Show(event
.GetId() == ID_HTMLContent
) 
 626     def CreateTextCtrl(self
): 
 628         text 
= ("This is text box %d")%(self
.n 
+ 1) 
 630         return wx
.TextCtrl(self
,-1, text
, wx
.Point(0, 0), wx
.Size(150, 90), 
 631                            wx
.NO_BORDER | wx
.TE_MULTILINE
) 
 635     def CreateGrid(self
): 
 637         grid 
= wx
.grid
.Grid(self
, -1, wx
.Point(0, 0), wx
.Size(150, 250), 
 638                             wx
.NO_BORDER | wx
.WANTS_CHARS
) 
 640         grid
.CreateGrid(50, 20) 
 645     def CreateTreeCtrl(self
): 
 647         tree 
= wx
.TreeCtrl(self
, -1, wx
.Point(0, 0), wx
.Size(160, 250), 
 648                            wx
.TR_DEFAULT_STYLE | wx
.NO_BORDER
) 
 650         root 
= tree
.AddRoot("PyAUI Project") 
 653         imglist 
= wx
.ImageList(16, 16, True, 2) 
 654         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 655         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 656         tree
.AssignImageList(imglist
) 
 658         items
.append(tree
.AppendItem(root
, "Item 1", 0)) 
 659         items
.append(tree
.AppendItem(root
, "Item 2", 0)) 
 660         items
.append(tree
.AppendItem(root
, "Item 3", 0)) 
 661         items
.append(tree
.AppendItem(root
, "Item 4", 0)) 
 662         items
.append(tree
.AppendItem(root
, "Item 5", 0)) 
 664         for ii 
in xrange(len(items
)): 
 667             tree
.AppendItem(id, "Subitem 1", 1) 
 668             tree
.AppendItem(id, "Subitem 2", 1) 
 669             tree
.AppendItem(id, "Subitem 3", 1) 
 670             tree
.AppendItem(id, "Subitem 4", 1) 
 671             tree
.AppendItem(id, "Subitem 5", 1) 
 678     def CreateSizeReportCtrl(self
, width
=80, height
=80): 
 680         ctrl 
= SizeReportCtrl(self
, -1, wx
.DefaultPosition
, 
 681                               wx
.Size(width
, height
), self
._mgr
) 
 685     def CreateHTMLCtrl(self
): 
 686         ctrl 
= wx
.html
.HtmlWindow(self
, -1, wx
.DefaultPosition
, wx
.Size(400, 300)) 
 687         if "gtk2" in wx
.PlatformInfo
: 
 688             ctrl
.SetStandardFonts() 
 689         ctrl
.SetPage(self
.GetIntroText())         
 693     def GetIntroText(self
): 
 697 # -- wx.SizeReportCtrl -- 
 698 # (a utility control that always reports it's client size) 
 700 class SizeReportCtrl(wx
.PyControl
): 
 702     def __init__(self
, parent
, id=wx
.ID_ANY
, pos
=wx
.DefaultPosition
, 
 703                  size
=wx
.DefaultSize
, mgr
=None): 
 705         wx
.PyControl
.__init
__(self
, parent
, id, pos
, size
, wx
.NO_BORDER
) 
 709         self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
) 
 710         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 711         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 714     def OnPaint(self
, event
): 
 716         dc 
= wx
.PaintDC(self
) 
 718         size 
= self
.GetClientSize() 
 719         s 
= ("Size: %d x %d")%(size
.x
, size
.y
) 
 721         dc
.SetFont(wx
.NORMAL_FONT
) 
 722         w
, height 
= dc
.GetTextExtent(s
) 
 724         dc
.SetBrush(wx
.WHITE_BRUSH
) 
 725         dc
.SetPen(wx
.WHITE_PEN
) 
 726         dc
.DrawRectangle(0, 0, size
.x
, size
.y
) 
 727         dc
.SetPen(wx
.LIGHT_GREY_PEN
) 
 728         dc
.DrawLine(0, 0, size
.x
, size
.y
) 
 729         dc
.DrawLine(0, size
.y
, size
.x
, 0) 
 730         dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)) 
 734             pi 
= self
._mgr
.GetPane(self
) 
 736             s 
= ("Layer: %d")%pi
.dock_layer
 
 737             w
, h 
= dc
.GetTextExtent(s
) 
 738             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*1)) 
 740             s 
= ("Dock: %d Row: %d")%(pi
.dock_direction
, pi
.dock_row
) 
 741             w
, h 
= dc
.GetTextExtent(s
) 
 742             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*2)) 
 744             s 
= ("Position: %d")%pi
.dock_pos
 
 745             w
, h 
= dc
.GetTextExtent(s
) 
 746             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*3)) 
 748             s 
= ("Proportion: %d")%pi
.dock_proportion
 
 749             w
, h 
= dc
.GetTextExtent(s
) 
 750             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*4)) 
 753     def OnEraseBackground(self
, event
): 
 754         # intentionally empty 
 758     def OnSize(self
, event
): 
 764 ID_PaneBorderSize 
= wx
.ID_HIGHEST 
+ 1 
 765 ID_SashSize 
= ID_PaneBorderSize 
+ 1 
 766 ID_CaptionSize 
= ID_PaneBorderSize 
+ 2 
 767 ID_BackgroundColor 
= ID_PaneBorderSize 
+ 3 
 768 ID_SashColor 
= ID_PaneBorderSize 
+ 4 
 769 ID_InactiveCaptionColor 
=  ID_PaneBorderSize 
+ 5 
 770 ID_InactiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 6 
 771 ID_InactiveCaptionTextColor 
= ID_PaneBorderSize 
+ 7 
 772 ID_ActiveCaptionColor 
= ID_PaneBorderSize 
+ 8 
 773 ID_ActiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 9 
 774 ID_ActiveCaptionTextColor 
= ID_PaneBorderSize 
+ 10 
 775 ID_BorderColor 
= ID_PaneBorderSize 
+ 11 
 776 ID_GripperColor 
= ID_PaneBorderSize 
+ 12 
 778 class SettingsPanel(wx
.Panel
): 
 780     def __init__(self
, parent
, frame
): 
 782         wx
.Panel
.__init
__(self
, parent
, wx
.ID_ANY
, wx
.DefaultPosition
, 
 787         vert 
= wx
.BoxSizer(wx
.VERTICAL
) 
 789         s1 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 790         self
._border
_size 
= wx
.SpinCtrl(self
, ID_PaneBorderSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 791         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 792         s1
.Add(wx
.StaticText(self
, -1, "Pane Border Size:")) 
 793         s1
.Add(self
._border
_size
) 
 794         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 795         s1
.SetItemMinSize(1, (180, 20)) 
 796         #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 798         s2 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 799         self
._sash
_size 
= wx
.SpinCtrl(self
, ID_SashSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 800         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 801         s2
.Add(wx
.StaticText(self
, -1, "Sash Size:")) 
 802         s2
.Add(self
._sash
_size
) 
 803         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 804         s2
.SetItemMinSize(1, (180, 20)) 
 805         #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 807         s3 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 808         self
._caption
_size 
= wx
.SpinCtrl(self
, ID_CaptionSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 809         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 810         s3
.Add(wx
.StaticText(self
, -1, "Caption Size:")) 
 811         s3
.Add(self
._caption
_size
) 
 812         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 813         s3
.SetItemMinSize(1, (180, 20)) 
 814         #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 816         #vert.Add(1, 1, 1, wx.EXPAND) 
 818         b 
= self
.CreateColorBitmap(wx
.BLACK
) 
 820         s4 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 821         self
._background
_color 
= wx
.BitmapButton(self
, ID_BackgroundColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 822         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 823         s4
.Add(wx
.StaticText(self
, -1, "Background Color:")) 
 824         s4
.Add(self
._background
_color
) 
 825         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 826         s4
.SetItemMinSize(1, (180, 20)) 
 828         s5 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 829         self
._sash
_color 
= wx
.BitmapButton(self
, ID_SashColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 830         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 831         s5
.Add(wx
.StaticText(self
, -1, "Sash Color:")) 
 832         s5
.Add(self
._sash
_color
) 
 833         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 834         s5
.SetItemMinSize(1, (180, 20)) 
 836         s6 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 837         self
._inactive
_caption
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionColor
, b
, 
 838                                                        wx
.DefaultPosition
, wx
.Size(50,25)) 
 839         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 840         s6
.Add(wx
.StaticText(self
, -1, "Normal Caption:")) 
 841         s6
.Add(self
._inactive
_caption
_color
) 
 842         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 843         s6
.SetItemMinSize(1, (180, 20)) 
 845         s7 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 846         self
._inactive
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionGradientColor
, 
 847                                                                 b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 848         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 849         s7
.Add(wx
.StaticText(self
, -1, "Normal Caption Gradient:")) 
 850         s7
.Add(self
._inactive
_caption
_gradient
_color
) 
 851         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 852         s7
.SetItemMinSize(1, (180, 20)) 
 854         s8 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 855         self
._inactive
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionTextColor
, b
, 
 856                                                             wx
.DefaultPosition
, wx
.Size(50,25)) 
 857         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 858         s8
.Add(wx
.StaticText(self
, -1, "Normal Caption Text:")) 
 859         s8
.Add(self
._inactive
_caption
_text
_color
) 
 860         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 861         s8
.SetItemMinSize(1, (180, 20)) 
 863         s9 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 864         self
._active
_caption
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionColor
, b
, 
 865                                                      wx
.DefaultPosition
, wx
.Size(50,25)) 
 866         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 867         s9
.Add(wx
.StaticText(self
, -1, "Active Caption:")) 
 868         s9
.Add(self
._active
_caption
_color
) 
 869         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 870         s9
.SetItemMinSize(1, (180, 20)) 
 872         s10 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 873         self
._active
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionGradientColor
, 
 874                                                               b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 875         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 876         s10
.Add(wx
.StaticText(self
, -1, "Active Caption Gradient:")) 
 877         s10
.Add(self
._active
_caption
_gradient
_color
) 
 878         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 879         s10
.SetItemMinSize(1, (180, 20)) 
 881         s11 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 882         self
._active
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionTextColor
, 
 883                                                           b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 884         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 885         s11
.Add(wx
.StaticText(self
, -1, "Active Caption Text:")) 
 886         s11
.Add(self
._active
_caption
_text
_color
) 
 887         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 888         s11
.SetItemMinSize(1, (180, 20)) 
 890         s12 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 891         self
._border
_color 
= wx
.BitmapButton(self
, ID_BorderColor
, b
, wx
.DefaultPosition
, 
 893         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 894         s12
.Add(wx
.StaticText(self
, -1, "Border Color:")) 
 895         s12
.Add(self
._border
_color
) 
 896         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 897         s12
.SetItemMinSize(1, (180, 20)) 
 899         s13 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 900         self
._gripper
_color 
= wx
.BitmapButton(self
, ID_GripperColor
, b
, wx
.DefaultPosition
, 
 902         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 903         s13
.Add(wx
.StaticText(self
, -1, "Gripper Color:")) 
 904         s13
.Add(self
._gripper
_color
) 
 905         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 906         s13
.SetItemMinSize(1, (180, 20)) 
 908         grid_sizer 
= wx
.GridSizer(0, 2) 
 909         grid_sizer
.SetHGap(5) 
 916         grid_sizer
.Add((1, 1)) 
 925         cont_sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
 926         cont_sizer
.Add(grid_sizer
, 1, wx
.EXPAND | wx
.ALL
, 5) 
 927         self
.SetSizer(cont_sizer
) 
 928         self
.GetSizer().SetSizeHints(self
) 
 930         self
._border
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_PANE_BORDER_SIZE
)) 
 931         self
._sash
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_SASH_SIZE
)) 
 932         self
._caption
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_CAPTION_SIZE
)) 
 936         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnPaneBorderSize
, id=ID_PaneBorderSize
) 
 937         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnSashSize
, id=ID_SashSize
) 
 938         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnCaptionSize
, id=ID_CaptionSize
) 
 939         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BackgroundColor
) 
 940         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_SashColor
) 
 941         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionColor
) 
 942         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionGradientColor
) 
 943         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionTextColor
) 
 944         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionColor
) 
 945         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionGradientColor
) 
 946         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionTextColor
) 
 947         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BorderColor
) 
 948         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_GripperColor
) 
 951     def CreateColorBitmap(self
, c
): 
 952         image 
= wx
.EmptyImage(25, 14) 
 957                 if x 
== 0 or x 
== 24 or y 
== 0 or y 
== 13: 
 960                 image
.SetRGB(x
, y
, pixcol
.Red(), pixcol
.Green(), pixcol
.Blue()) 
 962         return image
.ConvertToBitmap() 
 965     def UpdateColors(self
): 
 967         bk 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_BACKGROUND_COLOUR
) 
 968         self
._background
_color
.SetBitmapLabel(self
.CreateColorBitmap(bk
)) 
 970         cap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_COLOUR
) 
 971         self
._inactive
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(cap
)) 
 973         capgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
) 
 974         self
._inactive
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(capgrad
)) 
 976         captxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
) 
 977         self
._inactive
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(captxt
)) 
 979         acap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_COLOUR
) 
 980         self
._active
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(acap
)) 
 982         acapgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
) 
 983         self
._active
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(acapgrad
)) 
 985         acaptxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
) 
 986         self
._active
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(acaptxt
)) 
 988         sash 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_SASH_COLOUR
) 
 989         self
._sash
_color
.SetBitmapLabel(self
.CreateColorBitmap(sash
)) 
 991         border 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_BORDER_COLOUR
) 
 992         self
._border
_color
.SetBitmapLabel(self
.CreateColorBitmap(border
)) 
 994         gripper 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_GRIPPER_COLOUR
) 
 995         self
._gripper
_color
.SetBitmapLabel(self
.CreateColorBitmap(gripper
)) 
 998     def OnPaneBorderSize(self
, event
): 
1000         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_PANE_BORDER_SIZE
, 
1002         self
._frame
.DoUpdate() 
1005     def OnSashSize(self
, event
): 
1007         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_SASH_SIZE
, 
1009         self
._frame
.DoUpdate() 
1012     def OnCaptionSize(self
, event
): 
1014         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_CAPTION_SIZE
, 
1016         self
._frame
.DoUpdate() 
1019     def OnSetColor(self
, event
): 
1021         dlg 
= wx
.ColourDialog(self
._frame
) 
1023         dlg
.SetTitle("Color Picker") 
1025         if dlg
.ShowModal() != wx
.ID_OK
: 
1029         if event
.GetId() == ID_BackgroundColor
: 
1030             var 
= wx
.aui
.AUI_ART_BACKGROUND_COLOUR
 
1031         elif event
.GetId() == ID_SashColor
: 
1032             var 
= wx
.aui
.AUI_ART_SASH_COLOUR
 
1033         elif event
.GetId() == ID_InactiveCaptionColor
: 
1034             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_COLOUR
 
1035         elif event
.GetId() == ID_InactiveCaptionGradientColor
: 
1036             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
 
1037         elif event
.GetId() == ID_InactiveCaptionTextColor
: 
1038             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
 
1039         elif event
.GetId() == ID_ActiveCaptionColor
: 
1040             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_COLOUR
 
1041         elif event
.GetId() == ID_ActiveCaptionGradientColor
: 
1042             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
 
1043         elif event
.GetId() == ID_ActiveCaptionTextColor
: 
1044             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
 
1045         elif event
.GetId() == ID_BorderColor
: 
1046             var 
= wx
.aui
.AUI_ART_BORDER_COLOUR
 
1047         elif event
.GetId() == ID_GripperColor
: 
1048             var 
= wx
.aui
.AUI_ART_GRIPPER_COLOUR
 
1052         self
._frame
.GetDockArt().SetColor(var
, dlg
.GetColourData().GetColour()) 
1053         self
._frame
.DoUpdate() 
1058 #---------------------------------------------------------------------- 
1060 class TestPanel(wx
.Panel
): 
1061     def __init__(self
, parent
, log
): 
1063         wx
.Panel
.__init
__(self
, parent
, -1) 
1064         b 
= wx
.Button(self
, -1, "Show the wx.aui Demo Frame", (50,50)) 
1065         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
1067     def OnButton(self
, evt
): 
1068         frame 
= PyAUIFrame(self
, wx
.ID_ANY
, "wx.aui wxPython Demo", size
=(750, 590)) 
1071 #---------------------------------------------------------------------- 
1073 def runTest(frame
, nb
, log
): 
1074     win 
= TestPanel(nb
, log
) 
1077 #---------------------------------------------------------------------- 
1083 <h3>wx.aui, the Advanced User Interface module</h3> 
1085 <br/><b>Overview</b><br/> 
1087 <p>wx.aui is an Advanced User Interface library for the wxWidgets toolkit  
1088 that allows developers to create high-quality, cross-platform user  
1089 interfaces quickly and easily.</p> 
1091 <p><b>Features</b></p> 
1093 <p>With wx.aui developers can create application frameworks with:</p> 
1096 <li>Native, dockable floating frames</li> 
1097 <li>Perspective saving and loading</li> 
1098 <li>Native toolbars incorporating real-time, "spring-loaded" dragging</li> 
1099 <li>Customizable floating/docking behavior</li> 
1100 <li>Completely customizable look-and-feel</li> 
1101 <li>Optional transparent window effects (while dragging or docking)</li> 
1110 if __name__ 
== '__main__': 
1113     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])