AGW Logo

svn SVN Revision 68881 For bar

This file contains the SVN revision history for bar, at revision 68881.

Available information include commit date, the name of the committer, the file size, the SVN log messages and a diff from the previous version (if available).


file_info File Information

  • Commit Date: 18-Nov-2009 22:19:25 UTC
  • Committer: AG
  • File Size: 45263 byte(s)

svn_log Log Messages

The following log message was entered by the committer:

  • AGW: General overhaul of the documentation, much improved. All the widgets have their own sample usage in the docs as well;

  • FlatNotebook: Added the FNB_NAV_BUTTONS_WHEN_NEEDED style, which hides the navigation left/right arrows if all tabs fit;

  • RibbonBar: - Added the EVT_RIBBONBAR_TAB_LEFT_DCLICK event, which generates a special event

    when a ribbon bar tab is double-clicked;

    • Added support for toggle buttons;
    • Improved support for ribbon panel sizers: panels with sizers should now automatically minimise at small sizes, and behave properly when popping up from a minimised state;
    • Added tooltips via SetToolTip for those buttons which have the help_string attribute set.
  • XLSGrid: a new widget was added to AGW, termed XLSGrid. It’s based on wx.grid.Grid and can be used to faithfully reproduce the appearance of a Microsoft Excel spreadsheets.


svn_diff Diff To Previous Version (68362)

Version SVN diff:

--- wxPython/3rdParty/AGW/agw/ribbon/bar.py 2011/07/24 21:36:47     68362
+++ wxPython/3rdParty/AGW/agw/ribbon/bar.py 2011/08/25 16:40:17     68881
@@ -9,7 +9,7 @@
# Python Code By:
#
# Andrea Gavana, @ 15 Oct 2009
-# Latest Revision: 12 Sep 2010, 10.00 GMT
+# Latest Revision: 17 Aug 2011, 15.00 GMT
#
# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
# Write To Me At:
@@ -77,6 +77,7 @@
``EVT_RIBBONBAR_TAB_MIDDLE_UP``   Triggered when the middle mouse button is released on a tab.
``EVT_RIBBONBAR_TAB_RIGHT_DOWN``  Triggered when the right mouse button is pressed on a tab.
``EVT_RIBBONBAR_TAB_RIGHT_UP``    Triggered when the right mouse button is released on a tab.
+``EVT_RIBBONBAR_TAB_LEFT_DCLICK`` Triggered when the user double-clicks on a tab.
================================= =================================


@@ -102,6 +103,7 @@
wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP = wx.NewEventType()
wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN = wx.NewEventType()
wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP = wx.NewEventType()
+wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK = wx.NewEventType()

EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, 1)
EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, 1)
@@ -109,6 +111,7 @@
EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, 1)
EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, 1)
EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, 1)
+EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, 1)


def SET_FLAG(variable, flag):
@@ -231,11 +234,13 @@
self._tab_scroll_left_button_state = RIBBON_SCROLL_BTN_NORMAL
self._tab_scroll_right_button_state = RIBBON_SCROLL_BTN_NORMAL
self._tab_scroll_buttons_shown = False
+        self._arePanelsShown = True
self._pages = []

self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
+        self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseDoubleClick)
self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMouseMiddleDown)
self.Bind(wx.EVT_MIDDLE_UP, self.OnMouseMiddleUp)
@@ -302,6 +307,19 @@
return self._pages[self._current_page].page.DismissExpandedPanel()


+    def ShowPanels(self, show=True):
+        """
+        Shows or hides the panels inside L{RibbonBar}.
+
+        :param `show`: ``True`` to show the panels, ``False`` to hide them.
+        """
+
+        self._arePanelsShown = show
+        self.SetMinSize(wx.Size(self.GetSize().GetWidth(), self.DoGetBestSize().GetHeight()))
+        self.Realise()
+        self.GetParent().Layout()
+
+
def SetAGWWindowStyleFlag(self, agwStyle):
"""
Sets the window style for L{RibbonBar}.
@@ -749,6 +767,7 @@
self._tab_scroll_left_button_state = RIBBON_SCROLL_BTN_NORMAL
self._tab_scroll_right_button_state = RIBBON_SCROLL_BTN_NORMAL
self._tab_scroll_buttons_shown = False
+        self._arePanelsShown = True
self._tab_scroll_left_button_rect = wx.Rect()
self._tab_scroll_right_button_rect = wx.Rect()

@@ -922,7 +941,12 @@
elif self._tab_scroll_right_button_rect.Contains(event.GetPosition()):
self._tab_scroll_right_button_state |= RIBBON_SCROLL_BTN_ACTIVE | RIBBON_SCROLL_BTN_HOVERED
self.RefreshTabBar()
-
+
+
+    def OnMouseDoubleClick(self, event):
+
+        self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK)
+

def OnMouseLeftUp(self, event):

@@ -1049,7 +1073,7 @@
min_size.IncBy(0, self._tab_height)

self._minWidth = min_size.GetWidth()
-        self._minHeight = min_size.GetHeight()
+        self._minHeight = (self._arePanelsShown and [min_size.GetHeight()] or [self._tab_height])[0]


def DoGetBestSize(self):
@@ -1064,6 +1088,9 @@
else:
best.IncBy(0, self._tab_height)

+        if not self._arePanelsShown:
+            best.SetHeight(self._tab_height)
+
return best
Tree

Table Of Contents

Previous topic

SVN Revision 68362 For bar

Next topic

ribbon.buttonbar