8 ID_CreateTree 
= wx
.NewId() 
   9 ID_CreateGrid 
= wx
.NewId() 
  10 ID_CreateText 
= wx
.NewId() 
  11 ID_CreateHTML 
= wx
.NewId() 
  12 ID_CreateSizeReport 
= wx
.NewId() 
  13 ID_GridContent 
= wx
.NewId() 
  14 ID_TextContent 
= wx
.NewId() 
  15 ID_TreeContent 
= wx
.NewId() 
  16 ID_HTMLContent 
= wx
.NewId() 
  17 ID_SizeReportContent 
= wx
.NewId() 
  18 ID_CreatePerspective 
= wx
.NewId() 
  19 ID_CopyPerspective 
= wx
.NewId() 
  21 ID_TransparentHint 
= wx
.NewId() 
  22 ID_VenetianBlindsHint 
= wx
.NewId() 
  23 ID_RectangleHint 
= wx
.NewId() 
  24 ID_NoHint 
= wx
.NewId() 
  25 ID_HintFade 
= wx
.NewId() 
  26 ID_AllowFloating 
= wx
.NewId() 
  27 ID_NoVenetianFade 
= wx
.NewId() 
  28 ID_TransparentDrag 
= wx
.NewId() 
  29 ID_AllowActivePane 
= wx
.NewId() 
  30 ID_NoGradient 
= wx
.NewId() 
  31 ID_VerticalGradient 
= wx
.NewId() 
  32 ID_HorizontalGradient 
= wx
.NewId() 
  34 ID_Settings 
= wx
.NewId() 
  36 ID_FirstPerspective 
= ID_CreatePerspective
+1000 
  40 #---------------------------------------------------------------------- 
  41 def GetMondrianData(): 
  43 '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\ 
  44 \x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00qID\ 
  45 ATX\x85\xed\xd6;\n\x800\x10E\xd1{\xc5\x8d\xb9r\x97\x16\x0b\xad$\x8a\x82:\x16\ 
  46 o\xda\x84pB2\x1f\x81Fa\x8c\x9c\x08\x04Z{\xcf\xa72\xbcv\xfa\xc5\x08 \x80r\x80\ 
  47 \xfc\xa2\x0e\x1c\xe4\xba\xfaX\x1d\xd0\xde]S\x07\x02\xd8>\xe1wa-`\x9fQ\xe9\ 
  48 \x86\x01\x04\x10\x00\\(Dk\x1b-\x04\xdc\x1d\x07\x14\x98;\x0bS\x7f\x7f\xf9\x13\ 
  49 \x04\x10@\xf9X\xbe\x00\xc9 \x14K\xc1<={\x00\x00\x00\x00IEND\xaeB`\x82'  
  52 def GetMondrianBitmap(): 
  53     return wx
.BitmapFromImage(GetMondrianImage()) 
  56 def GetMondrianImage(): 
  57     stream 
= cStringIO
.StringIO(GetMondrianData()) 
  58     return wx
.ImageFromStream(stream
) 
  61 def GetMondrianIcon(): 
  63     icon
.CopyFromBitmap(GetMondrianBitmap()) 
  67 class PyAUIFrame(wx
.Frame
): 
  69     def __init__(self
, parent
, id=-1, title
="", pos
=wx
.DefaultPosition
, 
  70                  size
=wx
.DefaultSize
, style
=wx
.DEFAULT_FRAME_STYLE |
 
  74         wx
.Frame
.__init
__(self
, parent
, id, title
, pos
, size
, style
) 
  76         # tell FrameManager to manage this frame         
  77         self
._mgr 
= wx
.aui
.AuiManager() 
  78         self
._mgr
.SetManagedWindow(self
) 
  80         self
._perspectives 
= [] 
  84         self
.SetIcon(GetMondrianIcon()) 
  90         file_menu
.Append(wx
.ID_EXIT
, "Exit") 
  93         view_menu
.Append(ID_CreateText
, "Create Text Control") 
  94         view_menu
.Append(ID_CreateHTML
, "Create HTML Control") 
  95         view_menu
.Append(ID_CreateTree
, "Create Tree") 
  96         view_menu
.Append(ID_CreateGrid
, "Create Grid") 
  97         view_menu
.Append(ID_CreateSizeReport
, "Create Size Reporter") 
  98         view_menu
.AppendSeparator() 
  99         view_menu
.Append(ID_GridContent
, "Use a Grid for the Content Pane") 
 100         view_menu
.Append(ID_TextContent
, "Use a Text Control for the Content Pane") 
 101         view_menu
.Append(ID_HTMLContent
, "Use an HTML Control for the Content Pane") 
 102         view_menu
.Append(ID_TreeContent
, "Use a Tree Control for the Content Pane") 
 103         view_menu
.Append(ID_SizeReportContent
, "Use a Size Reporter for the Content Pane")     
 105         options_menu 
= wx
.Menu() 
 106         options_menu
.AppendRadioItem(ID_TransparentHint
, "Transparent Hint") 
 107         options_menu
.AppendRadioItem(ID_VenetianBlindsHint
, "Venetian Blinds Hint") 
 108         options_menu
.AppendRadioItem(ID_RectangleHint
, "Rectangle Hint") 
 109         options_menu
.AppendRadioItem(ID_NoHint
, "No Hint") 
 110         options_menu
.AppendSeparator(); 
 111         options_menu
.AppendCheckItem(ID_HintFade
, "Hint Fade-in") 
 112         options_menu
.AppendCheckItem(ID_AllowFloating
, "Allow Floating") 
 113         options_menu
.AppendCheckItem(ID_NoVenetianFade
, "Disable Venetian Blinds Hint Fade-in") 
 114         options_menu
.AppendCheckItem(ID_TransparentDrag
, "Transparent Drag") 
 115         options_menu
.AppendCheckItem(ID_AllowActivePane
, "Allow Active Pane") 
 116         options_menu
.AppendSeparator(); 
 117         options_menu
.AppendRadioItem(ID_NoGradient
, "No Caption Gradient") 
 118         options_menu
.AppendRadioItem(ID_VerticalGradient
, "Vertical Caption Gradient") 
 119         options_menu
.AppendRadioItem(ID_HorizontalGradient
, "Horizontal Caption Gradient") 
 120         options_menu
.AppendSeparator(); 
 121         options_menu
.Append(ID_Settings
, "Settings Pane") 
 123         self
._perspectives
_menu 
= wx
.Menu() 
 124         self
._perspectives
_menu
.Append(ID_CreatePerspective
, "Create Perspective") 
 125         self
._perspectives
_menu
.Append(ID_CopyPerspective
, "Copy Perspective Data To Clipboard") 
 126         self
._perspectives
_menu
.AppendSeparator() 
 127         self
._perspectives
_menu
.Append(ID_FirstPerspective
+0, "Default Startup") 
 128         self
._perspectives
_menu
.Append(ID_FirstPerspective
+1, "All Panes") 
 129         self
._perspectives
_menu
.Append(ID_FirstPerspective
+2, "Vertical Toolbar") 
 131         help_menu 
= wx
.Menu() 
 132         help_menu
.Append(ID_About
, "About...") 
 134         mb
.Append(file_menu
, "File") 
 135         mb
.Append(view_menu
, "View") 
 136         mb
.Append(self
._perspectives
_menu
, "Perspectives") 
 137         mb
.Append(options_menu
, "Options") 
 138         mb
.Append(help_menu
, "Help") 
 142         self
.statusbar 
= self
.CreateStatusBar(2, wx
.ST_SIZEGRIP
) 
 143         self
.statusbar
.SetStatusWidths([-2, -3]) 
 144         self
.statusbar
.SetStatusText("Ready", 0) 
 145         self
.statusbar
.SetStatusText("Welcome To wxPython!", 1) 
 147         # min size for the frame itself isn't completely done. 
 148         # see the end up FrameManager::Update() for the test 
 149         # code. For now, just hard code a frame minimum size 
 150         self
.SetMinSize(wx
.Size(400, 300)) 
 152         # create some toolbars 
 153         tb1 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 154                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 155         tb1
.SetToolBitmapSize(wx
.Size(48,48)) 
 156         tb1
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
)) 
 158         tb1
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 159         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 160         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 161         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 164         tb2 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 165                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 166         tb2
.SetToolBitmapSize(wx
.Size(16,16)) 
 167         tb2_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 168         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 169         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 170         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 171         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 173         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 174         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 176         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 177         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 178         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 179         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 182         tb3 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 183                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 184         tb3
.SetToolBitmapSize(wx
.Size(16,16)) 
 185         tb3_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 186         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 187         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 188         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 189         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 191         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 192         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 195         tb4 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 196                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_HORZ_TEXT
) 
 197         tb4
.SetToolBitmapSize(wx
.Size(16,16)) 
 198         tb4_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 199         tb4
.AddLabelTool(101, "Item 1", tb4_bmp1
) 
 200         tb4
.AddLabelTool(101, "Item 2", tb4_bmp1
) 
 201         tb4
.AddLabelTool(101, "Item 3", tb4_bmp1
) 
 202         tb4
.AddLabelTool(101, "Item 4", tb4_bmp1
) 
 204         tb4
.AddLabelTool(101, "Item 5", tb4_bmp1
) 
 205         tb4
.AddLabelTool(101, "Item 6", tb4_bmp1
) 
 206         tb4
.AddLabelTool(101, "Item 7", tb4_bmp1
) 
 207         tb4
.AddLabelTool(101, "Item 8", tb4_bmp1
) 
 210         tb5 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 211                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_VERTICAL
) 
 212         tb5
.SetToolBitmapSize(wx
.Size(48, 48)) 
 213         tb5
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
))  
 215         tb5
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 216         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 217         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 218         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 221         # add a bunch of panes 
 222         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 223                           Name("test1").Caption("Pane Caption").Top(). 
 224                           CloseButton(True).MaximizeButton(True)) 
 226         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 227                           Name("test2").Caption("Client Size Reporter"). 
 228                           Bottom().Position(1).CloseButton(True).MaximizeButton(True)) 
 230         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 231                           Name("test3").Caption("Client Size Reporter"). 
 232                           Bottom().CloseButton(True).MaximizeButton(True)) 
 234         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 235                           Name("test4").Caption("Pane Caption"). 
 236                           Left().CloseButton(True).MaximizeButton(True)) 
 238         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 239                           Name("test5").Caption("Pane Caption"). 
 240                           Right().CloseButton(True).MaximizeButton(True)) 
 242         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 243                           Name("test6").Caption("Client Size Reporter"). 
 244                           Right().Row(1).CloseButton(True).MaximizeButton(True)) 
 246         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 247                           Name("test7").Caption("Client Size Reporter"). 
 248                           Left().Layer(1).CloseButton(True).MaximizeButton(True)) 
 250         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.AuiPaneInfo(). 
 251                           Name("test8").Caption("Tree Pane"). 
 252                           Left().Layer(1).Position(1).CloseButton(True).MaximizeButton(True)) 
 254         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 255                           Name("test9").Caption("Min Size 200x100"). 
 256                           BestSize(wx
.Size(200,100)).MinSize(wx
.Size(200,100)). 
 257                           Bottom().Layer(1).CloseButton(True).MaximizeButton(True)) 
 259         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.AuiPaneInfo(). 
 260                           Name("test10").Caption("Text Pane"). 
 261                           Bottom().Layer(1).Position(1).CloseButton(True).MaximizeButton(True)) 
 263         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 264                           Name("test11").Caption("Fixed Pane"). 
 265                           Bottom().Layer(1).Position(2).Fixed().CloseButton(True).MaximizeButton(True)) 
 267         self
._mgr
.AddPane(SettingsPanel(self
, self
), wx
.aui
.AuiPaneInfo(). 
 268                           Name("settings").Caption("Dock Manager Settings"). 
 269                           Dockable(False).Float().Hide().CloseButton(True).MaximizeButton(True)) 
 271         # create some center panes 
 273         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.AuiPaneInfo().Name("grid_content"). 
 276         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.AuiPaneInfo().Name("tree_content"). 
 279         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo().Name("sizereport_content"). 
 282         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.AuiPaneInfo().Name("text_content"). 
 285         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.AuiPaneInfo().Name("html_content"). 
 288         # add the toolbars to the manager 
 290         self
._mgr
.AddPane(tb1
, wx
.aui
.AuiPaneInfo(). 
 291                           Name("tb1").Caption("Big Toolbar"). 
 293                           LeftDockable(False).RightDockable(False)) 
 295         self
._mgr
.AddPane(tb2
, wx
.aui
.AuiPaneInfo(). 
 296                           Name("tb2").Caption("Toolbar 2"). 
 297                           ToolbarPane().Top().Row(1). 
 298                           LeftDockable(False).RightDockable(False)) 
 300         self
._mgr
.AddPane(tb3
, wx
.aui
.AuiPaneInfo(). 
 301                           Name("tb3").Caption("Toolbar 3"). 
 302                           ToolbarPane().Top().Row(1).Position(1). 
 303                           LeftDockable(False).RightDockable(False)) 
 305         self
._mgr
.AddPane(tb4
, wx
.aui
.AuiPaneInfo(). 
 306                           Name("tb4").Caption("Sample Bookmark Toolbar"). 
 307                           ToolbarPane().Top().Row(2). 
 308                           LeftDockable(False).RightDockable(False)) 
 310         self
._mgr
.AddPane(tb5
, wx
.aui
.AuiPaneInfo(). 
 311                           Name("tbvert").Caption("Sample Vertical Toolbar"). 
 312                           ToolbarPane().Left().GripperTop(). 
 313                           TopDockable(False).BottomDockable(False)) 
 315         self
._mgr
.AddPane(wx
.Button(self
, -1, "Test Button"), 
 316                           wx
.aui
.AuiPaneInfo().Name("tb5"). 
 317                           ToolbarPane().Top().Row(2).Position(1). 
 318                           LeftDockable(False).RightDockable(False)) 
 320         # make some default perspectives 
 322         self
._mgr
.GetPane("tbvert").Hide() 
 324         perspective_all 
= self
._mgr
.SavePerspective() 
 326         all_panes 
= self
._mgr
.GetAllPanes() 
 328         for ii 
in xrange(len(all_panes
)): 
 329             if not all_panes
[ii
].IsToolbar(): 
 332         self
._mgr
.GetPane("tb1").Hide() 
 333         self
._mgr
.GetPane("tb5").Hide() 
 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_default 
= self
._mgr
.SavePerspective() 
 340         for ii 
in xrange(len(all_panes
)): 
 341             if not all_panes
[ii
].IsToolbar(): 
 344         self
._mgr
.GetPane("tb1").Hide() 
 345         self
._mgr
.GetPane("tb5").Hide() 
 346         self
._mgr
.GetPane("tbvert").Show() 
 347         self
._mgr
.GetPane("grid_content").Show() 
 348         self
._mgr
.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0) 
 349         self
._mgr
.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) 
 350         self
._mgr
.GetPane("html_content").Show() 
 352         perspective_vert 
= self
._mgr
.SavePerspective() 
 354         self
._perspectives
.append(perspective_default
) 
 355         self
._perspectives
.append(perspective_all
) 
 356         self
._perspectives
.append(perspective_vert
) 
 358         self
._mgr
.GetPane("tbvert").Hide() 
 359         self
._mgr
.GetPane("grid_content").Hide() 
 361         # "commit" all changes made to FrameManager    
 364         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 365         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 366         self
.Bind(wx
.EVT_CLOSE
, self
.OnClose
) 
 368         # Show How To Use The Closing Panes Event 
 369         self
.Bind(wx
.aui
.EVT_AUI_PANE_CLOSE
, self
.OnPaneClose
) 
 371         self
.Bind(wx
.EVT_MENU
, self
.OnCreateTree
, id=ID_CreateTree
) 
 372         self
.Bind(wx
.EVT_MENU
, self
.OnCreateGrid
, id=ID_CreateGrid
) 
 373         self
.Bind(wx
.EVT_MENU
, self
.OnCreateText
, id=ID_CreateText
) 
 374         self
.Bind(wx
.EVT_MENU
, self
.OnCreateHTML
, id=ID_CreateHTML
) 
 375         self
.Bind(wx
.EVT_MENU
, self
.OnCreateSizeReport
, id=ID_CreateSizeReport
) 
 376         self
.Bind(wx
.EVT_MENU
, self
.OnCreatePerspective
, id=ID_CreatePerspective
) 
 377         self
.Bind(wx
.EVT_MENU
, self
.OnCopyPerspective
, id=ID_CopyPerspective
) 
 379         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowFloating
) 
 380         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentHint
) 
 381         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_VenetianBlindsHint
) 
 382         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_RectangleHint
) 
 383         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_NoHint
) 
 384         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_HintFade
) 
 385         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_NoVenetianFade
) 
 386         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentDrag
) 
 387         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowActivePane
) 
 389         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_NoGradient
) 
 390         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_VerticalGradient
) 
 391         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_HorizontalGradient
) 
 392         self
.Bind(wx
.EVT_MENU
, self
.OnSettings
, id=ID_Settings
) 
 393         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_GridContent
) 
 394         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TreeContent
) 
 395         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TextContent
) 
 396         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_SizeReportContent
) 
 397         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_HTMLContent
) 
 398         self
.Bind(wx
.EVT_MENU
, self
.OnExit
, id=wx
.ID_EXIT
) 
 399         self
.Bind(wx
.EVT_MENU
, self
.OnAbout
, id=ID_About
) 
 401         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentHint
) 
 402         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_VenetianBlindsHint
) 
 403         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_RectangleHint
) 
 404         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_NoHint
) 
 405         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_HintFade
) 
 406         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_AllowFloating
) 
 407         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_NoVenetianFade
) 
 408         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentDrag
) 
 409         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_AllowActivePane
) 
 410         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_NoGradient
) 
 411         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_VerticalGradient
) 
 412         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_HorizontalGradient
) 
 415         self
.Bind(wx
.EVT_MENU_RANGE
, self
.OnRestorePerspective
, id=ID_FirstPerspective
, 
 416                   id2
=ID_FirstPerspective
+1000) 
 419     def OnPaneClose(self
, event
): 
 421         caption 
= event
.GetPane().caption
 
 423         if caption 
in ["Tree Pane", "Dock Manager Settings", "Fixed Pane"]: 
 424             msg 
= "Are You Sure You Want To Close This Pane?" 
 425             dlg 
= wx
.MessageDialog(self
, msg
, "AUI Question", 
 426                                    wx
.YES_NO | wx
.NO_DEFAULT | wx
.ICON_QUESTION
) 
 428             if dlg
.ShowModal() in [wx
.ID_NO
, wx
.ID_CANCEL
]: 
 433     def OnClose(self
, event
): 
 439     def OnExit(self
, event
): 
 442     def OnAbout(self
, event
): 
 444         msg 
= "wx.aui Demo\n" + \
 
 445               "An advanced window management library for wxWidgets\n" + \
 
 446               "(c) Copyright 2005-2006, Kirix Corporation" 
 447         dlg 
= wx
.MessageDialog(self
, msg
, "About wx.aui Demo", 
 448                                wx
.OK | wx
.ICON_INFORMATION
) 
 453     def GetDockArt(self
): 
 455         return self
._mgr
.GetArtProvider() 
 463     def OnEraseBackground(self
, event
): 
 468     def OnSize(self
, event
): 
 473     def OnSettings(self
, event
): 
 475         # show the settings pane, and float it 
 476         floating_pane 
= self
._mgr
.GetPane("settings").Float().Show() 
 478         if floating_pane
.floating_pos 
== wx
.DefaultPosition
: 
 479             floating_pane
.FloatingPosition(self
.GetStartPosition()) 
 484     def OnGradient(self
, event
): 
 488         if event
.GetId() == ID_NoGradient
: 
 489             gradient 
= wx
.aui
.AUI_GRADIENT_NONE
 
 490         elif event
.GetId() == ID_VerticalGradient
: 
 491             gradient 
= wx
.aui
.AUI_GRADIENT_VERTICAL
 
 492         elif event
.GetId() == ID_HorizontalGradient
: 
 493             gradient 
= wx
.aui
.AUI_GRADIENT_HORIZONTAL
 
 495         self
._mgr
.GetArtProvider().SetMetric(wx
.aui
.AUI_DOCKART_GRADIENT_TYPE
, gradient
) 
 499     def OnManagerFlag(self
, event
): 
 504         if eid 
in [ ID_TransparentHint
, ID_VenetianBlindsHint
, ID_RectangleHint
, ID_NoHint 
]: 
 505             flags 
= self
._mgr
.GetFlags() 
 506             flags 
&= ~wx
.aui
.AUI_MGR_TRANSPARENT_HINT
 
 507             flags 
&= ~wx
.aui
.AUI_MGR_VENETIAN_BLINDS_HINT
 
 508             flags 
&= ~wx
.aui
.AUI_MGR_RECTANGLE_HINT
 
 509             self
._mgr
.SetFlags(flags
) 
 511         if eid 
== ID_AllowFloating
: 
 512             flag 
= wx
.aui
.AUI_MGR_ALLOW_FLOATING
 
 513         elif eid 
== ID_TransparentDrag
: 
 514             flag 
= wx
.aui
.AUI_MGR_TRANSPARENT_DRAG
 
 515         elif eid 
== ID_HintFade
: 
 516             flag 
= wx
.aui
.AUI_MGR_HINT_FADE
 
 517         elif eid 
== ID_NoVenetianFade
: 
 518             flag 
= wx
.aui
.AUI_MGR_NO_VENETIAN_BLINDS_FADE
 
 519         elif eid 
== ID_AllowActivePane
: 
 520             flag 
= wx
.aui
.AUI_MGR_ALLOW_ACTIVE_PANE
 
 521         elif eid 
== ID_TransparentHint
: 
 522             flag 
= wx
.aui
.AUI_MGR_TRANSPARENT_HINT
 
 523         elif eid 
== ID_VenetianBlindsHint
: 
 524             flag 
= wx
.aui
.AUI_MGR_VENETIAN_BLINDS_HINT
 
 525         elif eid 
== ID_RectangleHint
: 
 526             flag 
= wx
.aui
.AUI_MGR_RECTANGLE_HINT
 
 528         self
._mgr
.SetFlags(self
._mgr
.GetFlags() ^ flag
) 
 531     def OnUpdateUI(self
, event
): 
 533         flags 
= self
._mgr
.GetFlags() 
 536         if eid 
== ID_NoGradient
: 
 537             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_DOCKART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_NONE
) 
 539         elif eid 
== ID_VerticalGradient
: 
 540             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_DOCKART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_VERTICAL
) 
 542         elif eid 
== ID_HorizontalGradient
: 
 543             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_DOCKART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_HORIZONTAL
) 
 545         elif eid 
== ID_AllowFloating
: 
 546             event
.Check((flags 
& wx
.aui
.AUI_MGR_ALLOW_FLOATING
) != 0) 
 548         elif eid 
== ID_TransparentDrag
: 
 549             event
.Check((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_DRAG
) != 0) 
 551         elif eid 
== ID_TransparentHint
: 
 552             event
.Check((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_HINT
) != 0) 
 554         elif eid 
== ID_VenetianBlindsHint
: 
 555             event
.Check((flags 
& wx
.aui
.AUI_MGR_VENETIAN_BLINDS_HINT
) != 0) 
 557         elif eid 
== ID_RectangleHint
: 
 558             event
.Check((flags 
& wx
.aui
.AUI_MGR_RECTANGLE_HINT
) != 0) 
 560         elif eid 
== ID_NoHint
: 
 561             event
.Check(((wx
.aui
.AUI_MGR_TRANSPARENT_HINT |
 
 562                           wx
.aui
.AUI_MGR_VENETIAN_BLINDS_HINT |
 
 563                           wx
.aui
.AUI_MGR_RECTANGLE_HINT
) & flags
) == 0) 
 565         elif eid 
== ID_HintFade
: 
 566             event
.Check((flags 
& wx
.aui
.AUI_MGR_HINT_FADE
) != 0); 
 568         elif eid 
== ID_NoVenetianFade
: 
 569             event
.Check((flags 
& wx
.aui
.AUI_MGR_NO_VENETIAN_BLINDS_FADE
) != 0); 
 574     def OnCreatePerspective(self
, event
): 
 576         dlg 
= wx
.TextEntryDialog(self
, "Enter a name for the new perspective:", "AUI Test") 
 578         dlg
.SetValue(("Perspective %d")%(len(self
._perspectives
)+1)) 
 579         if dlg
.ShowModal() != wx
.ID_OK
: 
 582         if len(self
._perspectives
) == 0: 
 583             self
._perspectives
_menu
.AppendSeparator() 
 585         self
._perspectives
_menu
.Append(ID_FirstPerspective 
+ len(self
._perspectives
), dlg
.GetValue()) 
 586         self
._perspectives
.append(self
._mgr
.SavePerspective()) 
 589     def OnCopyPerspective(self
, event
): 
 591         s 
= self
._mgr
.SavePerspective() 
 593         if wx
.TheClipboard
.Open(): 
 595             wx
.TheClipboard
.SetData(wx
.TextDataObject(s
)) 
 596             wx
.TheClipboard
.Close() 
 598     def OnRestorePerspective(self
, event
): 
 600         self
._mgr
.LoadPerspective(self
._perspectives
[event
.GetId() - ID_FirstPerspective
]) 
 603     def GetStartPosition(self
): 
 607         pt 
= self
.ClientToScreen(wx
.Point(0, 0)) 
 609         return wx
.Point(pt
.x 
+ x
, pt
.y 
+ x
) 
 612     def OnCreateTree(self
, event
): 
 613         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.AuiPaneInfo(). 
 614                           Caption("Tree Control"). 
 615                           Float().FloatingPosition(self
.GetStartPosition()). 
 616                           FloatingSize(wx
.Size(150, 300)).CloseButton(True).MaximizeButton(True)) 
 620     def OnCreateGrid(self
, event
): 
 621         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.AuiPaneInfo(). 
 623                           Float().FloatingPosition(self
.GetStartPosition()). 
 624                           FloatingSize(wx
.Size(300, 200)).CloseButton(True).MaximizeButton(True)) 
 628     def OnCreateHTML(self
, event
): 
 629         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.AuiPaneInfo(). 
 630                           Caption("HTML Content"). 
 631                           Float().FloatingPosition(self
.GetStartPosition()). 
 632                           FloatingSize(wx
.Size(300, 200)).CloseButton(True).MaximizeButton(True)) 
 636     def OnCreateText(self
, event
): 
 637         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.AuiPaneInfo(). 
 638                           Caption("Text Control"). 
 639                           Float().FloatingPosition(self
.GetStartPosition()). 
 640                           CloseButton(True).MaximizeButton(True)) 
 644     def OnCreateSizeReport(self
, event
): 
 645         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.AuiPaneInfo(). 
 646                           Caption("Client Size Reporter"). 
 647                           Float().FloatingPosition(self
.GetStartPosition()). 
 648                           CloseButton(True).MaximizeButton(True)) 
 652     def OnChangeContentPane(self
, event
): 
 654         self
._mgr
.GetPane("grid_content").Show(event
.GetId() == ID_GridContent
) 
 655         self
._mgr
.GetPane("text_content").Show(event
.GetId() == ID_TextContent
) 
 656         self
._mgr
.GetPane("tree_content").Show(event
.GetId() == ID_TreeContent
) 
 657         self
._mgr
.GetPane("sizereport_content").Show(event
.GetId() == ID_SizeReportContent
) 
 658         self
._mgr
.GetPane("html_content").Show(event
.GetId() == ID_HTMLContent
) 
 662     def CreateTextCtrl(self
): 
 664         text 
= ("This is text box %d")%(self
.n 
+ 1) 
 666         return wx
.TextCtrl(self
,-1, text
, wx
.Point(0, 0), wx
.Size(150, 90), 
 667                            wx
.NO_BORDER | wx
.TE_MULTILINE
) 
 671     def CreateGrid(self
): 
 673         grid 
= wx
.grid
.Grid(self
, -1, wx
.Point(0, 0), wx
.Size(150, 250), 
 674                             wx
.NO_BORDER | wx
.WANTS_CHARS
) 
 676         grid
.CreateGrid(50, 20) 
 681     def CreateTreeCtrl(self
): 
 683         tree 
= wx
.TreeCtrl(self
, -1, wx
.Point(0, 0), wx
.Size(160, 250), 
 684                            wx
.TR_DEFAULT_STYLE | wx
.NO_BORDER
) 
 686         root 
= tree
.AddRoot("AUI Project") 
 689         imglist 
= wx
.ImageList(16, 16, True, 2) 
 690         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 691         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 692         tree
.AssignImageList(imglist
) 
 694         items
.append(tree
.AppendItem(root
, "Item 1", 0)) 
 695         items
.append(tree
.AppendItem(root
, "Item 2", 0)) 
 696         items
.append(tree
.AppendItem(root
, "Item 3", 0)) 
 697         items
.append(tree
.AppendItem(root
, "Item 4", 0)) 
 698         items
.append(tree
.AppendItem(root
, "Item 5", 0)) 
 700         for ii 
in xrange(len(items
)): 
 703             tree
.AppendItem(id, "Subitem 1", 1) 
 704             tree
.AppendItem(id, "Subitem 2", 1) 
 705             tree
.AppendItem(id, "Subitem 3", 1) 
 706             tree
.AppendItem(id, "Subitem 4", 1) 
 707             tree
.AppendItem(id, "Subitem 5", 1) 
 714     def CreateSizeReportCtrl(self
, width
=80, height
=80): 
 716         ctrl 
= SizeReportCtrl(self
, -1, wx
.DefaultPosition
, 
 717                               wx
.Size(width
, height
), self
._mgr
) 
 721     def CreateHTMLCtrl(self
): 
 722         ctrl 
= wx
.html
.HtmlWindow(self
, -1, wx
.DefaultPosition
, wx
.Size(400, 300)) 
 723         if "gtk2" in wx
.PlatformInfo
: 
 724             ctrl
.SetStandardFonts() 
 725         ctrl
.SetPage(self
.GetIntroText())         
 729     def GetIntroText(self
): 
 733 # -- wx.SizeReportCtrl -- 
 734 # (a utility control that always reports it's client size) 
 736 class SizeReportCtrl(wx
.PyControl
): 
 738     def __init__(self
, parent
, id=wx
.ID_ANY
, pos
=wx
.DefaultPosition
, 
 739                  size
=wx
.DefaultSize
, mgr
=None): 
 741         wx
.PyControl
.__init
__(self
, parent
, id, pos
, size
, wx
.NO_BORDER
) 
 745         self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
) 
 746         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 747         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 750     def OnPaint(self
, event
): 
 752         dc 
= wx
.PaintDC(self
) 
 754         size 
= self
.GetClientSize() 
 755         s 
= ("Size: %d x %d")%(size
.x
, size
.y
) 
 757         dc
.SetFont(wx
.NORMAL_FONT
) 
 758         w
, height 
= dc
.GetTextExtent(s
) 
 760         dc
.SetBrush(wx
.WHITE_BRUSH
) 
 761         dc
.SetPen(wx
.WHITE_PEN
) 
 762         dc
.DrawRectangle(0, 0, size
.x
, size
.y
) 
 763         dc
.SetPen(wx
.LIGHT_GREY_PEN
) 
 764         dc
.DrawLine(0, 0, size
.x
, size
.y
) 
 765         dc
.DrawLine(0, size
.y
, size
.x
, 0) 
 766         dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)) 
 770             pi 
= self
._mgr
.GetPane(self
) 
 772             s 
= ("Layer: %d")%pi
.dock_layer
 
 773             w
, h 
= dc
.GetTextExtent(s
) 
 774             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*1)) 
 776             s 
= ("Dock: %d Row: %d")%(pi
.dock_direction
, pi
.dock_row
) 
 777             w
, h 
= dc
.GetTextExtent(s
) 
 778             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*2)) 
 780             s 
= ("Position: %d")%pi
.dock_pos
 
 781             w
, h 
= dc
.GetTextExtent(s
) 
 782             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*3)) 
 784             s 
= ("Proportion: %d")%pi
.dock_proportion
 
 785             w
, h 
= dc
.GetTextExtent(s
) 
 786             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*4)) 
 789     def OnEraseBackground(self
, event
): 
 790         # intentionally empty 
 794     def OnSize(self
, event
): 
 800 ID_PaneBorderSize 
= wx
.ID_HIGHEST 
+ 1 
 801 ID_SashSize 
= ID_PaneBorderSize 
+ 1 
 802 ID_CaptionSize 
= ID_PaneBorderSize 
+ 2 
 803 ID_BackgroundColor 
= ID_PaneBorderSize 
+ 3 
 804 ID_SashColor 
= ID_PaneBorderSize 
+ 4 
 805 ID_InactiveCaptionColor 
=  ID_PaneBorderSize 
+ 5 
 806 ID_InactiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 6 
 807 ID_InactiveCaptionTextColor 
= ID_PaneBorderSize 
+ 7 
 808 ID_ActiveCaptionColor 
= ID_PaneBorderSize 
+ 8 
 809 ID_ActiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 9 
 810 ID_ActiveCaptionTextColor 
= ID_PaneBorderSize 
+ 10 
 811 ID_BorderColor 
= ID_PaneBorderSize 
+ 11 
 812 ID_GripperColor 
= ID_PaneBorderSize 
+ 12 
 814 class SettingsPanel(wx
.Panel
): 
 816     def __init__(self
, parent
, frame
): 
 818         wx
.Panel
.__init
__(self
, parent
, wx
.ID_ANY
, wx
.DefaultPosition
, 
 823         vert 
= wx
.BoxSizer(wx
.VERTICAL
) 
 825         s1 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 826         self
._border
_size 
= wx
.SpinCtrl(self
, ID_PaneBorderSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 827         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 828         s1
.Add(wx
.StaticText(self
, -1, "Pane Border Size:")) 
 829         s1
.Add(self
._border
_size
) 
 830         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 831         s1
.SetItemMinSize(1, (180, 20)) 
 832         #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 834         s2 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 835         self
._sash
_size 
= wx
.SpinCtrl(self
, ID_SashSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 836         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 837         s2
.Add(wx
.StaticText(self
, -1, "Sash Size:")) 
 838         s2
.Add(self
._sash
_size
) 
 839         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 840         s2
.SetItemMinSize(1, (180, 20)) 
 841         #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 843         s3 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 844         self
._caption
_size 
= wx
.SpinCtrl(self
, ID_CaptionSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 845         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 846         s3
.Add(wx
.StaticText(self
, -1, "Caption Size:")) 
 847         s3
.Add(self
._caption
_size
) 
 848         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 849         s3
.SetItemMinSize(1, (180, 20)) 
 850         #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 852         #vert.Add(1, 1, 1, wx.EXPAND) 
 854         b 
= self
.CreateColorBitmap(wx
.BLACK
) 
 856         s4 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 857         self
._background
_color 
= wx
.BitmapButton(self
, ID_BackgroundColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 858         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 859         s4
.Add(wx
.StaticText(self
, -1, "Background Color:")) 
 860         s4
.Add(self
._background
_color
) 
 861         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 862         s4
.SetItemMinSize(1, (180, 20)) 
 864         s5 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 865         self
._sash
_color 
= wx
.BitmapButton(self
, ID_SashColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 866         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 867         s5
.Add(wx
.StaticText(self
, -1, "Sash Color:")) 
 868         s5
.Add(self
._sash
_color
) 
 869         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 870         s5
.SetItemMinSize(1, (180, 20)) 
 872         s6 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 873         self
._inactive
_caption
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionColor
, b
, 
 874                                                        wx
.DefaultPosition
, wx
.Size(50,25)) 
 875         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 876         s6
.Add(wx
.StaticText(self
, -1, "Normal Caption:")) 
 877         s6
.Add(self
._inactive
_caption
_color
) 
 878         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 879         s6
.SetItemMinSize(1, (180, 20)) 
 881         s7 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 882         self
._inactive
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionGradientColor
, 
 883                                                                 b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 884         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 885         s7
.Add(wx
.StaticText(self
, -1, "Normal Caption Gradient:")) 
 886         s7
.Add(self
._inactive
_caption
_gradient
_color
) 
 887         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 888         s7
.SetItemMinSize(1, (180, 20)) 
 890         s8 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 891         self
._inactive
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionTextColor
, b
, 
 892                                                             wx
.DefaultPosition
, wx
.Size(50,25)) 
 893         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 894         s8
.Add(wx
.StaticText(self
, -1, "Normal Caption Text:")) 
 895         s8
.Add(self
._inactive
_caption
_text
_color
) 
 896         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 897         s8
.SetItemMinSize(1, (180, 20)) 
 899         s9 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 900         self
._active
_caption
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionColor
, b
, 
 901                                                      wx
.DefaultPosition
, wx
.Size(50,25)) 
 902         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 903         s9
.Add(wx
.StaticText(self
, -1, "Active Caption:")) 
 904         s9
.Add(self
._active
_caption
_color
) 
 905         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 906         s9
.SetItemMinSize(1, (180, 20)) 
 908         s10 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 909         self
._active
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionGradientColor
, 
 910                                                               b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 911         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 912         s10
.Add(wx
.StaticText(self
, -1, "Active Caption Gradient:")) 
 913         s10
.Add(self
._active
_caption
_gradient
_color
) 
 914         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 915         s10
.SetItemMinSize(1, (180, 20)) 
 917         s11 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 918         self
._active
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionTextColor
, 
 919                                                           b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 920         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 921         s11
.Add(wx
.StaticText(self
, -1, "Active Caption Text:")) 
 922         s11
.Add(self
._active
_caption
_text
_color
) 
 923         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 924         s11
.SetItemMinSize(1, (180, 20)) 
 926         s12 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 927         self
._border
_color 
= wx
.BitmapButton(self
, ID_BorderColor
, b
, wx
.DefaultPosition
, 
 929         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 930         s12
.Add(wx
.StaticText(self
, -1, "Border Color:")) 
 931         s12
.Add(self
._border
_color
) 
 932         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 933         s12
.SetItemMinSize(1, (180, 20)) 
 935         s13 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 936         self
._gripper
_color 
= wx
.BitmapButton(self
, ID_GripperColor
, b
, wx
.DefaultPosition
, 
 938         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 939         s13
.Add(wx
.StaticText(self
, -1, "Gripper Color:")) 
 940         s13
.Add(self
._gripper
_color
) 
 941         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 942         s13
.SetItemMinSize(1, (180, 20)) 
 944         grid_sizer 
= wx
.GridSizer(0, 2) 
 945         grid_sizer
.SetHGap(5) 
 952         grid_sizer
.Add((1, 1)) 
 961         cont_sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
 962         cont_sizer
.Add(grid_sizer
, 1, wx
.EXPAND | wx
.ALL
, 5) 
 963         self
.SetSizer(cont_sizer
) 
 964         self
.GetSizer().SetSizeHints(self
) 
 966         self
._border
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_DOCKART_PANE_BORDER_SIZE
)) 
 967         self
._sash
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_DOCKART_SASH_SIZE
)) 
 968         self
._caption
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_DOCKART_CAPTION_SIZE
)) 
 972         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnPaneBorderSize
, id=ID_PaneBorderSize
) 
 973         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnSashSize
, id=ID_SashSize
) 
 974         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnCaptionSize
, id=ID_CaptionSize
) 
 975         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BackgroundColor
) 
 976         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_SashColor
) 
 977         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionColor
) 
 978         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionGradientColor
) 
 979         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionTextColor
) 
 980         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionColor
) 
 981         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionGradientColor
) 
 982         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionTextColor
) 
 983         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BorderColor
) 
 984         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_GripperColor
) 
 987     def CreateColorBitmap(self
, c
): 
 988         image 
= wx
.EmptyImage(25, 14) 
 993                 if x 
== 0 or x 
== 24 or y 
== 0 or y 
== 13: 
 996                 image
.SetRGB(x
, y
, pixcol
.Red(), pixcol
.Green(), pixcol
.Blue()) 
 998         return image
.ConvertToBitmap() 
1001     def UpdateColors(self
): 
1003         bk 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_BACKGROUND_COLOUR
) 
1004         self
._background
_color
.SetBitmapLabel(self
.CreateColorBitmap(bk
)) 
1006         cap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_COLOUR
) 
1007         self
._inactive
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(cap
)) 
1009         capgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
) 
1010         self
._inactive
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(capgrad
)) 
1012         captxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
) 
1013         self
._inactive
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(captxt
)) 
1015         acap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_COLOUR
) 
1016         self
._active
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(acap
)) 
1018         acapgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
) 
1019         self
._active
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(acapgrad
)) 
1021         acaptxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
) 
1022         self
._active
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(acaptxt
)) 
1024         sash 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_SASH_COLOUR
) 
1025         self
._sash
_color
.SetBitmapLabel(self
.CreateColorBitmap(sash
)) 
1027         border 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_BORDER_COLOUR
) 
1028         self
._border
_color
.SetBitmapLabel(self
.CreateColorBitmap(border
)) 
1030         gripper 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_DOCKART_GRIPPER_COLOUR
) 
1031         self
._gripper
_color
.SetBitmapLabel(self
.CreateColorBitmap(gripper
)) 
1034     def OnPaneBorderSize(self
, event
): 
1036         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_DOCKART_PANE_BORDER_SIZE
, 
1038         self
._frame
.DoUpdate() 
1041     def OnSashSize(self
, event
): 
1043         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_DOCKART_SASH_SIZE
, 
1045         self
._frame
.DoUpdate() 
1048     def OnCaptionSize(self
, event
): 
1050         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_DOCKART_CAPTION_SIZE
, 
1052         self
._frame
.DoUpdate() 
1055     def OnSetColor(self
, event
): 
1057         dlg 
= wx
.ColourDialog(self
._frame
) 
1059         dlg
.SetTitle("Color Picker") 
1061         if dlg
.ShowModal() != wx
.ID_OK
: 
1065         if event
.GetId() == ID_BackgroundColor
: 
1066             var 
= wx
.aui
.AUI_DOCKART_BACKGROUND_COLOUR
 
1067         elif event
.GetId() == ID_SashColor
: 
1068             var 
= wx
.aui
.AUI_DOCKART_SASH_COLOUR
 
1069         elif event
.GetId() == ID_InactiveCaptionColor
: 
1070             var 
= wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_COLOUR
 
1071         elif event
.GetId() == ID_InactiveCaptionGradientColor
: 
1072             var 
= wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
 
1073         elif event
.GetId() == ID_InactiveCaptionTextColor
: 
1074             var 
= wx
.aui
.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
 
1075         elif event
.GetId() == ID_ActiveCaptionColor
: 
1076             var 
= wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_COLOUR
 
1077         elif event
.GetId() == ID_ActiveCaptionGradientColor
: 
1078             var 
= wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
 
1079         elif event
.GetId() == ID_ActiveCaptionTextColor
: 
1080             var 
= wx
.aui
.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
 
1081         elif event
.GetId() == ID_BorderColor
: 
1082             var 
= wx
.aui
.AUI_DOCKART_BORDER_COLOUR
 
1083         elif event
.GetId() == ID_GripperColor
: 
1084             var 
= wx
.aui
.AUI_DOCKART_GRIPPER_COLOUR
 
1088         self
._frame
.GetDockArt().SetColor(var
, dlg
.GetColourData().GetColour()) 
1089         self
._frame
.DoUpdate() 
1094 #---------------------------------------------------------------------- 
1096 class TestPanel(wx
.Panel
): 
1097     def __init__(self
, parent
, log
): 
1099         wx
.Panel
.__init
__(self
, parent
, -1) 
1100         b 
= wx
.Button(self
, -1, "Show the wx.aui Demo Frame", (50,50)) 
1101         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
1103     def OnButton(self
, evt
): 
1104         frame 
= PyAUIFrame(self
, wx
.ID_ANY
, "wx.aui wxPython Demo", size
=(750, 590)) 
1107 #---------------------------------------------------------------------- 
1109 def runTest(frame
, nb
, log
): 
1110     win 
= TestPanel(nb
, log
) 
1113 #---------------------------------------------------------------------- 
1119 <h3>wx.aui, the Advanced User Interface module</h3> 
1121 <br/><b>Overview</b><br/> 
1123 <p>wx.aui is an Advanced User Interface library for the wxWidgets toolkit  
1124 that allows developers to create high-quality, cross-platform user  
1125 interfaces quickly and easily.</p> 
1127 <p><b>Features</b></p> 
1129 <p>With wx.aui developers can create application frameworks with:</p> 
1132 <li>Native, dockable floating frames</li> 
1133 <li>Perspective saving and loading</li> 
1134 <li>Native toolbars incorporating real-time, "spring-loaded" dragging</li> 
1135 <li>Customizable floating/docking behavior</li> 
1136 <li>Completely customizable look-and-feel</li> 
1137 <li>Optional transparent window effects (while dragging or docking)</li> 
1146 if __name__ 
== '__main__': 
1149     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])