1import unittest
2from unittests import wtc
3import wx
4import os
5
6import wx.lib.agw.aui as aui
7
8#---------------------------------------------------------------------------
9
10class lib_agw_aui_Tests(wtc.WidgetTestCase):
11
12    def test_lib_agw_auiCtor(self):
13        self._mgr = aui.AuiManager()
14
15        # tell AuiManager to manage this frame
16        self._mgr.SetManagedWindow(self.frame)
17
18        pane = wx.Panel()
19        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane1").Caption("A pane")
20                          .CenterPane())
21        pane = wx.Panel()
22        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane2").Caption("A pane")
23                          .Top())
24        pane = wx.Panel()
25        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane3").Caption("A pane")
26                          .Left())
27        pane = wx.Panel()
28        self._mgr.AddPane(pane, aui.AuiPaneInfo().Name("pane4").Caption("A pane")
29                          .Bottom())
30        self._mgr.Update()
31
32    def tearDown(self):
33        self._mgr.UnInit()
34
35
36class lib_agw_aui_additional_Tests(wtc.WidgetTestCase):
37
38    def test_lib_agw_aui_ToolbarCtor(self):
39        tb = aui.AuiToolBar(self.frame, -1, wx.DefaultPosition, wx.DefaultSize,
40                             agwStyle=aui.AUI_TB_OVERFLOW | aui.AUI_TB_VERT_TEXT)
41        tb_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(16, 16))
42        tb.AddSimpleTool(-1, "Test", tb_bmp1)
43        tb.AddSimpleTool(-1, "Check 1", tb_bmp1, "Check 1", aui.ITEM_CHECK)
44        tb.AddSimpleTool(-1, "Radio 1", tb_bmp1, "Radio 1", aui.ITEM_RADIO)
45        tb.AddSeparator()
46
47        # prepare a few custom overflow elements for the toolbars' overflow buttons
48
49        prepend_items, append_items = [], []
50        item = aui.AuiToolBarItem()
51
52        item.SetKind(wx.ITEM_SEPARATOR)
53        append_items.append(item)
54
55        item = aui.AuiToolBarItem()
56        item.SetKind(wx.ITEM_NORMAL)
57        item.SetId(-1)
58        item.SetLabel("Customize...")
59        append_items.append(item)
60        tb.SetCustomOverflowItems(prepend_items, append_items)
61        tb.Realize()
62
63
64    def test_lib_agw_auiEvents(self):
65        aui.EVT_AUI_PANE_BUTTON
66        """ Fires an event when the user left-clicks on a pane button. """
67        aui.EVT_AUI_PANE_CLOSE
68        """ A pane in `AuiManager` has been closed. """
69        aui.EVT_AUI_PANE_MAXIMIZE
70        """ A pane in `AuiManager` has been maximized. """
71        aui.EVT_AUI_PANE_RESTORE
72        """ A pane in `AuiManager` has been restored from a maximized state. """
73        aui.EVT_AUI_RENDER
74        """ Fires an event every time the AUI frame is being repainted. """
75        aui.EVT_AUI_FIND_MANAGER
76        """ Used to find which AUI manager is controlling a certain pane. """
77        aui.EVT_AUI_PANE_MINIMIZE
78        """ A pane in `AuiManager` has been minimized. """
79        aui.EVT_AUI_PANE_MIN_RESTORE
80        """ A pane in `AuiManager` has been restored from a minimized state. """
81        aui.EVT_AUI_PANE_FLOATING
82        """ A pane in `AuiManager` is about to be floated. """
83        aui.EVT_AUI_PANE_FLOATED
84        """ A pane in `AuiManager` has been floated. """
85        aui.EVT_AUI_PANE_DOCKING
86        """ A pane in `AuiManager` is about to be docked. """
87        aui.EVT_AUI_PANE_DOCKED
88        """ A pane in `AuiManager` has been docked. """
89        aui.EVT_AUI_PANE_ACTIVATED
90        """ A pane in `AuiManager` has been activated. """
91        aui.EVT_AUI_PERSPECTIVE_CHANGED
92        """ The layout in `AuiManager` has been changed. """
93
94    def test_lib_agw_auiConstantsExist(self):
95
96        # For auibook
97        # -----------
98        aui.AuiBaseTabCtrlId
99        """ Base window identifier for AuiTabCtrl. """
100
101        aui.AUI_NB_TOP
102        """ With this style, tabs are drawn along the top of the notebook. """
103        aui.AUI_NB_LEFT
104        """ With this style, tabs are drawn along the left of the notebook.
105        Not implemented yet. """
106        aui.AUI_NB_RIGHT
107        """ With this style, tabs are drawn along the right of the notebook.
108        Not implemented yet. """
109        aui.AUI_NB_BOTTOM
110        """ With this style, tabs are drawn along the bottom of the notebook. """
111        aui.AUI_NB_TAB_SPLIT
112        """ Allows the tab control to be split by dragging a tab. """
113        aui.AUI_NB_TAB_MOVE
114        """ Allows a tab to be moved horizontally by dragging. """
115        aui.AUI_NB_TAB_EXTERNAL_MOVE
116        """ Allows a tab to be moved to another tab control. """
117        aui.AUI_NB_TAB_FIXED_WIDTH
118        """ With this style, all tabs have the same width. """
119        aui.AUI_NB_SCROLL_BUTTONS
120        """ With this style, left and right scroll buttons are displayed. """
121        aui.AUI_NB_WINDOWLIST_BUTTON
122        """ With this style, a drop-down list of windows is available. """
123        aui.AUI_NB_CLOSE_BUTTON
124        """ With this style, a close button is available on the tab bar. """
125        aui.AUI_NB_CLOSE_ON_ACTIVE_TAB
126        """ With this style, a close button is available on the active tab. """
127        aui.AUI_NB_CLOSE_ON_ALL_TABS
128        """ With this style, a close button is available on all tabs. """
129        aui.AUI_NB_MIDDLE_CLICK_CLOSE
130        """ Allows to close `AuiNotebook` tabs by mouse middle button click. """
131        aui.AUI_NB_SUB_NOTEBOOK
132        """ This style is used by `AuiManager` to create automatic `AuiNotebooks`. """
133        aui.AUI_NB_HIDE_ON_SINGLE_TAB
134        """ Hides the tab window if only one tab is present. """
135        aui.AUI_NB_SMART_TABS
136        """ Use `Smart Tabbing`, like ``Alt`` + ``Tab`` on Windows. """
137        aui.AUI_NB_USE_IMAGES_DROPDOWN
138        """ Uses images on dropdown window list menu instead of check items. """
139        aui.AUI_NB_CLOSE_ON_TAB_LEFT
140        """ Draws the tab close button on the left instead of on the right
141        (a la Camino browser). """
142        aui.AUI_NB_TAB_FLOAT
143        """ Allows the floating of single tabs.
144        Known limitation: when the notebook is more or less full screen, tabs
145        cannot be dragged far enough outside of the notebook to become
146        floating pages. """
147        aui.AUI_NB_DRAW_DND_TAB
148        """ Draws an image representation of a tab while dragging. """
149        aui.AUI_NB_ORDER_BY_ACCESS
150        """ Tab navigation order by last access time. """
151        aui.AUI_NB_NO_TAB_FOCUS
152        """ Don't draw tab focus rectangle. """
153
154        aui.AUI_NB_DEFAULT_STYLE
155        """ Default `AuiNotebook` style. """
156
157        # -------------------------- #
158        # - FrameManager Constants - #
159        # -------------------------- #
160
161        # Docking Styles
162        aui.AUI_DOCK_NONE
163        """ No docking direction. """
164        aui.AUI_DOCK_TOP
165        """ Top docking direction. """
166        aui.AUI_DOCK_RIGHT
167        """ Right docking direction. """
168        aui.AUI_DOCK_BOTTOM
169        """ Bottom docking direction. """
170        aui.AUI_DOCK_LEFT
171        """ Left docking direction. """
172        aui.AUI_DOCK_CENTER
173        """ Center docking direction. """
174        aui.AUI_DOCK_CENTRE
175        """ Centre docking direction. """
176        aui.AUI_DOCK_NOTEBOOK_PAGE
177        """ Automatic AuiNotebooks docking style. """
178
179        # Floating/Dragging Styles
180        aui.AUI_MGR_ALLOW_FLOATING
181        """ Allow floating of panes. """
182        aui.AUI_MGR_ALLOW_ACTIVE_PANE
183        """ If a pane becomes active, "highlight" it in the interface. """
184        aui.AUI_MGR_TRANSPARENT_DRAG
185        """ If the platform supports it, set transparency on a floating pane
186        while it is dragged by the user. """
187        aui.AUI_MGR_TRANSPARENT_HINT
188        """ If the platform supports it, show a transparent hint window when
189        the user is about to dock a floating pane. """
190        aui.AUI_MGR_VENETIAN_BLINDS_HINT
191        """ Show a "venetian blind" effect when the user is about to dock a
192        floating pane. """
193        aui.AUI_MGR_RECTANGLE_HINT
194        """ Show a rectangle hint effect when the user is about to dock a
195        floating pane. """
196        aui.AUI_MGR_HINT_FADE
197        """ If the platform supports it, the hint window will fade in and out. """
198        aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE
199        """ Disables the "venetian blind" fade in and out. """
200        aui.AUI_MGR_LIVE_RESIZE
201        """ Live resize when the user drag a sash. """
202        aui.AUI_MGR_ANIMATE_FRAMES
203        """ Fade-out floating panes when they are closed (all platforms which support
204        frames transparency) and show a moving rectangle when they are docked
205        (Windows < Vista and GTK only). """
206        aui.AUI_MGR_AERO_DOCKING_GUIDES
207        """ Use the new Aero-style bitmaps as docking guides. """
208        aui.AUI_MGR_PREVIEW_MINIMIZED_PANES
209        """ Slide in and out minimized panes to preview them. """
210        aui.AUI_MGR_WHIDBEY_DOCKING_GUIDES
211        """ Use the new Whidbey-style bitmaps as docking guides. """
212        aui.AUI_MGR_SMOOTH_DOCKING
213        """ Performs a "smooth" docking of panes (a la PyQT). """
214        aui.AUI_MGR_USE_NATIVE_MINIFRAMES
215        """ Use miniframes with native caption bar as floating panes instead or custom
216        drawn caption bars (forced on wxMac). """
217        aui.AUI_MGR_AUTONB_NO_CAPTION
218        """ Panes that merge into an automatic notebook will not have the pane
219        caption visible. """
220
221
222        aui.AUI_MGR_DEFAULT
223        """ Default `AuiManager` style. """
224
225        # Panes Customization
226        aui.AUI_DOCKART_SASH_SIZE
227        """ Customizes the sash size. """
228        aui.AUI_DOCKART_CAPTION_SIZE
229        """ Customizes the caption size. """
230        aui.AUI_DOCKART_GRIPPER_SIZE
231        """ Customizes the gripper size. """
232        aui.AUI_DOCKART_PANE_BORDER_SIZE
233        """ Customizes the pane border size. """
234        aui.AUI_DOCKART_PANE_BUTTON_SIZE
235        """ Customizes the pane button size. """
236        aui.AUI_DOCKART_BACKGROUND_COLOUR
237        """ Customizes the background colour. """
238        aui.AUI_DOCKART_BACKGROUND_GRADIENT_COLOUR
239        """ Customizes the background gradient colour. """
240        aui.AUI_DOCKART_SASH_COLOUR
241        """ Customizes the sash colour. """
242        aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR
243        """ Customizes the active caption colour. """
244        aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
245        """ Customizes the active caption gradient colour. """
246        aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR
247        """ Customizes the inactive caption colour. """
248        aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
249        """ Customizes the inactive gradient caption colour. """
250        aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
251        """ Customizes the active caption text colour. """
252        aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
253        """ Customizes the inactive caption text colour. """
254        aui.AUI_DOCKART_BORDER_COLOUR
255        """ Customizes the border colour. """
256        aui.AUI_DOCKART_GRIPPER_COLOUR
257        """ Customizes the gripper colour. """
258        aui.AUI_DOCKART_CAPTION_FONT
259        """ Customizes the caption font. """
260        aui.AUI_DOCKART_GRADIENT_TYPE
261        """ Customizes the gradient type (no gradient, vertical or horizontal). """
262        aui.AUI_DOCKART_DRAW_SASH_GRIP
263        """ Draw a sash grip on the sash. """
264        aui.AUI_DOCKART_HINT_WINDOW_COLOUR
265        """ Customizes the hint window background colour (currently light blue). """
266
267        # Caption Gradient Type
268        aui.AUI_GRADIENT_NONE
269        """ No gradient on the captions. """
270        aui.AUI_GRADIENT_VERTICAL
271
272        """ Vertical gradient on the captions. """
273        aui.AUI_GRADIENT_HORIZONTAL
274        """ Horizontal gradient on the captions. """
275
276        # Pane Button State
277        aui.AUI_BUTTON_STATE_NORMAL
278        """ Normal button state. """
279        aui.AUI_BUTTON_STATE_HOVER
280        """ Hovered button state. """
281        aui.AUI_BUTTON_STATE_PRESSED
282        """ Pressed button state. """
283        aui.AUI_BUTTON_STATE_DISABLED
284        """ Disabled button state. """
285        aui.AUI_BUTTON_STATE_HIDDEN
286        """ Hidden button state. """
287        aui.AUI_BUTTON_STATE_CHECKED
288        """ Checked button state. """
289
290        # Pane minimize mode
291        aui.AUI_MINIMIZE_POS_SMART
292        """ Minimizes the pane on the closest tool bar. """
293        aui.AUI_MINIMIZE_POS_TOP
294        """ Minimizes the pane on the top tool bar. """
295        aui.AUI_MINIMIZE_POS_LEFT
296        """ Minimizes the pane on its left tool bar. """
297        aui.AUI_MINIMIZE_POS_RIGHT
298        """ Minimizes the pane on its right tool bar. """
299        aui.AUI_MINIMIZE_POS_BOTTOM
300        """ Minimizes the pane on its bottom tool bar. """
301        aui.AUI_MINIMIZE_POS_TOOLBAR
302        """ Minimizes the pane on its bottom tool bar. """
303        aui.AUI_MINIMIZE_POS_MASK
304        """ Mask to filter the position flags. """
305        aui.AUI_MINIMIZE_CAPT_HIDE
306        """ Hides the caption of the minimized pane. """
307        aui.AUI_MINIMIZE_CAPT_SMART
308        """ Displays the caption in the best rotation (horz or clockwise). """
309        aui.AUI_MINIMIZE_CAPT_HORZ
310        """ Displays the caption horizontally. """
311        aui.AUI_MINIMIZE_CAPT_MASK
312        """ Mask to filter the caption flags. """
313
314        # Button kind
315        aui.AUI_BUTTON_CLOSE
316        """ Shows a close button on the pane. """
317        aui.AUI_BUTTON_MAXIMIZE_RESTORE
318        """ Shows a maximize/restore button on the pane. """
319        aui.AUI_BUTTON_MINIMIZE
320        """ Shows a minimize button on the pane. """
321        aui.AUI_BUTTON_PIN
322        """ Shows a pin button on the pane. """
323        aui.AUI_BUTTON_OPTIONS
324        """ Shows an option button on the pane (not implemented). """
325        aui.AUI_BUTTON_WINDOWLIST
326        """ Shows a window list button on the pane (for AuiNotebook). """
327        aui.AUI_BUTTON_LEFT
328        """ Shows a left button on the pane (for AuiNotebook). """
329        aui.AUI_BUTTON_RIGHT
330        """ Shows a right button on the pane (for AuiNotebook). """
331        aui.AUI_BUTTON_UP
332        """ Shows an up button on the pane (not implemented). """
333        aui.AUI_BUTTON_DOWN
334        """ Shows a down button on the pane (not implemented). """
335        aui.AUI_BUTTON_CUSTOM1
336        """ Shows a custom button on the pane. """
337        aui.AUI_BUTTON_CUSTOM2
338        """ Shows a custom button on the pane. """
339        aui.AUI_BUTTON_CUSTOM3
340        """ Shows a custom button on the pane. """
341        aui.AUI_BUTTON_CUSTOM4
342        """ Shows a custom button on the pane. """
343        aui.AUI_BUTTON_CUSTOM5
344        """ Shows a custom button on the pane. """
345        aui.AUI_BUTTON_CUSTOM6
346        """ Shows a custom button on the pane. """
347        aui.AUI_BUTTON_CUSTOM7
348        """ Shows a custom button on the pane. """
349        aui.AUI_BUTTON_CUSTOM8
350        """ Shows a custom button on the pane. """
351        aui.AUI_BUTTON_CUSTOM9
352        """ Shows a custom button on the pane. """
353
354        # Pane Insert Level
355        aui.AUI_INSERT_PANE
356        """ Level for inserting a pane. """
357        aui.AUI_INSERT_ROW
358        """ Level for inserting a row. """
359        aui.AUI_INSERT_DOCK
360        """ Level for inserting a dock. """
361
362        # ------------------------ #
363        # - AuiToolBar Constants - #
364        # ------------------------ #
365
366        aui.ITEM_CONTROL
367        """ The item in the AuiToolBar is a control. """
368        aui.ITEM_LABEL
369        """ The item in the AuiToolBar is a text label. """
370        aui.ITEM_SPACER
371        """ The item in the AuiToolBar is a spacer. """
372        aui.ITEM_SEPARATOR
373        """ The item in the AuiToolBar is a separator. """
374        aui.ITEM_CHECK
375        """ The item in the AuiToolBar is a toolbar check item. """
376        aui.ITEM_NORMAL
377        """ The item in the AuiToolBar is a standard toolbar item. """
378        aui.ITEM_RADIO
379        """ The item in the AuiToolBar is a toolbar radio item. """
380        aui.ID_RESTORE_FRAME
381        """ Identifier for restoring a minimized pane. """
382
383        aui.BUTTON_DROPDOWN_WIDTH
384        """ Width of the drop-down button in AuiToolBar. """
385
386        aui.DISABLED_TEXT_GREY_HUE
387        """ Hue text colour for the disabled text in AuiToolBar. """
388        aui.DISABLED_TEXT_COLOUR
389        """ Text colour for the disabled text in AuiToolBar. """
390
391        aui.AUI_TB_TEXT
392        """ Shows the text in the toolbar buttons; by default only icons are shown. """
393        aui.AUI_TB_NO_TOOLTIPS
394        """ Don't show tooltips on `AuiToolBar` items. """
395        aui.AUI_TB_NO_AUTORESIZE
396        """ Do not auto-resize the `AuiToolBar`. """
397        aui.AUI_TB_GRIPPER
398        """ Shows a gripper on the `AuiToolBar`. """
399        aui.AUI_TB_OVERFLOW
400        """ The `AuiToolBar` can contain overflow items. """
401        aui.AUI_TB_VERTICAL
402        """ The `AuiToolBar` is vertical. """
403        aui.AUI_TB_HORZ_LAYOUT
404        """ Shows the text and the icons alongside, not vertically stacked.
405        This style must be used with ``AUI_TB_TEXT``. """
406        aui.AUI_TB_PLAIN_BACKGROUND
407        """ Don't draw a gradient background on the toolbar. """
408        aui.AUI_TB_CLOCKWISE
409        aui.AUI_TB_COUNTERCLOCKWISE
410
411        aui.AUI_TB_HORZ_TEXT
412        """ Combination of ``AUI_TB_HORZ_LAYOUT`` and ``AUI_TB_TEXT``. """
413        aui.AUI_TB_VERT_TEXT
414
415        aui.AUI_TB_DEFAULT_STYLE
416        """ `AuiToolBar` default style. """
417
418        # AuiToolBar settings
419        aui.AUI_TBART_SEPARATOR_SIZE
420        """ Separator size in AuiToolBar. """
421        aui.AUI_TBART_GRIPPER_SIZE
422        """ Gripper size in AuiToolBar. """
423        aui.AUI_TBART_OVERFLOW_SIZE
424        """ Overflow button size in AuiToolBar. """
425
426        # AuiToolBar text orientation
427        aui.AUI_TBTOOL_TEXT_LEFT
428        """ Text in AuiToolBar items is aligned left. """
429        aui.AUI_TBTOOL_TEXT_RIGHT
430        """ Text in AuiToolBar items is aligned right. """
431        aui.AUI_TBTOOL_TEXT_TOP
432        """ Text in AuiToolBar items is aligned top. """
433        aui.AUI_TBTOOL_TEXT_BOTTOM
434        """ Text in AuiToolBar items is aligned bottom. """
435
436        # AuiToolBar tool orientation
437        aui.AUI_TBTOOL_HORIZONTAL
438        aui.AUI_TBTOOL_VERT_CLOCKWISE
439        aui.AUI_TBTOOL_VERT_COUNTERCLOCKWISE
440
441        # ------------------------------- #
442        # - AuiSwitcherDialog Constants - #
443        # ------------------------------- #
444
445        aui.SWITCHER_TEXT_MARGIN_X
446        aui.SWITCHER_TEXT_MARGIN_Y
447
448
449#---------------------------------------------------------------------------
450
451if __name__ == '__main__':
452    unittest.main()
453