AGW Logo

svn SVN Revision 68881 For floatspin

This file contains the SVN revision history for floatspin, 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 20:51:43 UTC
  • Committer: AG
  • File Size: 52908 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/floatspin.py  2011/07/24 21:36:47     68362
+++ wxPython/3rdParty/AGW/agw/floatspin.py  2011/08/25 16:40:17     68881
@@ -3,7 +3,7 @@
# Python Code By:
#
# Andrea Gavana, @ 16 Nov 2005
-# Latest Revision: 22 Jul 2011, 21.00 GMT
+# Latest Revision: 17 Aug 2011, 15.00 GMT
#
#
# TODO List/Caveats
@@ -24,16 +24,16 @@


"""
-FloatSpin implements a floating point `wx.SpinCtrl`.
+L{FloatSpin} implements a floating point `wx.SpinCtrl`.


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

-FloatSpin implements a floating point `wx.Spinctrl`. It is built using a custom
+L{FloatSpin} implements a floating point `wx.Spinctrl`. It is built using a custom
`wx.PyControl`, composed by a `wx.TextCtrl` and a `wx.SpinButton`. In order to
correctly handle floating points numbers without rounding errors or non-exact
-floating point representations, FloatSpin uses the great L{FixedPoint} class
+floating point representations, L{FloatSpin} uses the great L{FixedPoint} class
from Tim Peters.

What you can do:
@@ -41,19 +41,53 @@
- Set the number of representative digits for your floating point numbers;
- Set the floating point format (``%f``, ``%F``, ``%e``, ``%E``, ``%g``, ``%G``);
- Set the increment of every ``EVT_FLOATSPIN`` event;
-- Set minimum, maximum values for FloatSpin as well as its range;
+- Set minimum, maximum values for L{FloatSpin} as well as its range;
- Change font and colour for the underline `wx.TextCtrl`.


+Usage
+=====
+
+Usage example::
+
+    import wx
+    import wx.lib.agw.floatspin as FS
+
+    class MyFrame(wx.Frame):
+
+        def __init__(self, parent):
+
+            wx.Frame.__init__(self, parent, -1, "FloatSpin Demo")
+
+            panel = wx.Panel(self)
+
+            floatspin = FS.FloatSpin(panel, -1, pos=(50, 50), min_val=0, max_val=1,
+                                     increment=0.01, value=0.1, agwStyle=FS.FS_LEFT)
+            floatspin.SetFormat("%f")
+            floatspin.SetDigits(2)
+
+
+    # our normal wxApp-derived class, as usual
+
+    app = wx.PySimpleApp()
+
+    frame = MyFrame(None)
+    app.SetTopWindow(frame)
+    frame.Show()
+
+    app.MainLoop()
+
+
+
Events
======

-FloatSpin catches 3 different types of events:
+L{FloatSpin} catches 3 different types of events:

1) Spin events: events generated by spinning up/down the spinbutton;
2) Char events: playing with up/down arrows of the keyboard increase/decrease
-   the value of FloatSpin;
-3) Mouse wheel event: using the wheel will change the value of FloatSpin.
+   the value of L{FloatSpin};
+3) Mouse wheel event: using the wheel will change the value of L{FloatSpin}.

In addition, there are some other functionalities:

@@ -62,7 +96,7 @@
- ``Shift`` + arrow = 2 * increment        (or ``Shift`` + mouse wheel);
- ``Ctrl``  + arrow = 10 * increment       (or ``Ctrl`` + mouse wheel);
- ``Alt``   + arrow = 100 * increment      (or ``Alt`` + mouse wheel);
-- Combinations of ``Shift``, ``Ctrl``, ``Alt`` increment the FloatSpin value by the
+- Combinations of ``Shift``, ``Ctrl``, ``Alt`` increment the L{FloatSpin} value by the
product of the factors;
- ``PgUp`` & ``PgDn`` = 10 * increment * the product of the ``Shift``, ``Ctrl``, ``Alt``
factors;
@@ -77,7 +111,7 @@
=============== =========== ==================================================
Window Styles   Hex Value   Description
=============== =========== ==================================================
-``FS_READONLY``         0x1 Sets `FloatSpin` as read-only control.
+``FS_READONLY``         0x1 Sets L{FloatSpin} as read-only control.
``FS_LEFT``             0x2 Horizontally align the underlying `wx.TextCtrl` on the left.
``FS_CENTRE``           0x4 Horizontally align the underlying `wx.TextCtrl` on center.
``FS_RIGHT``            0x8 Horizontally align the underlying `wx.TextCtrl` on the right.
@@ -92,16 +126,16 @@
================= ==================================================
Event Name        Description
================= ==================================================
-``EVT_FLOATSPIN`` Emitted when the user changes the value of `FloatSpin`, either with the mouse or with the keyboard.
+``EVT_FLOATSPIN`` Emitted when the user changes the value of L{FloatSpin}, either with the mouse or with the keyboard.
================= ==================================================


License And Version
===================

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

-Latest revision: Andrea Gavana @ 22 Jul 2011, 21.00 GMT
+Latest revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT

Version 0.9

@@ -111,9 +145,9 @@

Modifications to allow `min_val` or `max_val` to be ``None`` done by:

-  James Bigler
-  sci institute, university of utah
-  march 14, 2007
+James Bigler,
+SCI Institute, University of Utah,
+March 14, 2007

:note: Note that the changes I made will break backward compatibility,
because I changed the contructor's parameters from `min` / `max` to
@@ -144,7 +178,7 @@

# Set The Styles For The Underline wx.TextCtrl
FS_READONLY = 1
-""" Sets `FloatSpin` as read-only control. """
+""" Sets L{FloatSpin} as read-only control. """
FS_LEFT = 2
""" Horizontally align the underlying `wx.TextCtrl` on the left. """
FS_CENTRE = 4
@@ -160,7 +194,7 @@
#-----------------------------------#

EVT_FLOATSPIN = wx.PyEventBinder(wxEVT_FLOATSPIN, 1)
-""" Emitted when the user changes the value of `FloatSpin`, either with the mouse or""" \
+""" Emitted when the user changes the value of L{FloatSpin}, either with the mouse or""" \
""" with the keyboard. """

# ---------------------------------------------------------------------------- #
@@ -288,10 +322,10 @@

class FloatSpin(wx.PyControl):
"""
-    FloatSpin implements a floating point `wx.Spinctrl`. It is built using a custom
+    L{FloatSpin} implements a floating point `wx.Spinctrl`. It is built using a custom
`wx.PyControl`, composed by a `wx.TextCtrl` and a `wx.SpinButton`. In order to
correctly handle floating points numbers without rounding errors or non-exact
-    floating point representations, FloatSpin uses the great L{FixedPoint} class
+    floating point representations, L{FloatSpin} uses the great L{FixedPoint} class
from Tim Peters.
"""
Tree

Table Of Contents

Previous topic

SVN Revision 68350 For floatspin

Next topic

SVN Revision 69086 For floatspin