AGW Logo

svn SVN Revision 69086 For buttonpanel

This file contains the SVN revision history for buttonpanel, at revision 69086.

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: 17-Oct-2008 19:15:31 UTC
  • Committer: AG
  • File Size: 96342 byte(s)

svn_log Log Messages

The following log message was entered by the committer:

  • Fixed bug #13437 for SuperToolTip;
  • Fixed bug #13477 for UltimateListCtrl.

svn_diff Diff To Previous Version (68933)

Version SVN diff:

--- wxPython/3rdParty/AGW/agw/buttonpanel.py        2011/08/27 17:11:41     68933
+++ wxPython/3rdParty/AGW/agw/buttonpanel.py        2011/09/14 19:39:08     69086
@@ -272,7 +272,9 @@
Brighten the input colour by a factor.

:param `colour`: a valid `wx.Colour` instance;
-    :param `factor`: the factor by which the input colour should be brightened.
+    :param integer `factor`: the factor by which the input colour should be brightened.
+
+    :return: An instance of `wx.Colour`, a brightened version of the input `colour`.
"""

val = colour.Red()*factor
@@ -303,6 +305,8 @@
Creates a disabled-looking bitmap starting from the input one.

:param `original`: an instance of `wx.Bitmap` to be greyed-out.
+
+    :return: A greyed-out representation of the input bitmap, an instance of `wx.Bitmap`.
"""

img = original.ConvertToImage()
@@ -326,7 +330,7 @@
"""
Default class constructor.

-        :param `parentStyle`: the window style for L{ButtonPanel}.
+        :param integer `parentStyle`: the window style for L{ButtonPanel}.
"""

base_colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE)
@@ -368,7 +372,7 @@
"""
Returns the option value for the specified size `id`.

-        :param `id`: the identification bit for the size value. This can be one of the
+        :param integer `id`: the identification bit for the size value. This can be one of the
following bits:

============================== ======= =====================================
@@ -380,6 +384,9 @@
``BP_PADDING_SIZE``                 17 Inter-tool separator size
============================== ======= =====================================

+        :return: An integer representing the option value for the input `id`.
+
+        :raise: `Exception` if the `id` is not recognized.
"""

if id == BP_SEPARATOR_SIZE:
@@ -398,8 +405,10 @@
"""
Sets the option value for the specified size `id`.

-        :param `id`: the identification bit for the size value;
-        :param `new_val`: the new value for the size.
+        :param integer `id`: the identification bit for the size value;
+        :param input`new_val`: the new value for the size.
+
+        :raise: `Exception` if the `id` is not recognized.

:see: L{GetMetric} for a list of meaningful size ids.
"""
@@ -421,7 +430,7 @@
"""
Returns the option value for the specified colour `id`.

-        :param `id`: the identification bit for the colour value. This can be one of the
+        :param internal`id`: the identification bit for the colour value. This can be one of the
following bits:

================================== ======= =====================================
@@ -439,6 +448,9 @@
``BP_SEPARATOR_COLOUR``                  9 Pen colour used to paint the separators
================================== ======= =====================================

+        :return: An instance of `wx.Colour` for the input `id`.
+
+        :raise: `Exception` if the `id` is not recognized.
"""

if id == BP_BACKGROUND_COLOUR:
@@ -469,9 +481,11 @@
"""
Sets the option value for the specified colour `id`.

-        :param `id`: the identification bit for the colour value;
+        :param integer `id`: the identification bit for the colour value;
:param `colour`: the new value for the colour (a valid `wx.Colour` instance).

+        :raise: `Exception` if the `id` is not recognized.
+
:see: L{GetColour} for a list of meaningful colour ids.
"""

@@ -507,7 +521,7 @@
"""
Returns the option value for the specified font `id`.

-        :param `id`: the identification bit for the font value. This can be one of the
+        :param integer `id`: the identification bit for the font value. This can be one of the
following bits:

============================== ======= =====================================
@@ -516,7 +530,10 @@
``BP_TEXT_FONT``                    10 Font of the L{ButtonPanel} main caption
``BP_BUTTONTEXT_FONT``              11 Text font for the buttons with text
============================== ======= =====================================
-
+
+        :return: An instance of `wx.Font` for the input `id`.
+
+        :raise: `Exception` if the `id` is not recognized.
"""

if id == BP_TEXT_FONT:
@@ -531,9 +548,11 @@
"""
Sets the option value for the specified font `id`.

-        :param `id`: the identification bit for the font value;
+        :param integer `id`: the identification bit for the font value;
:param `colour`: the new value for the font (a valid `wx.Font` instance).

+        :raise: `Exception` if the `id` is not recognized.
+
:see: L{GetFont} for a list of meaningful font ids.
"""

@@ -547,7 +566,7 @@
"""
Sets the gradient type for L{BPArt} drawings.

-        :param `gradient`: can be one of the following bits:
+        :param integer `gradient`: can be one of the following bits:

============================ ======= ============================
Gradient Type                 Value  Description
@@ -566,6 +585,8 @@
"""
Returns the gradient type for L{BPArt} drawings.

+        :return: An integer representing the gradient type.
+
:see: L{SetGradientType} for a list of possible gradient types.
"""

@@ -577,8 +598,8 @@
Draws a separator in L{ButtonPanel}.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the separator client rectangle;
-        :param `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
+        :param `wx.Rect` `rect`: the separator client rectangle;
+        :param bool `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
``False`` otherwise.
"""

@@ -601,8 +622,8 @@
Draws the main caption text in L{ButtonPanel}.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the main caption text rectangle;
-        :param `captionText`: the caption text string.
+        :param `wx.Rect` `rect`: the main caption text rectangle;
+        :param string `captionText`: the caption text string.
"""

textColour = self._caption_text_colour
@@ -621,14 +642,14 @@
Draws a button in L{ButtonPanel}, together with its text (if any).

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the button client rectangle;
-        :param `buttonBitmap`: the bitmap associated with the button;
-        :param `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
+        :param `wx.Rect` `rect`: the button client rectangle;
+        :param `wx.Bitmap` `buttonBitmap`: the bitmap associated with the button;
+        :param bool `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
``False`` otherwise;
-        :param `buttonStatus`: one of "Normal", "Toggled", "Pressed", "Disabled" or "Hover";
-        :param `isToggled`: whether the button is toggled or not;
-        :param `textAlignment`: the text alignment inside the button;
-        :param `text`: the button label.
+        :param string `buttonStatus`: one of "Normal", "Toggled", "Pressed", "Disabled" or "Hover";
+        :param bool `isToggled`: whether the button is toggled or not;
+        :param integer `textAlignment`: the text alignment inside the button;
+        :param string `text`: the button label.
"""

bmpxsize, bmpysize = buttonBitmap.GetWidth(), buttonBitmap.GetHeight()
@@ -712,10 +733,10 @@
Draws the label for a button.

:param `dc`: an instance of `wx.DC`;
-        :param `text`: the button label;
-        :param `isEnabled`: ``True`` if the button is enabled, ``False`` otherwise;
-        :param `xpos`: the text x position inside the button;
-        :param `ypos`: the text y position inside the button.
+        :param string `text`: the button label;
+        :param bool `isEnabled`: ``True`` if the button is enabled, ``False`` otherwise;
+        :param integer `xpos`: the text `x` position inside the button;
+        :param integer `ypos`: the text `y` position inside the button.
"""

if not isEnabled:
@@ -731,8 +752,8 @@
Paint the L{ButtonPanel}'s background.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the L{ButtonPanel} client rectangle;
-        :param `style`: the L{ButtonPanel} window style.
+        :param `wx.Rect` `rect`: the L{ButtonPanel} client rectangle;
+        :param integer `style`: the L{ButtonPanel} window style.
"""

if style & BP_USE_GRADIENT:
@@ -753,7 +774,7 @@
Gradient fill from colour 1 to colour 2 with top to bottom or left to right.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the L{ButtonPanel} client rectangle.
+        :param `wx.Rect` `rect`: the L{ButtonPanel} client rectangle.
"""

if rect.height < 1 or rect.width < 1:
@@ -795,6 +816,8 @@
"""
Default class constructor.
For internal use: do not call it in your code!
+
+        :param `owner`: an instance of L{ButtonPanel}.
"""

wx.Timer.__init__(self)
@@ -817,11 +840,11 @@
"""
Default class constructor.

-        :param `parent`: the control parent object;
-        :param `size`: the control size. ``wx.DefaultSize`` indicates that wxPython should
-         generate a default size for the window. If no suitable size can be found, the
-         window will be sized to 20x20 pixels so that the window is visible but obviously
-         not correctly sized.
+        :param `wx.Window` `parent`: the control parent object. Must not be ``None``;
+        :param `size`: the control size. A value of (-1, -1) indicates a default size,
+         chosen by either the windowing system or wxPython, depending on platform;
+        :type `size`: tuple or `wx.Size`
+        :param integer `id`: window identifier. A value of -1 indicates a default value.
"""

wx.EvtHandler.__init__(self)
@@ -842,7 +865,7 @@
"""
Shows or hide the control.

-        :param `show`: If ``True`` displays the window. Otherwise, it hides it.
+        :param bool `show`: If ``True`` displays the window. Otherwise, it hides it.
"""

self._isshown = show
@@ -868,6 +891,8 @@
"""
Returns the identifier of the window.

+        :return: An integer representing the identifier of the window.
+
:note: Each window has an integer identifier. If the application has not provided
one (or the default ``wx.ID_ANY``) an unique identifier with a negative value will
be generated.
@@ -883,6 +908,8 @@
label is not truncated. For windows containing subwindows (typically `wx.Panel`),
the size returned by this function will be the same as the size the window would
have had after calling `Fit()`.
+
+        :return: An instance of `wx.Size`.
"""

return self._size
@@ -905,7 +932,7 @@
"""
Enable or disable the window for user input.

-        :param `enable`: If ``True``, enables the window for input. If ``False``, disables the window.
+        :param bool `enable`: If ``True``, enables the window for input. If ``False``, disables the window.

:returns: ``True`` if the window has been enabled or disabled, ``False`` if nothing was
done, i.e. if the window had already been in the specified state.
@@ -922,14 +949,18 @@
"""
Sets or kills the focus on the control.

-        :param `focus`: whether the control can receive keyboard inputs or not.
+        :param bool `focus`: whether the control can receive keyboard inputs or not.
"""

self._focus = focus


def HasFocus(self):
-        """ Returns whether the control has the focus or not. """
+        """
+        Returns whether the control has the focus or not.
+
+        :return: ``True`` if the control has the focus, ``False`` otherwise.
+        """

return self._focus

@@ -938,8 +969,8 @@
"""
Handles the ``wx.EVT_MOUSE_EVENTS`` events for the control.

-        :param `x`: the mouse x position;
-        :param `y`: the mouse y position;
+        :param integer `x`: the mouse `x` position;
+        :param integer `y`: the mouse `y` position;
:param `event`: the `wx.MouseEvent` event to be processed.
"""

@@ -950,7 +981,7 @@
"""
Handles the drawing of the control.

-        :param `rect`: the control client rectangle.
+        :param `wx.Rect` `rect`: the control client rectangle.
"""

pass
@@ -986,6 +1017,8 @@
def GetBestSize(self):
"""
This functions returns the best acceptable minimal size for the sizer object.
+
+        :return: An instance of `wx.Size`.
"""

# this should be handled by the wx.Sizer based class
@@ -1000,7 +1033,7 @@
"""
Constructor for L{BoxSizer}.

-        :param `orient`: may be one of ``wx.VERTICAL`` or ``wx.HORIZONTAL`` for creating
+        :param integer `orient`: may be one of ``wx.VERTICAL`` or ``wx.HORIZONTAL`` for creating
either a column sizer or a row sizer.
"""

@@ -1018,14 +1051,14 @@

:param `item`: the item to be added to L{BoxSizer}. Can be an instance of `wx.Window`,
`wx.Sizer` or a spacer;
-        :param `proportion`: this parameter is used in L{BoxSizer} to indicate if a child of
+        :param integer `proportion`: this parameter is used in L{BoxSizer} to indicate if a child of
a sizer can change its size in the main orientation of the L{BoxSizer} - where 0
stands for not changeable and a value of more than zero is interpreted relative
to the value of other children of the same L{BoxSizer}. For example, you might have
a horizontal L{BoxSizer} with three children, two of which are supposed to change their
size with the sizer. Then the two stretchable windows would get a value of 1 each to
make them grow and shrink equally with the sizer's horizontal dimension.
-        :param `flag`: this parameter can be used to set a number of flags which can be combined using the binary OR operator ``|``.
+        :param integer `flag`: this parameter can be used to set a number of flags which can be combined using the binary OR operator ``|``.
Two main behaviours are defined using these flags. One is the border around a window: the border parameter determines the border
width whereas the flags given here determine which side(s) of the item that the border will be added. The other flags determine
how the sizer item behaves when the space allotted to the sizer changes, and is somewhat dependent on the specific kind of sizer used:
@@ -1050,7 +1083,7 @@
|                                                                     | maintaining its aspect ratio                                                |
+---------------------------------------------------------------------+-----------------------------------------------------------------------------+
| ``wx.FIXED_MINSIZE``                                                | Normally `wx.Sizers` will use                                               |
-         |                                                                     | `wx.Window.GetAdjustedBestSize` to                                          |
+         |                                                                     | ``wx.Window.GetAdjustedBestSize`` to                                        |
|                                                                     | determine what the minimal size of window items should be, and will use that|
|                                                                     | size to calculate the layout. This allows layouts to adjust when an item    |
|                                                                     | changes and its best size becomes different. If you would rather have a     |
@@ -1077,9 +1110,9 @@
| ``wx.ALIGN_CENTER_HORIZONTAL`` **or** ``wx.ALIGN_CENTRE_HORIZONTAL``|                                                                             |
+---------------------------------------------------------------------+-----------------------------------------------------------------------------+

-        :param `border`: determines the border width, if the flag parameter is set
+        :param integer `border`: determines the border width, if the flag parameter is set
to include any border flag.
-        :param `userData`: Allows an extra object to be attached to the sizer item,
+        :param object `userData`: Allows an extra object to be attached to the sizer item,
for use in derived classes when sizing information is more complex than the
proportion and flag will allow for.

@@ -1152,8 +1185,8 @@
L{BoxSizer.Layout} to update the layout on screen after removing a child from
the sizer.

-        :param `indx`: the zero-based index of an item to remove;
-        :param `pop`: whether to remove the sizer item from the list of children.
+        :param integer `indx`: the zero-based index of an item to remove;
+        :param bool `pop`: whether to remove the sizer item from the list of children.
"""

if pop >= 0:
@@ -1182,7 +1215,7 @@
Shows or hides the sizer item.

:param `item`: the sizer item we want to show/hide;
-        :param `show`: ``True`` to show the item, ``False`` to hide it.
+        :param bool `show`: ``True`` to show the item, ``False`` to hide it.
"""

child = self.GetChildren()[item]
@@ -1208,7 +1241,7 @@
"""
Default class constructor.

-        :param `parent`: the separator parent object.
+        :param `parent`: the separator parent object, an instance of L{ButtonPanel}.
"""

self._isshown = True
@@ -1217,7 +1250,11 @@


def GetBestSize(self):
-        """ Returns the separator best size. """
+        """
+        Returns the separator best size.
+
+        :return: An instance of `wx.Size`.
+        """

# 10 is completely arbitrary, but it works anyhow
if self._parent.IsVertical():
@@ -1231,7 +1268,7 @@
Draws the separator. Actually the drawing is done in L{BPArt}.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the separator client rectangle.
+        :param `wx.Rect` `rect`: the separator client rectangle.
"""

if not self.IsShown():
@@ -1253,8 +1290,8 @@
"""
Default class constructor.

-        :param `parent`: the text parent object;
-        :param `text`: the actual main caption string.
+        :param `parent`: the text parent object, an instance of L{ButtonPanel};
+        :param string `text`: the actual main caption string.
"""

self._text = text
@@ -1265,7 +1302,11 @@


def GetText(self):
-        """ Returns the caption text. """
+        """
+        Returns the caption text.
+
+        :return: A string representing the caption text.
+        """

return self._text

@@ -1274,7 +1315,7 @@
"""
Sets the caption text.

-        :param `text`: the main caption string.
+        :param string `text`: the main caption string.
"""

self._text = text
@@ -1291,7 +1332,11 @@


def GetBestSize(self):
-        """ Returns the best size for the main caption in L{ButtonPanel}. """
+        """
+        Returns the best size for the main caption in L{ButtonPanel}.
+
+        :return: An instance of `wx.Size`.
+        """

if self._text == "":
return wx.Size(0, 0)
@@ -1311,7 +1356,7 @@
Draws the main caption. Actually the drawing is done in L{BPArt}.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the main caption text client rectangle.
+        :param `wx.Rect` `rect`: the main caption text client rectangle.
"""

if not self.IsShown():
@@ -1339,14 +1384,14 @@
Default class constructor.

:param `parent`: the parent window (L{ButtonPanel});
-        :param `id`: the button id;
-        :param `bmp`: the associated bitmap;
-        :param `status`: button status ("Pressed", "Hover", "Normal", "Toggled", "Disabled");
-        :param `text`: text to be displayed either below of to the right of the button;
-        :param `kind`: button kind, may be ``wx.ITEM_NORMAL`` for standard buttons or
+        :param integer `id`: the button id;
+        :param `wx.Bitmap` `bmp`: the associated bitmap;
+        :param string `status`: button status ("Pressed", "Hover", "Normal", "Toggled", "Disabled");
+        :param string `text`: text to be displayed either below of to the right of the button;
+        :param integer `kind`: button kind, may be ``wx.ITEM_NORMAL`` for standard buttons or
``wx.ITEM_CHECK`` for toggle buttons;
-        :param `shortHelp`: a short help to be shown in the button tooltip;
-        :param `longHelp`: this string is shown in the statusbar (if any) of the parent
+        :param string `shortHelp`: a short help to be shown in the button tooltip;
+        :param string `longHelp`: this string is shown in the statusbar (if any) of the parent
frame when the mouse pointer is inside the button.
"""

@@ -1374,7 +1419,11 @@


def GetBestSize(self):
-        """ Returns the best size for the button. """
+        """
+        Returns the best size for the button.
+
+        :return: An instance of `wx.Size`.
+        """

xsize = self.GetBitmap().GetWidth()
ysize = self.GetBitmap().GetHeight()
@@ -1411,7 +1460,7 @@
Draws the button on L{ButtonPanel}. Actually the drawing is done in L{BPArt}.

:param `dc`: an instance of `wx.DC`;
-        :param `rect`: the main caption text client rectangle.
+        :param `wx.Rect` `rect`: the main caption text client rectangle.
"""

if not self.IsShown():
@@ -1434,7 +1483,7 @@
"""
Checks whether a L{ButtonPanel} repaint is needed or not. This is a convenience function.

-        :param `status`: the status of a newly added L{ButtonInfo} or a change in the
+        :param bool `status`: the status of a newly added L{ButtonInfo} or a change in the
L{ButtonInfo} status.
"""

@@ -1447,7 +1496,7 @@
Sets the bitmap associated with this instance of L{ButtonInfo}.

:param `bmp`: a valid `wx.Bitmap` object;
-        :param `status`: the L{ButtonInfo} status ("Pressed", "Hover", "Normal",
+        :param string `status`: the L{ButtonInfo} status ("Pressed", "Hover", "Normal",
"Toggled", "Disabled").
"""

@@ -1459,8 +1508,10 @@
"""
Returns the bitmap associated with this instance of L{ButtonInfo}.

-        :param `status`: the L{ButtonInfo} status ("Pressed", "Hover", "Normal",
+        :param string `status`: the L{ButtonInfo} status ("Pressed", "Hover", "Normal",
"Toggled", "Disabled").
+
+        :return: An instance of `wx.Bitmap`.
"""

if status is None:
@@ -1479,19 +1530,32 @@


def GetRect(self):
-        """ Returns the L{ButtonInfo} client rectangle. """
+        """
+        Returns the L{ButtonInfo} client rectangle.
+
+        :return: An instance of `wx.Rect`.
+        """

return self._rect


def GetStatus(self):
-        """ Returns the L{ButtonInfo} status. """
+        """
+        Returns the L{ButtonInfo} status.
+
+        :return: A string containing the L{ButtonInfo} status (one of "Pressed", "Hover", "Normal",
+         "Toggled", "Disabled").
+        """

return self._status


def GetId(self):
-        """ Returns the L{ButtonInfo} id. """
+        """
+        Returns the L{ButtonInfo} id.
+
+        :return: An integer representing the button id.
+        """

return self._id

@@ -1510,7 +1574,7 @@
"""
Sets the L{ButtonInfo} status.

-        :param `status`: one of "Pressed", "Hover", "Normal", "Toggled", "Disabled".
+        :param string `status`: one of "Pressed", "Hover", "Normal", "Toggled", "Disabled".
"""

if status == self._status:
@@ -1524,7 +1588,11 @@


def GetTextAlignment(self):
-        """ Returns the text alignment in the button (bottom or right). """
+        """
+        Returns the text alignment in the button (bottom or right).
+
+        :return: An integer representing the L{ButtonInfo} text alignment.
+        """

return self._textAlignment

@@ -1533,7 +1601,7 @@
"""
Sets the text alignment in the button (bottom or right).

-        :param `alignment`: the text alignment in this L{ButtonInfo} instance.
+        :param integer `alignment`: the text alignment in this L{ButtonInfo} instance.
"""

if alignment == self._textAlignment:
@@ -1543,7 +1611,11 @@


def GetToggled(self):
-        """ Returns whether a ``wx.ITEM_CHECK`` button is toggled or not. """
+        """
+        Returns whether a ``wx.ITEM_CHECK`` button is toggled or not.
+
+        :return: ``True`` if the button is toggled, ``False`` otherwise.
+        """

if self._kind == wx.ITEM_NORMAL:
return False
@@ -1555,7 +1627,7 @@
"""
Sets a ``wx.ITEM_CHECK`` button toggled/not toggled.

-        :param `toggle`: ``True`` to toggle the button, ``False`` otherwise.
+        :param bool `toggle`: ``True`` to toggle the button, ``False`` otherwise.
"""

if self._kind == wx.ITEM_NORMAL:
@@ -1568,7 +1640,7 @@
"""
Sets the L{ButtonInfo} identifier.

-        :param `id`: the identifier of the window.
+        :param integer `id`: the identifier of the window.
"""

self._id = id
@@ -1584,8 +1656,8 @@
- Pressed;
- Toggled.

-        :param `name`: the new status name;
-        :param `bmp`: the bitmap associated with the new status.
+        :param string `name`: the new status name;
+        :param `wx.Bitmap` `bmp`: the bitmap associated with the new status.
"""

self._bitmaps.update({name: bmp})
@@ -1595,7 +1667,7 @@
"""
Enables/disables this instance of L{ButtonInfo}.

-        :param `enable`: ``True`` to enable the button, ``False`` otherwise.
+        :param bool `enable`: ``True`` to enable the button, ``False`` otherwise.
"""

if enable:
@@ -1617,20 +1689,28 @@
"""
Sets the button label text.

-        :param `text`: the button label string.
+        :param string `text`: the button label string.
"""

self._text = text


def GetText(self):
-        """ Returns the text associated to the button. """
+        """
+        Returns the text associated to the button.
+
+        :return: A string containing the L{ButtonInfo} text.
+        """

return self._text


def HasText(self):
-        """ Returns whether the button has text or not. """
+        """
+        Returns whether the button has text or not.
+
+        :return: ``True`` if this L{ButtonInfo} instance has a label, ``False`` otherwise.
+        """

return self._text != ""

@@ -1639,14 +1719,18 @@
"""
Sets the button type (standard or toggle).

-        :param `kind`: one of ``wx.ITEM_NORMAL``, ``wx.ITEM_CHECK``.
+        :param integer `kind`: one of ``wx.ITEM_NORMAL``, ``wx.ITEM_CHECK``.
"""

self._kind = kind


def GetKind(self):
-        """ Returns the button type (standard or toggle). """
+        """
+        Returns the button type (standard or toggle).
+
+        :return: An integer representing the button type, one of ``wx.ITEM_NORMAL``, ``wx.ITEM_CHECK``.
+        """

return self._kind

@@ -1655,14 +1739,18 @@
"""
Sets the help string to be shown in a tooltip.

-        :param `help`: the string for the short help.
+        :param string `help`: the string for the short help.
"""

self._shortHelp = help


def GetShortHelp(self):
-        """ Returns the help string shown in a tooltip. """
+        """
+        Returns the help string shown in a tooltip.
+
+        :return: A string containing the L{ButtonInfo} short help string.
+        """

return self._shortHelp

@@ -1671,14 +1759,18 @@
"""
Sets the help string to be shown in the statusbar.

-        :param `help`: the string for the long help.
+        :param string `help`: the string for the long help.
"""

self._longHelp = help


def GetLongHelp(self):
-        """ Returns the help string shown in the statusbar. """
+        """
+        Returns the help string shown in the statusbar.
+
+        :return: A string containing the L{ButtonInfo} long help string.
+        """

return self._longHelp

@@ -1703,12 +1795,12 @@
"""
Default class constructor.

-        :param `parent`: the parent window;
-        :param `id`: window identifier. If ``wx.ID_ANY``, will automatically create an identifier;
-        :param `text`: the main caption text for L{ButtonPanel};
-        :param `agwStyle`: the AGW-specific window style (one of ``BP_DEFAULT_STYLE``, ``BP_USE_GRADIENT``);
-        :param `alignment`: alignment of buttons (left or right);
-        :param `name`: window class name.
+        :param `wx.Window` `parent`: the parent window. Must not be ``None``;
+        :param integer `id`: window identifier. If ``wx.ID_ANY``, will automatically create an identifier;
+        :param string `text`: the main caption text for L{ButtonPanel};
+        :param integer `agwStyle`: the AGW-specific window style (one of ``BP_DEFAULT_STYLE``, ``BP_USE_GRADIENT``);
+        :param integer `alignment`: alignment of buttons (left or right);
+        :param string `name`: window class name.
"""

wx.PyPanel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize,
@@ -1758,7 +1850,7 @@
"""
Sets the main caption text.

-        :param `text`: the main caption text label. An empty string erases the
+        :param string `text`: the main caption text label. An empty string erases the
main caption text.
"""

@@ -1818,13 +1910,21 @@


def GetBarText(self):
-        """ Returns the main caption text. """
+        """
+        Returns the main caption text.
+
+        :return: A string representing the caption text.
+        """

return self._text.GetText()


def HasBarText(self):
-        """ Returns whether L{ButtonPanel} has a main caption text or not. """
+        """
+        Returns whether L{ButtonPanel} has a main caption text or not.
+
+        :return: ``True`` if L{ButtonPanel} has a main caption text, ``False`` otherwise.
+        """

return hasattr(self, "_text") and self._text.GetText() != ""

@@ -1849,10 +1949,10 @@
"""
Adds a spacer (stretchable or fixed-size) to L{ButtonPanel}.

-        :param `size`: the spacer size as a tuple;
-        :param `proportion`: the spacer proportion (0 for fixed-size, 1 or more for a
+        :param tuple `size`: the spacer size as a tuple;
+        :param integer `proportion`: the spacer proportion (0 for fixed-size, 1 or more for a
stretchable one);
-        :param `flag`: one of the `wx.BoxSizer` flags.
+        :param integer `flag`: one of the `wx.BoxSizer` flags.
"""

lenChildren = len(self._mainsizer.GetChildren())
@@ -1864,10 +1964,10 @@
Adds a wxPython control to L{ButtonPanel}.

:param `control`: an instance of `wx.Window`;
-        :param `proportion`: the control proportion (0 for fixed-size, 1 or more for a
+        :param integer `proportion`: the control proportion (0 for fixed-size, 1 or more for a
stretchable one);
-        :param `flag`: one of the `wx.BoxSizer` flags;
-        :param `border`: the control border width (in pixels), if the `flag` parameter
+        :param integer `flag`: one of the `wx.BoxSizer` flags;
+        :param integer `border`: the control border width (in pixels), if the `flag` parameter
is set to include any border flag.
"""

@@ -1894,7 +1994,7 @@
"""
Remove all the buttons from L{ButtonPanel}.

-        :note: This function is only for internal use only. If you are interested in
+        :note: This function is for internal use only. If you are interested in
manipulating a L{ButtonPanel} in real time (ie. removing things on it)
have a look at the L{Clear} method.
"""
@@ -1906,7 +2006,7 @@
"""
Remove all the separators from L{ButtonPanel}.

-        :note: This function is only for internal use only. If you are interested in
+        :note: This function is for internal use only. If you are interested in
manipulating a L{ButtonPanel} in real time (ie. removing things on it)
have a look at the L{Clear} method.
"""
@@ -1938,6 +2038,8 @@
"""
Returns the buttons alignment.

+        :return: An integer specifying the buttons alignment.
+
:see: L{SetAlignment} for a set of valid alignment bits.
"""

@@ -1948,7 +2050,7 @@
"""
Sets the buttons alignment.

-        :param `alignment`: can be one of the following bits:
+        :param integer `alignment`: can be one of the following bits:

====================== ======= ==========================
Alignment Flag          Value  Description
@@ -1981,13 +2083,21 @@


def IsVertical(self):
-        """ Returns whether L{ButtonPanel} is vertically aligned or not. """
+        """
+        Returns whether L{ButtonPanel} is vertically aligned or not.
+
+        :return: ``True`` if L{ButtonPanel} is vertically aligned, ``False`` otherwise.
+        """

return self._alignment not in [BP_ALIGN_RIGHT, BP_ALIGN_LEFT]


def IsStandard(self):
-        """ Returns whether L{ButtonPanel} is aligned "Standard" (left/top) or not. """
+        """
+        Returns whether L{ButtonPanel} is aligned "Standard" (left/top) or not.
+
+        :return: ``True`` if L{ButtonPanel} is aligned "standard", ``False`` otherwise.
+        """

return self._alignment in [BP_ALIGN_LEFT, BP_ALIGN_TOP]

@@ -2023,7 +2133,7 @@
"""
Recreates the L{ButtonPanel} sizer accordingly to the alignment specified.

-        :param `text`: the text to display as main caption. If `text` is set to ``None``,
+        :param string `text`: the text to display as main caption. If `text` is set to ``None``,
the main caption will not be displayed.
"""

@@ -2080,6 +2190,8 @@
the minimal size which doesn't truncate the control, for a panel - the
same size as it would have after a call to `Fit()`.

+        :return: An instance of `wx.Size`.
+
:note: Overridden from `wx.PyPanel`.
"""

@@ -2200,8 +2312,8 @@
"""
Layout the items when no main caption exists.

-        :param `nonspacers`: a list of items which are not spacers;
-        :param `children`: a list of all the children of L{ButtonPanel}.
+        :param list `nonspacers`: a list of items which are not spacers;
+        :param list `children`: a list of all the children of L{ButtonPanel}.
"""

size = self.GetSize()
@@ -2227,8 +2339,10 @@
Returns the size of an item in the main L{ButtonPanel} sizer.

:param `item`: an instance of L{ButtonInfo};
-        :param `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
+        :param bool `isVertical`: ``True`` if L{ButtonPanel} is in vertical orientation,
``False`` otherwise.
+
+        :return: An instance of `wx.Size`.
"""

if item.GetUserData():
@@ -2241,8 +2355,8 @@
"""
Layout the items when the main caption exists.

-        :param `nonspacers`: a list of items which are not spacers;
-        :param `allchildren`: a list of all the children of L{ButtonPanel}.
+        :param list `nonspacers`: a list of items which are not spacers;
+        :param list `allchildren`: a list of all the children of L{ButtonPanel}.
"""

if len(nonspacers) < 2:
@@ -2288,6 +2402,8 @@
"""
Returns all the L{ButtonPanel} main sizer's children that are not
flexible spacers.
+
+        :return: A list of items inside L{ButtonPanel} that are not flexible spacers.
"""

children1 = []
@@ -2304,7 +2420,11 @@


def GetControls(self):
-        """ Returns the wxPython controls that belongs to L{ButtonPanel}. """
+        """
+        Returns the wxPython controls that belongs to L{ButtonPanel}.
+
+        :return: A list of items inside L{ButtonPanel} that are wxPython controls.
+        """

children2 = self._mainsizer.GetChildren()
children1 = [child for child in children2 if not child.IsSpacer()]
@@ -2316,7 +2436,7 @@
"""
Sets the L{ButtonPanel} window style.

-        :param `agwStyle`: one of the following bits:
+        :param integer `agwStyle`: one of the following bits:

==================== =========== ==================================================
Window Styles        Hex Value   Description
@@ -2556,7 +2676,7 @@
Sets whether or not short and long help strings should be displayed as tooltips
and `wx.StatusBar` items respectively.

-        :param `useHelp`: ``True`` to display short and long help strings as tooltips
+        :param bool `useHelp`: ``True`` to display short and long help strings as tooltips
and `wx.StatusBar` items respectively, ``False`` otherwise.
"""

@@ -2567,6 +2687,9 @@
"""
Returns whether or not short and long help strings should be displayed as tooltips
and `wx.StatusBar` items respectively.
+
+        :return: ``True`` if the short and long help strings should be displayed as tooltips
+         and `wx.StatusBar` items respectively, ``False`` otherwise.
"""

return self._useHelp
Tree

Table Of Contents

Previous topic

SVN Revision 68933 For buttonpanel

Next topic

cubecolourdialog