Skip to content

Commit 1991e29

Browse files
author
Ram Rachum
committed
updated
1 parent 1421733 commit 1991e29

File tree

5 files changed

+76
-21
lines changed

5 files changed

+76
-21
lines changed

garlicsim_wx/garlicsim_wx/general_misc/third_party/aui/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def OnClose(self, event):
200200
enough outside of the notebook to become floating pages;
201201
(k) Implementation of the style ``AUI_NB_DRAW_DND_TAB`` (on by default), which draws an image
202202
representation of a tab while dragging;
203-
(l) Implementation of the style ``AUI_NB_SASH_DCLICK_UNSPLIT``, which unsplit a splitted AuiNotebook
203+
(l) Implementation of the `AuiNotebook` unsplit functionality, which unsplit a splitted AuiNotebook
204204
when double-clicking on a sash;
205205
(m) Possibility to hide all the tabs by calling `HideAllTAbs`;
206206
(n) wxPython controls can now be added inside page tabs by calling `AddControlToPage`, and they can be
@@ -265,7 +265,7 @@ def OnClose(self, event):
265265
266266
AUI library is distributed under the wxPython license.
267267
268-
Latest revision: Andrea Gavana @ 05 Jan 2010, 16.00 GMT
268+
Latest revision: Andrea Gavana @ 20 Feb 2010, 18.00 GMT
269269
270270
Version 1.1.
271271

garlicsim_wx/garlicsim_wx/general_misc/third_party/aui/aui_constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@
216216
floating pages. """
217217
AUI_NB_DRAW_DND_TAB = 1 << 20
218218
""" Draws an image representation of a tab while dragging. """
219-
AUI_NB_SASH_DCLICK_UNSPLIT = 1 << 22
220-
""" Unsplit a splitted `AuiNotebook` when double-clicking on a sash. """
221219

222220
AUI_NB_DEFAULT_STYLE = AUI_NB_TOP | AUI_NB_TAB_SPLIT | AUI_NB_TAB_MOVE | \
223221
AUI_NB_SCROLL_BUTTONS | AUI_NB_CLOSE_ON_ACTIVE_TAB | \

garlicsim_wx/garlicsim_wx/general_misc/third_party/aui/auibook.py

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,6 @@ def SetFlags(self, flags):
894894
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
895895
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
896896
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
897-
``AUI_NB_SASH_DCLICK_UNSPLIT`` Unsplit a splitted AuiNotebook when double-clicking on a sash.
898897
==================================== ==================================
899898
900899
:todo: Implementation of flags ``AUI_NB_RIGHT`` and ``AUI_NB_LEFT``.
@@ -1716,6 +1715,8 @@ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Default
17161715
self._hover_button = None
17171716
self._pressed_button = None
17181717
self._drag_image = None
1718+
self._drag_img_offset = (0, 0)
1719+
self._on_button = False
17191720

17201721
self.Bind(wx.EVT_PAINT, self.OnPaint)
17211722
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
@@ -1833,6 +1834,7 @@ def OnLeftDown(self, event):
18331834
if self._hover_button:
18341835
self._pressed_button = self._hover_button
18351836
self._pressed_button.cur_state = AUI_BUTTON_STATE_PRESSED
1837+
self._on_button = True
18361838
self.Refresh()
18371839
self.Update()
18381840

@@ -1846,6 +1848,7 @@ def OnCaptureLost(self, event):
18461848

18471849
if self._is_dragging:
18481850
self._is_dragging = False
1851+
self._on_button = False
18491852

18501853
if self._drag_image:
18511854
self._drag_image.EndDrag()
@@ -1865,6 +1868,8 @@ def OnLeftUp(self, event):
18651868
18661869
:param `event`: a `wx.MouseEvent` event to be processed.
18671870
"""
1871+
1872+
self._on_button = False
18681873

18691874
if self.HasCapture():
18701875
self.ReleaseMouse()
@@ -2041,6 +2046,9 @@ def OnMotion(self, event):
20412046
self._hover_button = None
20422047
return
20432048

2049+
if self._on_button:
2050+
return
2051+
20442052
if button:
20452053

20462054
if self._hover_button and button != self._hover_button:
@@ -2095,9 +2103,13 @@ def OnMotion(self, event):
20952103
self._drag_image.BeginDrag(wx.Point(0,0), self, fullScreen=True)
20962104
else:
20972105
self._drag_image.BeginDragBounded(wx.Point(0,0), self, self.GetParent())
2098-
2106+
2107+
# Capture the mouse cursor position offset relative to
2108+
# The tab image location
2109+
self._drag_img_offset = (pos[0] - page.rect.x,
2110+
pos[1] - page.rect.y)
2111+
20992112
self._drag_image.Show()
2100-
self._drag_image.Move(pos)
21012113

21022114
if not wnd:
21032115
evt2 = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, self.GetId())
@@ -2115,6 +2127,8 @@ def OnMotion(self, event):
21152127
self.GetEventHandler().ProcessEvent(evt3)
21162128

21172129
if self._drag_image:
2130+
# Apply the drag images offset
2131+
pos -= self._drag_img_offset
21182132
self._drag_image.Move(pos)
21192133

21202134

@@ -2532,7 +2546,6 @@ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Default
25322546
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
25332547
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
25342548
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
2535-
``AUI_NB_SASH_DCLICK_UNSPLIT`` Unsplit a splitted AuiNotebook when double-clicking on a sash.
25362549
==================================== ==================================
25372550
25382551
Default value for `style` is:
@@ -2544,6 +2557,7 @@ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Default
25442557
self._tab_id_counter = AuiBaseTabCtrlId
25452558
self._dummy_wnd = None
25462559
self._hide_tabs = False
2560+
self._sash_dclick_unsplit = False
25472561
self._tab_ctrl_height = 20
25482562
self._requested_bmp_size = wx.Size(-1, -1)
25492563
self._requested_tabctrl_height = -1
@@ -2717,6 +2731,10 @@ def LoadPerspective(self, layout):
27172731
else:
27182732
tab_part = tabs[0:tabs.index('|')]
27192733

2734+
if "=" not in tab_part:
2735+
# No pages in this perspective...
2736+
return False
2737+
27202738
# Get pane name
27212739
pane_name = tab_part[0:tab_part.index("=")]
27222740

@@ -3185,6 +3203,25 @@ def HideAllTabs(self, hidden=True):
31853203
self._hide_tabs = hidden
31863204

31873205

3206+
def SetSashDClickUnsplit(self, unsplit=True):
3207+
"""
3208+
Sets whether to unsplit a splitted L{AuiNotebook} when double-clicking on a sash.
3209+
3210+
:param `unsplit`: ``True`` to unsplit on sash double-clicking, ``False`` otherwise.
3211+
"""
3212+
3213+
self._sash_dclick_unsplit = unsplit
3214+
3215+
3216+
def GetSashDClickUnsplit(self):
3217+
"""
3218+
Returns whether a splitted L{AuiNotebook} can be unsplitted by double-clicking
3219+
on the splitter sash.
3220+
"""
3221+
3222+
return self._sash_dclick_unsplit
3223+
3224+
31883225
def GetPageIndex(self, page_wnd):
31893226
"""
31903227
Returns the page index for the specified window. If the window is not
@@ -3955,7 +3992,7 @@ def UnsplitDClick(self, part, sash_size, pos):
39553992
returns the wrong window. See http://trac.wxwidgets.org/ticket/2942
39563993
"""
39573994

3958-
if not self._flags & AUI_NB_SASH_DCLICK_UNSPLIT:
3995+
if not self._sash_dclick_unsplit:
39593996
# Unsplit not allowed
39603997
return
39613998

@@ -4000,7 +4037,7 @@ def UnsplitDClick(self, part, sash_size, pos):
40004037
selection = -1
40014038
page_count = dest_tabs.GetPageCount()
40024039

4003-
for page in xrange(src_tabs.GetPageCount()):
4040+
for page in xrange(src_tabs.GetPageCount()-1, -1, -1):
40044041
# remove the page from the source tabs
40054042
page_info = src_tabs.GetPage(page)
40064043
if page_info.active:
@@ -4017,6 +4054,7 @@ def UnsplitDClick(self, part, sash_size, pos):
40174054
dest_tabs.DoShowHide()
40184055
self.DoSizing()
40194056
dest_tabs.Refresh()
4057+
self._mgr.Update()
40204058
if selection > 0:
40214059
wx.CallAfter(dest_tabs.MakeTabVisible, selection, self)
40224060

garlicsim_wx/garlicsim_wx/general_misc/third_party/aui/framemanager.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Python Code By:
1414
#
1515
# Andrea Gavana, @ 23 Dec 2005
16-
# Latest Revision: 05 Jan 2010, 16.00 GMT
16+
# Latest Revision: 01 Feb 2010, 15.00 GMT
1717
#
1818
# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
1919
# Write To Me At:
@@ -6213,7 +6213,10 @@ def Update(self):
62136213
p.window.Refresh()
62146214
p.window.Update()
62156215

6216-
self.Repaint()
6216+
if wx.Platform == "__WXMAC__":
6217+
self._frame.Refresh()
6218+
else:
6219+
self.Repaint()
62176220

62186221
if not self._masterManager:
62196222
e = self.FireEvent(wxEVT_AUI_PERSPECTIVE_CHANGED, None, canVeto=False)
@@ -8540,7 +8543,10 @@ def OnSize(self, event):
85408543
if self._frame:
85418544

85428545
self.DoFrameLayout()
8543-
self.Repaint()
8546+
if wx.Platform == "__WXMAC__":
8547+
self._frame.Refresh()
8548+
else:
8549+
self.Repaint()
85448550

85458551
if isinstance(self._frame, wx.MDIParentFrame) or isinstance(self._frame, tabmdi.AuiMDIClientWindow) \
85468552
or isinstance(self._frame, tabmdi.AuiMDIParentFrame):

garlicsim_wx/garlicsim_wx/general_misc/third_party/aui/tabart.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ def SetFlags(self, flags):
202202
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
203203
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
204204
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
205-
``AUI_NB_SASH_DCLICK_UNSPLIT`` Unsplit a splitted AuiNotebook when double-clicking on a sash.
206205
==================================== ==================================
207206
208207
"""
@@ -878,6 +877,7 @@ def ShowDropDown(self, wnd, pages, active_idx):
878877
useImages = self.GetFlags() & AUI_NB_USE_IMAGES_DROPDOWN
879878
menuPopup = wx.Menu()
880879

880+
longest = 0
881881
for i, page in enumerate(pages):
882882

883883
caption = page.caption
@@ -887,6 +887,11 @@ def ShowDropDown(self, wnd, pages, active_idx):
887887
if caption == "":
888888
caption = " "
889889

890+
# Save longest caption width for calculating menu width with
891+
width = wnd.GetTextExtent(caption)[0]
892+
if width > longest:
893+
longest = width
894+
890895
if useImages:
891896
menuItem = wx.MenuItem(menuPopup, 1000+i, caption)
892897
if page.bitmap:
@@ -904,13 +909,23 @@ def ShowDropDown(self, wnd, pages, active_idx):
904909

905910
menuPopup.Check(1000+active_idx, True)
906911

907-
# find out where to put the popup menu of window items
908-
pt = wx.GetMousePosition()
909-
pt = wnd.ScreenToClient(pt)
910-
911912
# find out the screen coordinate at the bottom of the tab ctrl
912913
cli_rect = wnd.GetClientRect()
913-
pt.y = cli_rect.y + cli_rect.height
914+
915+
# Calculate the approximate size of the popupmenu for setting the
916+
# position of the menu when its shown.
917+
# Account for extra padding on left/right of text on mac menus
918+
if wx.Platform in ['__WXMAC__', '__WXMSW__']:
919+
longest += 32
920+
921+
# Bitmap/Checkmark width + padding
922+
longest += 20
923+
924+
if self.GetFlags() & AUI_NB_CLOSE_BUTTON:
925+
longest += 16
926+
927+
pt = wx.Point(cli_rect.x + cli_rect.GetWidth() - longest,
928+
cli_rect.y + cli_rect.height)
914929

915930
cc = AuiCommandCapture()
916931
wnd.PushEventHandler(cc)
@@ -1005,7 +1020,6 @@ def SetFlags(self, flags):
10051020
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
10061021
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
10071022
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
1008-
``AUI_NB_SASH_DCLICK_UNSPLIT`` Unsplit a splitted AuiNotebook when double-clicking on a sash.
10091023
==================================== ==================================
10101024
10111025
"""
@@ -2430,7 +2444,6 @@ def SetFlags(self, flags):
24302444
``AUI_NB_CLOSE_ON_TAB_LEFT`` Draws the tab close button on the left instead of on the right (a la Camino browser)
24312445
``AUI_NB_TAB_FLOAT`` Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
24322446
``AUI_NB_DRAW_DND_TAB`` Draws an image representation of a tab while dragging (on by default)
2433-
``AUI_NB_SASH_DCLICK_UNSPLIT`` Unsplit a splitted AuiNotebook when double-clicking on a sash.
24342447
==================================== ==================================
24352448
24362449
:note: Overridden from L{AuiDefaultTabArt}.

0 commit comments

Comments
 (0)