AGW Logo

svn SVN Revision 68881 For cubecolourdialog

This file contains the SVN revision history for cubecolourdialog, 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: 17-Oct-2008 21:01:24 UTC
  • Committer: AG
  • File Size: 141071 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 (68742)

Version SVN diff:

--- wxPython/3rdParty/AGW/agw/cubecolourdialog.py   2011/08/16 16:37:37     68742
+++ wxPython/3rdParty/AGW/agw/cubecolourdialog.py   2011/08/25 16:40:17     68881
@@ -4,7 +4,7 @@
# Python Code By:
#
# Andrea Gavana, @ 16 Aug 2007
-# Latest Revision: 15 Aug 2011, 20.00 GMT
+# Latest Revision: 17 Aug 2011, 15.00 GMT
#
#
# TODO List
@@ -28,13 +28,13 @@
# --------------------------------------------------------------------------- #

"""
-CubeColourDialog is an alternative implementation of `wx.ColourDialog`.
+L{CubeColourDialog} is an alternative implementation of `wx.ColourDialog`.


Description
===========

-The CubeColourDialog is an alternative implementation of `wx.ColourDialog`, and it
+The L{CubeColourDialog} is an alternative implementation of `wx.ColourDialog`, and it
offers different functionalities with respect to the default wxPython one. It
can be used as a replacement of `wx.ColourDialog` with exactly the same syntax and
methods.
@@ -53,7 +53,7 @@
dialog, via a simple `wx.CheckBox`;
- The "old colour" and "new colour" are displayed in two small custom panel,
which support alpha transparency and texture;
-- CubeColourDialog displays also the HTML colour code in hexadecimal format;
+- L{CubeColourDialog} displays also the HTML colour code in hexadecimal format;
- When available, a corresponding "Web Safe" colour is generated using a 500
web colours "database" (a dictionary inside the widget source code). Web Safe
colours are recognized by all the browsers;
@@ -65,6 +65,42 @@
And much more.


+Usage
+=====
+
+Usage example::
+
+    import wx
+    import wx.lib.agw.cubecolourdialog as CCD
+
+    # Our normal wxApp-derived class, as usual
+    app = wx.App(0)
+
+    colourData = wx.ColourData()
+    dlg = CCD.CubeColourDialog(None, colourData)
+
+    if dlg.ShowModal() == wx.ID_OK:
+
+        # If the user selected OK, then the dialog's wx.ColourData will
+        # contain valid information. Fetch the data ...
+        colourData = dlg.GetColourData()
+        h, s, v, a = dlg.GetHSVAColour()
+
+        # ... then do something with it. The actual colour data will be
+        # returned as a three-tuple (r, g, b) in this particular case.
+        colour = colourData.GetColour()
+        r, g, b, alpha = colour.Red(), colour.Green(), colour.Blue(), colour.Alpha()
+        print "You selected (RGBA): %d, %d, %d, %d"%(r, g, b, alpha)
+        print "You selected (HSVA): %d, %d, %d, %d"%(h, s, v, a)
+
+    # Once the dialog is destroyed, Mr. wx.ColourData is no longer your
+    # friend. Don't use it again!
+    dlg.Destroy()
+
+    app.MainLoop()
+
+
+
Window Styles
=============

@@ -73,7 +109,7 @@
================== =========== ==================================================
Window Styles      Hex Value   Description
================== =========== ==================================================
-``CCD_SHOW_ALPHA``         0x1 Show the widget used to control colour alpha channels in `CubeColourDialog`.
+``CCD_SHOW_ALPHA``         0x1 Show the widget used to control colour alpha channels in L{CubeColourDialog}.
================== =========== ==================================================


@@ -86,9 +122,9 @@
License And Version
===================

-CubeColourDialog is distributed under the wxPython license.
+L{CubeColourDialog} is distributed under the wxPython license.

-Latest Revision: Andrea Gavana @ 15 Aug 2011, 20.00 GMT
+Latest Revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT

Version 0.3.

@@ -113,7 +149,7 @@

# Show the alpha control in the dialog
CCD_SHOW_ALPHA = 1
-""" Show the widget used to control colour alpha channels in `CubeColourDialog`. """
+""" Show the widget used to control colour alpha channels in L{CubeColourDialog}. """

# Radius of the HSB colour wheel
RADIUS = 100
@@ -1744,7 +1780,12 @@


def DoGetBestSize(self):
-        """ Returns the custom control best size (used by sizers). """
+        """
+        Overridden base class virtual. Determines the best size of the
+        control based on the bitmap size.
+
+        :note: Overridden from `wx.PyControl`.
+        """

return wx.Size(self._bitmap.GetWidth(), self._bitmap.GetHeight())

@@ -2172,7 +2213,11 @@


def DoGetBestSize(self):
-        """ Returns the custom control best size (used by sizers). """
+        """
+        Overridden base class virtual. Determines the best size of the control.
+
+        :note: Overridden from `wx.PyControl`.
+        """

return wx.Size(24, 208)

@@ -2580,7 +2625,7 @@

class CustomPanel(wx.PyControl):
"""
-    This panel displays a series of cutom colours (chosen by the user) just like
+    This panel displays a series of custom colours (chosen by the user) just like
the standard `wx.ColourDialog`.
"""

@@ -2631,7 +2676,11 @@


def DoGetBestSize(self):
-        """ Returns the custom control best size (used by sizers). """
+        """
+        Overridden base class virtual. Determines the best size of the control.
+
+        :note: Overridden from `wx.PyControl`.
+        """

return self._customColourRect.width+4, self._customColourRect.height+4
Tree