Changes between Initial Version and Version 1 of WxCommon


Ignore:
Timestamp:
Nov 5, 2010, 2:29:23 PM (10 years ago)
Author:
flip
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WxCommon

    v1 v1  
     1= The `vespa.common.wx` Library =
     2
     3vespa.common.wx is a library that, as of this writing, contains some
     4utilities and two custom controls
     5for use in Analysis. "Custom" control is a bit of a misnomer as only one
     6of them is really custom. They are the `floatspin` control and the
     7`floatspin_multiplier` control. They're explained below.
     8
     9== `floatspin` ==
     10
     11The
     12[http://www.wxpython.org/docs/api/wx.lib.agw.floatspin-module.html floatspin control] resembles
     13a standard spin control, but it accepts
     14floating point input. (The standard control accepts only integer input.)
     15It was added to wxPython in version 2.8.9.2 along with the rest of
     16`wx.lib.agw`; it is not in 2.8.9.1 or any earlier versions.
     17
     18Ideally we would use the version of the control in `wx.lib.agw` if it was
     19available and fall back on a local version if not. Code like this would work:
     20
     21{{{
     22#!python
     23try:
     24    import wx.lib.agw.floatspin as floatspin
     25except ImportError:
     26    import vespa.common.wx.widgets.floatspin.floatspin as floatspin
     27}}}
     28
     29Unfortunately the standard library version contains a couple of bugs, one
     30of which [http://trac.wxwidgets.org/changeset/62685 was patched in wxPython rev 62685] and
     31the other of which [http://trac.wxwidgets.org/changeset/62920 was patched in wxPython rev 62920].
     32
     33Our local version of the code contains these patches. If and when a version
     34of wxPython is released that contains both patches (probably 2.9.0.0), we
     35can use the library version with code like this:
     36
     37{{{
     38#!python
     39if (wx.MAJOR_VERSION >= 2) and \
     40   (wx.MINOR_VERSION >= 9):
     41    import wx.lib.agw.floatspin as floatspin
     42else:
     43    import vespa.common.wx.widgets.floatspin.floatspin as floatspin
     44}}}
     45
     46== `floatspin_multiplier` ==
     47
     48This control subclass `floatspin` and is therefore mostly the same, but it
     49de/increments the
     50value by a percentage of the value rather than by a consistent increment.
     51It has one additional attribute called `multiplier` which defaults to 1.
     52When set to e.g. 1.25, the control will de/increment its value in jumps
     53of 25%.
     54
     55
     56
     57