Changes between Initial Version and Version 1 of WxCommon

Nov 5, 2010, 2:29:23 PM (10 years ago)



  • WxCommon

    v1 v1  
     1= The `vespa.common.wx` Library =
     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.
     9== `floatspin` ==
     12[ 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 along with the rest of
     16`wx.lib.agw`; it is not in or any earlier versions.
     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:
     24    import wx.lib.agw.floatspin as floatspin
     25except ImportError:
     26    import vespa.common.wx.widgets.floatspin.floatspin as floatspin
     29Unfortunately the standard library version contains a couple of bugs, one
     30of which [ was patched in wxPython rev 62685] and
     31the other of which [ was patched in wxPython rev 62920].
     33Our local version of the code contains these patches. If and when a version
     34of wxPython is released that contains both patches (probably, we
     35can use the library version with code like this:
     39if (wx.MAJOR_VERSION >= 2) and \
     40   (wx.MINOR_VERSION >= 9):
     41    import wx.lib.agw.floatspin as floatspin
     43    import vespa.common.wx.widgets.floatspin.floatspin as floatspin
     46== `floatspin_multiplier` ==
     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%.