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() 
  20 ID_AllowFloating 
= wx
.NewId() 
  21 ID_AllowActivePane 
= wx
.NewId() 
  22 ID_TransparentHint 
= wx
.NewId() 
  23 ID_TransparentHintFade 
= wx
.NewId() 
  24 ID_TransparentDrag 
= wx
.NewId() 
  25 ID_DisableVenetianBlinds 
= wx
.NewId() 
  26 ID_DisableVenetianBlindsFade 
= wx
.NewId() 
  27 ID_NoGradient 
= wx
.NewId() 
  28 ID_VerticalGradient 
= wx
.NewId() 
  29 ID_HorizontalGradient 
= wx
.NewId() 
  30 ID_Settings 
= wx
.NewId() 
  32 ID_FirstPerspective 
= ID_CreatePerspective
+1000 
  34 #---------------------------------------------------------------------- 
  35 def GetMondrianData(): 
  37 '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\ 
  38 \x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\x00qID\ 
  39 ATX\x85\xed\xd6;\n\x800\x10E\xd1{\xc5\x8d\xb9r\x97\x16\x0b\xad$\x8a\x82:\x16\ 
  40 o\xda\x84pB2\x1f\x81Fa\x8c\x9c\x08\x04Z{\xcf\xa72\xbcv\xfa\xc5\x08 \x80r\x80\ 
  41 \xfc\xa2\x0e\x1c\xe4\xba\xfaX\x1d\xd0\xde]S\x07\x02\xd8>\xe1wa-`\x9fQ\xe9\ 
  42 \x86\x01\x04\x10\x00\\(Dk\x1b-\x04\xdc\x1d\x07\x14\x98;\x0bS\x7f\x7f\xf9\x13\ 
  43 \x04\x10@\xf9X\xbe\x00\xc9 \x14K\xc1<={\x00\x00\x00\x00IEND\xaeB`\x82'  
  46 def GetMondrianBitmap(): 
  47     return wx
.BitmapFromImage(GetMondrianImage()) 
  50 def GetMondrianImage(): 
  51     stream 
= cStringIO
.StringIO(GetMondrianData()) 
  52     return wx
.ImageFromStream(stream
) 
  55 def GetMondrianIcon(): 
  57     icon
.CopyFromBitmap(GetMondrianBitmap()) 
  61 class PyAUIFrame(wx
.Frame
): 
  63     def __init__(self
, parent
, id=-1, title
="", pos
=wx
.DefaultPosition
, 
  64                  size
=wx
.DefaultSize
, style
=wx
.DEFAULT_FRAME_STYLE |
 
  68         wx
.Frame
.__init
__(self
, parent
, id, title
, pos
, size
, style
) 
  70         # tell FrameManager to manage this frame         
  71         self
._mgr 
= wx
.aui
.FrameManager() 
  72         self
._mgr
.SetManagedWindow(self
) 
  74         self
._perspectives 
= [] 
  78         self
.SetIcon(GetMondrianIcon()) 
  84         file_menu
.Append(wx
.ID_EXIT
, "Exit") 
  87         view_menu
.Append(ID_CreateText
, "Create Text Control") 
  88         view_menu
.Append(ID_CreateHTML
, "Create HTML Control") 
  89         view_menu
.Append(ID_CreateTree
, "Create Tree") 
  90         view_menu
.Append(ID_CreateGrid
, "Create Grid") 
  91         view_menu
.Append(ID_CreateSizeReport
, "Create Size Reporter") 
  92         view_menu
.AppendSeparator() 
  93         view_menu
.Append(ID_GridContent
, "Use a Grid for the Content Pane") 
  94         view_menu
.Append(ID_TextContent
, "Use a Text Control for the Content Pane") 
  95         view_menu
.Append(ID_HTMLContent
, "Use an HTML Control for the Content Pane") 
  96         view_menu
.Append(ID_TreeContent
, "Use a Tree Control for the Content Pane") 
  97         view_menu
.Append(ID_SizeReportContent
, "Use a Size Reporter for the Content Pane")     
  99         options_menu 
= wx
.Menu() 
 100         options_menu
.AppendCheckItem(ID_AllowFloating
, "Allow Floating") 
 101         options_menu
.AppendCheckItem(ID_TransparentHint
, "Transparent Hint") 
 102         options_menu
.AppendCheckItem(ID_TransparentHintFade
, "Transparent Hint Fade-in") 
 103         options_menu
.AppendCheckItem(ID_TransparentDrag
, "Transparent Drag") 
 104         options_menu
.AppendCheckItem(ID_DisableVenetianBlinds
, "Disable Venetian Blinds Effect") 
 105         options_menu
.AppendCheckItem(ID_DisableVenetianBlindsFade
, "Disable Venetian Blinds Fade-in") 
 106         options_menu
.AppendCheckItem(ID_AllowActivePane
, "Allow Active Pane") 
 107         options_menu
.AppendSeparator() 
 108         options_menu
.AppendRadioItem(ID_NoGradient
, "No Caption Gradient") 
 109         options_menu
.AppendRadioItem(ID_VerticalGradient
, "Vertical Caption Gradient") 
 110         options_menu
.AppendRadioItem(ID_HorizontalGradient
, "Horizontal Caption Gradient") 
 111         options_menu
.AppendSeparator() 
 112         options_menu
.Append(ID_Settings
, "Settings Pane") 
 114         self
._perspectives
_menu 
= wx
.Menu() 
 115         self
._perspectives
_menu
.Append(ID_CreatePerspective
, "Create Perspective") 
 116         self
._perspectives
_menu
.Append(ID_CopyPerspective
, "Copy Perspective Data To Clipboard") 
 117         self
._perspectives
_menu
.AppendSeparator() 
 118         self
._perspectives
_menu
.Append(ID_FirstPerspective
+0, "Default Startup") 
 119         self
._perspectives
_menu
.Append(ID_FirstPerspective
+1, "All Panes") 
 120         self
._perspectives
_menu
.Append(ID_FirstPerspective
+2, "Vertical Toolbar") 
 122         help_menu 
= wx
.Menu() 
 123         help_menu
.Append(ID_About
, "About...") 
 125         mb
.Append(file_menu
, "File") 
 126         mb
.Append(view_menu
, "View") 
 127         mb
.Append(self
._perspectives
_menu
, "Perspectives") 
 128         mb
.Append(options_menu
, "Options") 
 129         mb
.Append(help_menu
, "Help") 
 133         self
.statusbar 
= self
.CreateStatusBar(2, wx
.ST_SIZEGRIP
) 
 134         self
.statusbar
.SetStatusWidths([-2, -3]) 
 135         self
.statusbar
.SetStatusText("Ready", 0) 
 136         self
.statusbar
.SetStatusText("Welcome To wxPython!", 1) 
 138         # min size for the frame itself isn't completely done. 
 139         # see the end up FrameManager::Update() for the test 
 140         # code. For now, just hard code a frame minimum size 
 141         self
.SetMinSize(wx
.Size(400, 300)) 
 143         # create some toolbars 
 144         tb1 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 145                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 146         tb1
.SetToolBitmapSize(wx
.Size(48,48)) 
 147         tb1
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
)) 
 149         tb1
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 150         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 151         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 152         tb1
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 155         tb2 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 156                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 157         tb2
.SetToolBitmapSize(wx
.Size(16,16)) 
 158         tb2_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 159         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 160         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 161         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 162         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 164         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 165         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 167         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 168         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 169         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 170         tb2
.AddLabelTool(101, "Test", tb2_bmp1
) 
 173         tb3 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 174                          wx
.TB_FLAT | wx
.TB_NODIVIDER
) 
 175         tb3
.SetToolBitmapSize(wx
.Size(16,16)) 
 176         tb3_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 177         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 178         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 179         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 180         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 182         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 183         tb3
.AddLabelTool(101, "Test", tb3_bmp1
) 
 186         tb4 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 187                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_HORZ_TEXT
) 
 188         tb4
.SetToolBitmapSize(wx
.Size(16,16)) 
 189         tb4_bmp1 
= wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16, 16)) 
 190         tb4
.AddLabelTool(101, "Item 1", tb4_bmp1
) 
 191         tb4
.AddLabelTool(101, "Item 2", tb4_bmp1
) 
 192         tb4
.AddLabelTool(101, "Item 3", tb4_bmp1
) 
 193         tb4
.AddLabelTool(101, "Item 4", tb4_bmp1
) 
 195         tb4
.AddLabelTool(101, "Item 5", tb4_bmp1
) 
 196         tb4
.AddLabelTool(101, "Item 6", tb4_bmp1
) 
 197         tb4
.AddLabelTool(101, "Item 7", tb4_bmp1
) 
 198         tb4
.AddLabelTool(101, "Item 8", tb4_bmp1
) 
 201         tb5 
= wx
.ToolBar(self
, -1, wx
.DefaultPosition
, wx
.DefaultSize
, 
 202                          wx
.TB_FLAT | wx
.TB_NODIVIDER | wx
.TB_VERTICAL
) 
 203         tb5
.SetToolBitmapSize(wx
.Size(48, 48)) 
 204         tb5
.AddLabelTool(101, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_ERROR
))  
 206         tb5
.AddLabelTool(102, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_QUESTION
)) 
 207         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_INFORMATION
)) 
 208         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_WARNING
)) 
 209         tb5
.AddLabelTool(103, "Test", wx
.ArtProvider_GetBitmap(wx
.ART_MISSING_IMAGE
)) 
 212         # add a bunch of panes 
 213         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 214                           Name("test1").Caption("Pane Caption").Top()) 
 216         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 217                           Name("test2").Caption("Client Size Reporter"). 
 218                           Bottom().Position(1)) 
 220         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 221                           Name("test3").Caption("Client Size Reporter"). 
 224         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 225                           Name("test4").Caption("Pane Caption"). 
 228         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 229                           Name("test5").Caption("Pane Caption"). 
 232         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 233                           Name("test6").Caption("Client Size Reporter"). 
 236         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 237                           Name("test7").Caption("Client Size Reporter"). 
 240         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo(). 
 241                           Name("test8").Caption("Tree Pane"). 
 242                           Left().Layer(1).Position(1)) 
 244         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 245                           Name("test9").Caption("Min Size 200x100"). 
 246                           BestSize(wx
.Size(200,100)).MinSize(wx
.Size(200,100)). 
 249         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo(). 
 250                           Name("test10").Caption("Text Pane"). 
 251                           Bottom().Layer(1).Position(1)) 
 253         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 254                           Name("test11").Caption("Fixed Pane"). 
 255                           Bottom().Layer(1).Position(2).Fixed()) 
 257         self
._mgr
.AddPane(SettingsPanel(self
, self
), wx
.aui
.PaneInfo(). 
 258                           Name("settings").Caption("Dock Manager Settings"). 
 259                           Dockable(False).Float().Hide()) 
 261         # create some center panes 
 263         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.PaneInfo().Name("grid_content"). 
 266         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo().Name("tree_content"). 
 269         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo().Name("sizereport_content"). 
 272         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo().Name("text_content"). 
 275         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.PaneInfo().Name("html_content"). 
 278         # add the toolbars to the manager 
 280         self
._mgr
.AddPane(tb1
, wx
.aui
.PaneInfo(). 
 281                           Name("tb1").Caption("Big Toolbar"). 
 283                           LeftDockable(False).RightDockable(False)) 
 285         self
._mgr
.AddPane(tb2
, wx
.aui
.PaneInfo(). 
 286                           Name("tb2").Caption("Toolbar 2"). 
 287                           ToolbarPane().Top().Row(1). 
 288                           LeftDockable(False).RightDockable(False)) 
 290         self
._mgr
.AddPane(tb3
, wx
.aui
.PaneInfo(). 
 291                           Name("tb3").Caption("Toolbar 3"). 
 292                           ToolbarPane().Top().Row(1).Position(1). 
 293                           LeftDockable(False).RightDockable(False)) 
 295         self
._mgr
.AddPane(tb4
, wx
.aui
.PaneInfo(). 
 296                           Name("tb4").Caption("Sample Bookmark Toolbar"). 
 297                           ToolbarPane().Top().Row(2). 
 298                           LeftDockable(False).RightDockable(False)) 
 300         self
._mgr
.AddPane(tb5
, wx
.aui
.PaneInfo(). 
 301                           Name("tbvert").Caption("Sample Vertical Toolbar"). 
 302                           ToolbarPane().Left().GripperTop(). 
 303                           TopDockable(False).BottomDockable(False)) 
 305         self
._mgr
.AddPane(wx
.Button(self
, -1, "Test Button"), 
 306                           wx
.aui
.PaneInfo().Name("tb5"). 
 307                           ToolbarPane().Top().Row(2).Position(1). 
 308                           LeftDockable(False).RightDockable(False)) 
 310         # make some default perspectives 
 312         self
._mgr
.GetPane("tbvert").Hide() 
 314         perspective_all 
= self
._mgr
.SavePerspective() 
 316         all_panes 
= self
._mgr
.GetAllPanes() 
 318         for ii 
in xrange(len(all_panes
)): 
 319             if not all_panes
[ii
].IsToolbar(): 
 322         self
._mgr
.GetPane("tb1").Hide() 
 323         self
._mgr
.GetPane("tb5").Hide() 
 324         self
._mgr
.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0) 
 325         self
._mgr
.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) 
 326         self
._mgr
.GetPane("html_content").Show() 
 328         perspective_default 
= self
._mgr
.SavePerspective() 
 330         for ii 
in xrange(len(all_panes
)): 
 331             if not all_panes
[ii
].IsToolbar(): 
 334         self
._mgr
.GetPane("tb1").Hide() 
 335         self
._mgr
.GetPane("tb5").Hide() 
 336         self
._mgr
.GetPane("tbvert").Show() 
 337         self
._mgr
.GetPane("grid_content").Show() 
 338         self
._mgr
.GetPane("test8").Show().Left().Layer(0).Row(0).Position(0) 
 339         self
._mgr
.GetPane("test10").Show().Bottom().Layer(0).Row(0).Position(0) 
 340         self
._mgr
.GetPane("html_content").Show() 
 342         perspective_vert 
= self
._mgr
.SavePerspective() 
 344         self
._perspectives
.append(perspective_default
) 
 345         self
._perspectives
.append(perspective_all
) 
 346         self
._perspectives
.append(perspective_vert
) 
 348         self
._mgr
.GetPane("tbvert").Hide() 
 349         self
._mgr
.GetPane("grid_content").Hide() 
 351         # "commit" all changes made to FrameManager    
 354         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 355         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 356         self
.Bind(wx
.EVT_CLOSE
, self
.OnClose
) 
 358         # Show How To Use The Closing Panes Event 
 359         self
.Bind(wx
.aui
.EVT_AUI_PANEBUTTON
, self
.OnPaneButton
) 
 361         self
.Bind(wx
.EVT_MENU
, self
.OnCreateTree
, id=ID_CreateTree
) 
 362         self
.Bind(wx
.EVT_MENU
, self
.OnCreateGrid
, id=ID_CreateGrid
) 
 363         self
.Bind(wx
.EVT_MENU
, self
.OnCreateText
, id=ID_CreateText
) 
 364         self
.Bind(wx
.EVT_MENU
, self
.OnCreateHTML
, id=ID_CreateHTML
) 
 365         self
.Bind(wx
.EVT_MENU
, self
.OnCreateSizeReport
, id=ID_CreateSizeReport
) 
 366         self
.Bind(wx
.EVT_MENU
, self
.OnCreatePerspective
, id=ID_CreatePerspective
) 
 367         self
.Bind(wx
.EVT_MENU
, self
.OnCopyPerspective
, id=ID_CopyPerspective
) 
 368         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowFloating
) 
 369         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentHint
) 
 370         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentHintFade
) 
 371         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_TransparentDrag
) 
 372         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_DisableVenetianBlinds
) 
 373         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_DisableVenetianBlindsFade
) 
 374         self
.Bind(wx
.EVT_MENU
, self
.OnManagerFlag
, id=ID_AllowActivePane
) 
 375         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_NoGradient
) 
 376         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_VerticalGradient
) 
 377         self
.Bind(wx
.EVT_MENU
, self
.OnGradient
, id=ID_HorizontalGradient
) 
 378         self
.Bind(wx
.EVT_MENU
, self
.OnSettings
, id=ID_Settings
) 
 379         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_GridContent
) 
 380         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TreeContent
) 
 381         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_TextContent
) 
 382         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_SizeReportContent
) 
 383         self
.Bind(wx
.EVT_MENU
, self
.OnChangeContentPane
, id=ID_HTMLContent
) 
 384         self
.Bind(wx
.EVT_MENU
, self
.OnClose
, id=wx
.ID_EXIT
) 
 385         self
.Bind(wx
.EVT_MENU
, self
.OnAbout
, id=ID_About
) 
 387         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_AllowFloating
) 
 388         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentHint
) 
 389         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentHintFade
) 
 390         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_TransparentDrag
) 
 391         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_DisableVenetianBlinds
) 
 392         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_DisableVenetianBlindsFade
) 
 393         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_NoGradient
) 
 394         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_VerticalGradient
) 
 395         self
.Bind(wx
.EVT_UPDATE_UI
, self
.OnUpdateUI
, id=ID_HorizontalGradient
) 
 397         self
.Bind(wx
.EVT_MENU_RANGE
, self
.OnRestorePerspective
, id=ID_FirstPerspective
, 
 398                   id2
=ID_FirstPerspective
+1000) 
 401     def OnPaneButton(self
, event
): 
 403         caption 
= event
.GetPane().caption
 
 405         if caption 
in ["Tree Pane", "Dock Manager Settings", "Fixed Pane"]: 
 406             msg 
= "Are You Sure You Want To Close This Pane?" 
 407             dlg 
= wx
.MessageDialog(self
, msg
, "PyAUI Question", 
 408                                    wx
.YES_NO | wx
.NO_DEFAULT | wx
.CANCEL | wx
.ICON_QUESTION
) 
 410             if dlg
.ShowModal() in [wx
.ID_NO
, wx
.ID_CANCEL
]: 
 419     def OnClose(self
, event
): 
 427     def OnAbout(self
, event
): 
 429         msg 
= "wx.aui Demo\n" + \
 
 430               "An advanced window management library for wxWidgets\n" + \
 
 431               "(c) Copyright 2005-2006, Kirix Corporation" 
 432         dlg 
= wx
.MessageDialog(self
, msg
, "About wx.aui Demo", 
 433                                wx
.OK | wx
.ICON_INFORMATION
) 
 438     def GetDockArt(self
): 
 440         return self
._mgr
.GetArtProvider() 
 448     def OnEraseBackground(self
, event
): 
 453     def OnSize(self
, event
): 
 458     def OnSettings(self
, event
): 
 460         # show the settings pane, and float it 
 461         floating_pane 
= self
._mgr
.GetPane("settings").Float().Show() 
 463         if floating_pane
.floating_pos 
== wx
.DefaultPosition
: 
 464             floating_pane
.FloatingPosition(self
.GetStartPosition()) 
 469     def OnGradient(self
, event
): 
 473         if event
.GetId() == ID_NoGradient
: 
 474             gradient 
= wx
.aui
.AUI_GRADIENT_NONE
 
 475         elif event
.GetId() == ID_VerticalGradient
: 
 476             gradient 
= wx
.aui
.AUI_GRADIENT_VERTICAL
 
 477         elif event
.GetId() == ID_HorizontalGradient
: 
 478             gradient 
= wx
.aui
.AUI_GRADIENT_HORIZONTAL
 
 480         self
._mgr
.GetArtProvider().SetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
, gradient
) 
 484     def OnManagerFlag(self
, event
): 
 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         elif event
.GetId() == ID_DisableVenetianBlinds
: 
 504             flag 
= wx
.aui
.AUI_MGR_DISABLE_VENETIAN_BLINDS
 
 506         elif event
.GetId() == ID_DisableVenetianBlindsFade
: 
 507             flag 
= wx
.aui
.AUI_MGR_DISABLE_VENETIAN_BLINDS_FADE
 
 509         self
._mgr
.SetFlags(self
._mgr
.GetFlags() ^ flag
) 
 512     def OnUpdateUI(self
, event
): 
 514         flags 
= self
._mgr
.GetFlags() 
 516         if event
.GetId() == ID_NoGradient
: 
 517             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_NONE
) 
 519         elif event
.GetId() == ID_VerticalGradient
: 
 520             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_VERTICAL
) 
 522         elif event
.GetId() == ID_HorizontalGradient
: 
 523             event
.Check(self
._mgr
.GetArtProvider().GetMetric(wx
.aui
.AUI_ART_GRADIENT_TYPE
) == wx
.aui
.AUI_GRADIENT_HORIZONTAL
) 
 525         elif event
.GetId() == ID_AllowFloating
: 
 526             event
.Check((flags 
& wx
.aui
.AUI_MGR_ALLOW_FLOATING
) != 0) 
 528         elif event
.GetId() == ID_TransparentDrag
: 
 529             event
.Check((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_DRAG
) != 0) 
 531         elif event
.GetId() == ID_TransparentHint
: 
 532             event
.Check((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_HINT
) != 0) 
 534         elif event
.GetId() == ID_TransparentHintFade
: 
 535             event
.Check((flags 
& wx
.aui
.AUI_MGR_TRANSPARENT_HINT_FADE
) != 0) 
 537         elif event
.GetId() == ID_DisableVenetianBlinds
: 
 538             event
.Check((flags 
& wx
.aui
.AUI_MGR_DISABLE_VENETIAN_BLINDS
) != 0) 
 540         elif event
.GetId() == ID_DisableVenetianBlindsFade
: 
 541             event
.Check((flags 
& wx
.aui
.AUI_MGR_DISABLE_VENETIAN_BLINDS_FADE
) != 0) 
 545     def OnCreatePerspective(self
, event
): 
 547         dlg 
= wx
.TextEntryDialog(self
, "Enter a name for the new perspective:", "AUI Test") 
 549         dlg
.SetValue(("Perspective %d")%(len(self
._perspectives
)+1)) 
 550         if dlg
.ShowModal() != wx
.ID_OK
: 
 553         if len(self
._perspectives
) == 0: 
 554             self
._perspectives
_menu
.AppendSeparator() 
 556         self
._perspectives
_menu
.Append(ID_FirstPerspective 
+ len(self
._perspectives
), dlg
.GetValue()) 
 557         self
._perspectives
.append(self
._mgr
.SavePerspective()) 
 560     def OnCopyPerspective(self
, event
): 
 562         s 
= self
._mgr
.SavePerspective() 
 564         if wx
.TheClipboard
.Open(): 
 566             wx
.TheClipboard
.SetData(wx
.TextDataObject(s
)) 
 567             wx
.TheClipboard
.Close() 
 569     def OnRestorePerspective(self
, event
): 
 571         self
._mgr
.LoadPerspective(self
._perspectives
[event
.GetId() - ID_FirstPerspective
]) 
 574     def GetStartPosition(self
): 
 578         pt 
= self
.ClientToScreen(wx
.Point(0, 0)) 
 580         return wx
.Point(pt
.x 
+ x
, pt
.y 
+ x
) 
 583     def OnCreateTree(self
, event
): 
 585         self
._mgr
.AddPane(self
.CreateTreeCtrl(), wx
.aui
.PaneInfo(). 
 586                           Name("Test").Caption("Tree Control"). 
 587                           Float().FloatingPosition(self
.GetStartPosition()). 
 588                           FloatingSize(wx
.Size(150, 300))) 
 592     def OnCreateGrid(self
, event
): 
 594         self
._mgr
.AddPane(self
.CreateGrid(), wx
.aui
.PaneInfo(). 
 595                           Name("Test").Caption("Grid"). 
 596                           Float().FloatingPosition(self
.GetStartPosition()). 
 597                           FloatingSize(wx
.Size(300, 200))) 
 601     def OnCreateHTML(self
, event
): 
 603         self
._mgr
.AddPane(self
.CreateHTMLCtrl(), wx
.aui
.PaneInfo(). 
 604                           Name("Test").Caption("HTML Content"). 
 605                           Float().FloatingPosition(self
.GetStartPosition()). 
 606                           FloatingSize(wx
.Size(300, 200))) 
 610     def OnCreateText(self
, event
): 
 612         self
._mgr
.AddPane(self
.CreateTextCtrl(), wx
.aui
.PaneInfo(). 
 613                           Name("Test").Caption("Text Control"). 
 614                           Float().FloatingPosition(self
.GetStartPosition())) 
 618     def OnCreateSizeReport(self
, event
): 
 620         self
._mgr
.AddPane(self
.CreateSizeReportCtrl(), wx
.aui
.PaneInfo(). 
 621                           Name("Test").Caption("Client Size Reporter"). 
 622                           Float().FloatingPosition(self
.GetStartPosition())) 
 626     def OnChangeContentPane(self
, event
): 
 628         self
._mgr
.GetPane("grid_content").Show(event
.GetId() == ID_GridContent
) 
 629         self
._mgr
.GetPane("text_content").Show(event
.GetId() == ID_TextContent
) 
 630         self
._mgr
.GetPane("tree_content").Show(event
.GetId() == ID_TreeContent
) 
 631         self
._mgr
.GetPane("sizereport_content").Show(event
.GetId() == ID_SizeReportContent
) 
 632         self
._mgr
.GetPane("html_content").Show(event
.GetId() == ID_HTMLContent
) 
 636     def CreateTextCtrl(self
): 
 638         text 
= ("This is text box %d")%(self
.n 
+ 1) 
 640         return wx
.TextCtrl(self
,-1, text
, wx
.Point(0, 0), wx
.Size(150, 90), 
 641                            wx
.NO_BORDER | wx
.TE_MULTILINE
) 
 645     def CreateGrid(self
): 
 647         grid 
= wx
.grid
.Grid(self
, -1, wx
.Point(0, 0), wx
.Size(150, 250), 
 648                             wx
.NO_BORDER | wx
.WANTS_CHARS
) 
 650         grid
.CreateGrid(50, 20) 
 655     def CreateTreeCtrl(self
): 
 657         tree 
= wx
.TreeCtrl(self
, -1, wx
.Point(0, 0), wx
.Size(160, 250), 
 658                            wx
.TR_DEFAULT_STYLE | wx
.NO_BORDER
) 
 660         root 
= tree
.AddRoot("PyAUI Project") 
 663         imglist 
= wx
.ImageList(16, 16, True, 2) 
 664         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_FOLDER
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 665         imglist
.Add(wx
.ArtProvider_GetBitmap(wx
.ART_NORMAL_FILE
, wx
.ART_OTHER
, wx
.Size(16,16))) 
 666         tree
.AssignImageList(imglist
) 
 668         items
.append(tree
.AppendItem(root
, "Item 1", 0)) 
 669         items
.append(tree
.AppendItem(root
, "Item 2", 0)) 
 670         items
.append(tree
.AppendItem(root
, "Item 3", 0)) 
 671         items
.append(tree
.AppendItem(root
, "Item 4", 0)) 
 672         items
.append(tree
.AppendItem(root
, "Item 5", 0)) 
 674         for ii 
in xrange(len(items
)): 
 677             tree
.AppendItem(id, "Subitem 1", 1) 
 678             tree
.AppendItem(id, "Subitem 2", 1) 
 679             tree
.AppendItem(id, "Subitem 3", 1) 
 680             tree
.AppendItem(id, "Subitem 4", 1) 
 681             tree
.AppendItem(id, "Subitem 5", 1) 
 688     def CreateSizeReportCtrl(self
, width
=80, height
=80): 
 690         ctrl 
= SizeReportCtrl(self
, -1, wx
.DefaultPosition
, 
 691                               wx
.Size(width
, height
), self
._mgr
) 
 695     def CreateHTMLCtrl(self
): 
 696         ctrl 
= wx
.html
.HtmlWindow(self
, -1, wx
.DefaultPosition
, wx
.Size(400, 300)) 
 697         if "gtk2" in wx
.PlatformInfo
: 
 698             ctrl
.SetStandardFonts() 
 699         ctrl
.SetPage(self
.GetIntroText())         
 703     def GetIntroText(self
): 
 707 # -- wx.SizeReportCtrl -- 
 708 # (a utility control that always reports it's client size) 
 710 class SizeReportCtrl(wx
.PyControl
): 
 712     def __init__(self
, parent
, id=wx
.ID_ANY
, pos
=wx
.DefaultPosition
, 
 713                  size
=wx
.DefaultSize
, mgr
=None): 
 715         wx
.PyControl
.__init
__(self
, parent
, id, pos
, size
, wx
.NO_BORDER
) 
 719         self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
) 
 720         self
.Bind(wx
.EVT_SIZE
, self
.OnSize
) 
 721         self
.Bind(wx
.EVT_ERASE_BACKGROUND
, self
.OnEraseBackground
) 
 724     def OnPaint(self
, event
): 
 726         dc 
= wx
.PaintDC(self
) 
 728         size 
= self
.GetClientSize() 
 729         s 
= ("Size: %d x %d")%(size
.x
, size
.y
) 
 731         dc
.SetFont(wx
.NORMAL_FONT
) 
 732         w
, height 
= dc
.GetTextExtent(s
) 
 734         dc
.SetBrush(wx
.WHITE_BRUSH
) 
 735         dc
.SetPen(wx
.WHITE_PEN
) 
 736         dc
.DrawRectangle(0, 0, size
.x
, size
.y
) 
 737         dc
.SetPen(wx
.LIGHT_GREY_PEN
) 
 738         dc
.DrawLine(0, 0, size
.x
, size
.y
) 
 739         dc
.DrawLine(0, size
.y
, size
.x
, 0) 
 740         dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)) 
 744             pi 
= self
._mgr
.GetPane(self
) 
 746             s 
= ("Layer: %d")%pi
.dock_layer
 
 747             w
, h 
= dc
.GetTextExtent(s
) 
 748             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*1)) 
 750             s 
= ("Dock: %d Row: %d")%(pi
.dock_direction
, pi
.dock_row
) 
 751             w
, h 
= dc
.GetTextExtent(s
) 
 752             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*2)) 
 754             s 
= ("Position: %d")%pi
.dock_pos
 
 755             w
, h 
= dc
.GetTextExtent(s
) 
 756             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*3)) 
 758             s 
= ("Proportion: %d")%pi
.dock_proportion
 
 759             w
, h 
= dc
.GetTextExtent(s
) 
 760             dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*4)) 
 763     def OnEraseBackground(self
, event
): 
 764         # intentionally empty 
 768     def OnSize(self
, event
): 
 774 ID_PaneBorderSize 
= wx
.ID_HIGHEST 
+ 1 
 775 ID_SashSize 
= ID_PaneBorderSize 
+ 1 
 776 ID_CaptionSize 
= ID_PaneBorderSize 
+ 2 
 777 ID_BackgroundColor 
= ID_PaneBorderSize 
+ 3 
 778 ID_SashColor 
= ID_PaneBorderSize 
+ 4 
 779 ID_InactiveCaptionColor 
=  ID_PaneBorderSize 
+ 5 
 780 ID_InactiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 6 
 781 ID_InactiveCaptionTextColor 
= ID_PaneBorderSize 
+ 7 
 782 ID_ActiveCaptionColor 
= ID_PaneBorderSize 
+ 8 
 783 ID_ActiveCaptionGradientColor 
= ID_PaneBorderSize 
+ 9 
 784 ID_ActiveCaptionTextColor 
= ID_PaneBorderSize 
+ 10 
 785 ID_BorderColor 
= ID_PaneBorderSize 
+ 11 
 786 ID_GripperColor 
= ID_PaneBorderSize 
+ 12 
 788 class SettingsPanel(wx
.Panel
): 
 790     def __init__(self
, parent
, frame
): 
 792         wx
.Panel
.__init
__(self
, parent
, wx
.ID_ANY
, wx
.DefaultPosition
, 
 797         vert 
= wx
.BoxSizer(wx
.VERTICAL
) 
 799         s1 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 800         self
._border
_size 
= wx
.SpinCtrl(self
, ID_PaneBorderSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 801         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 802         s1
.Add(wx
.StaticText(self
, -1, "Pane Border Size:")) 
 803         s1
.Add(self
._border
_size
) 
 804         s1
.Add((1, 1), 1, wx
.EXPAND
) 
 805         s1
.SetItemMinSize(1, (180, 20)) 
 806         #vert.Add(s1, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 808         s2 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 809         self
._sash
_size 
= wx
.SpinCtrl(self
, ID_SashSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 810         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 811         s2
.Add(wx
.StaticText(self
, -1, "Sash Size:")) 
 812         s2
.Add(self
._sash
_size
) 
 813         s2
.Add((1, 1), 1, wx
.EXPAND
) 
 814         s2
.SetItemMinSize(1, (180, 20)) 
 815         #vert.Add(s2, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 817         s3 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 818         self
._caption
_size 
= wx
.SpinCtrl(self
, ID_CaptionSize
, "", wx
.DefaultPosition
, wx
.Size(50,20)) 
 819         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 820         s3
.Add(wx
.StaticText(self
, -1, "Caption Size:")) 
 821         s3
.Add(self
._caption
_size
) 
 822         s3
.Add((1, 1), 1, wx
.EXPAND
) 
 823         s3
.SetItemMinSize(1, (180, 20)) 
 824         #vert.Add(s3, 0, wx.EXPAND | wxLEFT | wxBOTTOM, 5) 
 826         #vert.Add(1, 1, 1, wx.EXPAND) 
 828         b 
= self
.CreateColorBitmap(wx
.BLACK
) 
 830         s4 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 831         self
._background
_color 
= wx
.BitmapButton(self
, ID_BackgroundColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 832         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 833         s4
.Add(wx
.StaticText(self
, -1, "Background Color:")) 
 834         s4
.Add(self
._background
_color
) 
 835         s4
.Add((1, 1), 1, wx
.EXPAND
) 
 836         s4
.SetItemMinSize(1, (180, 20)) 
 838         s5 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 839         self
._sash
_color 
= wx
.BitmapButton(self
, ID_SashColor
, b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 840         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 841         s5
.Add(wx
.StaticText(self
, -1, "Sash Color:")) 
 842         s5
.Add(self
._sash
_color
) 
 843         s5
.Add((1, 1), 1, wx
.EXPAND
) 
 844         s5
.SetItemMinSize(1, (180, 20)) 
 846         s6 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 847         self
._inactive
_caption
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionColor
, b
, 
 848                                                        wx
.DefaultPosition
, wx
.Size(50,25)) 
 849         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 850         s6
.Add(wx
.StaticText(self
, -1, "Normal Caption:")) 
 851         s6
.Add(self
._inactive
_caption
_color
) 
 852         s6
.Add((1, 1), 1, wx
.EXPAND
) 
 853         s6
.SetItemMinSize(1, (180, 20)) 
 855         s7 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 856         self
._inactive
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionGradientColor
, 
 857                                                                 b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 858         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 859         s7
.Add(wx
.StaticText(self
, -1, "Normal Caption Gradient:")) 
 860         s7
.Add(self
._inactive
_caption
_gradient
_color
) 
 861         s7
.Add((1, 1), 1, wx
.EXPAND
) 
 862         s7
.SetItemMinSize(1, (180, 20)) 
 864         s8 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 865         self
._inactive
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_InactiveCaptionTextColor
, b
, 
 866                                                             wx
.DefaultPosition
, wx
.Size(50,25)) 
 867         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 868         s8
.Add(wx
.StaticText(self
, -1, "Normal Caption Text:")) 
 869         s8
.Add(self
._inactive
_caption
_text
_color
) 
 870         s8
.Add((1, 1), 1, wx
.EXPAND
) 
 871         s8
.SetItemMinSize(1, (180, 20)) 
 873         s9 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 874         self
._active
_caption
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionColor
, b
, 
 875                                                      wx
.DefaultPosition
, wx
.Size(50,25)) 
 876         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 877         s9
.Add(wx
.StaticText(self
, -1, "Active Caption:")) 
 878         s9
.Add(self
._active
_caption
_color
) 
 879         s9
.Add((1, 1), 1, wx
.EXPAND
) 
 880         s9
.SetItemMinSize(1, (180, 20)) 
 882         s10 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 883         self
._active
_caption
_gradient
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionGradientColor
, 
 884                                                               b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 885         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 886         s10
.Add(wx
.StaticText(self
, -1, "Active Caption Gradient:")) 
 887         s10
.Add(self
._active
_caption
_gradient
_color
) 
 888         s10
.Add((1, 1), 1, wx
.EXPAND
) 
 889         s10
.SetItemMinSize(1, (180, 20)) 
 891         s11 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 892         self
._active
_caption
_text
_color 
= wx
.BitmapButton(self
, ID_ActiveCaptionTextColor
, 
 893                                                           b
, wx
.DefaultPosition
, wx
.Size(50,25)) 
 894         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 895         s11
.Add(wx
.StaticText(self
, -1, "Active Caption Text:")) 
 896         s11
.Add(self
._active
_caption
_text
_color
) 
 897         s11
.Add((1, 1), 1, wx
.EXPAND
) 
 898         s11
.SetItemMinSize(1, (180, 20)) 
 900         s12 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 901         self
._border
_color 
= wx
.BitmapButton(self
, ID_BorderColor
, b
, wx
.DefaultPosition
, 
 903         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 904         s12
.Add(wx
.StaticText(self
, -1, "Border Color:")) 
 905         s12
.Add(self
._border
_color
) 
 906         s12
.Add((1, 1), 1, wx
.EXPAND
) 
 907         s12
.SetItemMinSize(1, (180, 20)) 
 909         s13 
= wx
.BoxSizer(wx
.HORIZONTAL
) 
 910         self
._gripper
_color 
= wx
.BitmapButton(self
, ID_GripperColor
, b
, wx
.DefaultPosition
, 
 912         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 913         s13
.Add(wx
.StaticText(self
, -1, "Gripper Color:")) 
 914         s13
.Add(self
._gripper
_color
) 
 915         s13
.Add((1, 1), 1, wx
.EXPAND
) 
 916         s13
.SetItemMinSize(1, (180, 20)) 
 918         grid_sizer 
= wx
.GridSizer(0, 2) 
 919         grid_sizer
.SetHGap(5) 
 926         grid_sizer
.Add((1, 1)) 
 935         cont_sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
 936         cont_sizer
.Add(grid_sizer
, 1, wx
.EXPAND | wx
.ALL
, 5) 
 937         self
.SetSizer(cont_sizer
) 
 938         self
.GetSizer().SetSizeHints(self
) 
 940         self
._border
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_PANE_BORDER_SIZE
)) 
 941         self
._sash
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_SASH_SIZE
)) 
 942         self
._caption
_size
.SetValue(frame
.GetDockArt().GetMetric(wx
.aui
.AUI_ART_CAPTION_SIZE
)) 
 946         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnPaneBorderSize
, id=ID_PaneBorderSize
) 
 947         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnSashSize
, id=ID_SashSize
) 
 948         self
.Bind(wx
.EVT_SPINCTRL
, self
.OnCaptionSize
, id=ID_CaptionSize
) 
 949         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BackgroundColor
) 
 950         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_SashColor
) 
 951         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionColor
) 
 952         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionGradientColor
) 
 953         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_InactiveCaptionTextColor
) 
 954         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionColor
) 
 955         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionGradientColor
) 
 956         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_ActiveCaptionTextColor
) 
 957         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_BorderColor
) 
 958         self
.Bind(wx
.EVT_BUTTON
, self
.OnSetColor
, id=ID_GripperColor
) 
 961     def CreateColorBitmap(self
, c
): 
 962         image 
= wx
.EmptyImage(25, 14) 
 967                 if x 
== 0 or x 
== 24 or y 
== 0 or y 
== 13: 
 970                 image
.SetRGB(x
, y
, pixcol
.Red(), pixcol
.Green(), pixcol
.Blue()) 
 972         return image
.ConvertToBitmap() 
 975     def UpdateColors(self
): 
 977         bk 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_BACKGROUND_COLOUR
) 
 978         self
._background
_color
.SetBitmapLabel(self
.CreateColorBitmap(bk
)) 
 980         cap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_COLOUR
) 
 981         self
._inactive
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(cap
)) 
 983         capgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
) 
 984         self
._inactive
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(capgrad
)) 
 986         captxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
) 
 987         self
._inactive
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(captxt
)) 
 989         acap 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_COLOUR
) 
 990         self
._active
_caption
_color
.SetBitmapLabel(self
.CreateColorBitmap(acap
)) 
 992         acapgrad 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
) 
 993         self
._active
_caption
_gradient
_color
.SetBitmapLabel(self
.CreateColorBitmap(acapgrad
)) 
 995         acaptxt 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
) 
 996         self
._active
_caption
_text
_color
.SetBitmapLabel(self
.CreateColorBitmap(acaptxt
)) 
 998         sash 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_SASH_COLOUR
) 
 999         self
._sash
_color
.SetBitmapLabel(self
.CreateColorBitmap(sash
)) 
1001         border 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_BORDER_COLOUR
) 
1002         self
._border
_color
.SetBitmapLabel(self
.CreateColorBitmap(border
)) 
1004         gripper 
= self
._frame
.GetDockArt().GetColour(wx
.aui
.AUI_ART_GRIPPER_COLOUR
) 
1005         self
._gripper
_color
.SetBitmapLabel(self
.CreateColorBitmap(gripper
)) 
1008     def OnPaneBorderSize(self
, event
): 
1010         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_PANE_BORDER_SIZE
, 
1012         self
._frame
.DoUpdate() 
1015     def OnSashSize(self
, event
): 
1017         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_SASH_SIZE
, 
1019         self
._frame
.DoUpdate() 
1022     def OnCaptionSize(self
, event
): 
1024         self
._frame
.GetDockArt().SetMetric(wx
.aui
.AUI_ART_CAPTION_SIZE
, 
1026         self
._frame
.DoUpdate() 
1029     def OnSetColor(self
, event
): 
1031         dlg 
= wx
.ColourDialog(self
._frame
) 
1033         dlg
.SetTitle("Color Picker") 
1035         if dlg
.ShowModal() != wx
.ID_OK
: 
1039         if event
.GetId() == ID_BackgroundColor
: 
1040             var 
= wx
.aui
.AUI_ART_BACKGROUND_COLOUR
 
1041         elif event
.GetId() == ID_SashColor
: 
1042             var 
= wx
.aui
.AUI_ART_SASH_COLOUR
 
1043         elif event
.GetId() == ID_InactiveCaptionColor
: 
1044             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_COLOUR
 
1045         elif event
.GetId() == ID_InactiveCaptionGradientColor
: 
1046             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
 
1047         elif event
.GetId() == ID_InactiveCaptionTextColor
: 
1048             var 
= wx
.aui
.AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
 
1049         elif event
.GetId() == ID_ActiveCaptionColor
: 
1050             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_COLOUR
 
1051         elif event
.GetId() == ID_ActiveCaptionGradientColor
: 
1052             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
 
1053         elif event
.GetId() == ID_ActiveCaptionTextColor
: 
1054             var 
= wx
.aui
.AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
 
1055         elif event
.GetId() == ID_BorderColor
: 
1056             var 
= wx
.aui
.AUI_ART_BORDER_COLOUR
 
1057         elif event
.GetId() == ID_GripperColor
: 
1058             var 
= wx
.aui
.AUI_ART_GRIPPER_COLOUR
 
1062         self
._frame
.GetDockArt().SetColor(var
, dlg
.GetColourData().GetColour()) 
1063         self
._frame
.DoUpdate() 
1068 #---------------------------------------------------------------------- 
1070 class TestPanel(wx
.Panel
): 
1071     def __init__(self
, parent
, log
): 
1073         wx
.Panel
.__init
__(self
, parent
, -1) 
1074         b 
= wx
.Button(self
, -1, "Show the wx.aui Demo Frame", (50,50)) 
1075         self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
) 
1077     def OnButton(self
, evt
): 
1078         frame 
= PyAUIFrame(self
, wx
.ID_ANY
, "wx.aui wxPython Demo", size
=(750, 590)) 
1081 #---------------------------------------------------------------------- 
1083 def runTest(frame
, nb
, log
): 
1084     win 
= TestPanel(nb
, log
) 
1087 #---------------------------------------------------------------------- 
1093 <h3>wx.aui, the Advanced User Interface module</h3> 
1095 <br/><b>Overview</b><br/> 
1097 <p>wx.aui is an Advanced User Interface library for the wxWidgets toolkit  
1098 that allows developers to create high-quality, cross-platform user  
1099 interfaces quickly and easily.</p> 
1101 <p><b>Features</b></p> 
1103 <p>With wx.aui developers can create application frameworks with:</p> 
1106 <li>Native, dockable floating frames</li> 
1107 <li>Perspective saving and loading</li> 
1108 <li>Native toolbars incorporating real-time, "spring-loaded" dragging</li> 
1109 <li>Customizable floating/docking behavior</li> 
1110 <li>Completely customizable look-and-feel</li> 
1111 <li>Optional transparent window effects (while dragging or docking)</li> 
1120 if __name__ 
== '__main__': 
1123     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])