AccessEngine :: AEState :: Setting :: NumericSetting :: Class NumericSetting
[hide private]
[frames] | no frames]

Class NumericSetting

source code

object --+    
         |    
   Setting --+
             |
            NumericSetting

Represents a numeric setting where the bounds are arbitrarily chosen.

Instance Methods [hide private]
 
__init__(self, state, name, default, label, description, persist, min, max, precision)
Initializes all instance variables.
source code
 
update(self, setting)
Updates the min, max, and precision in addition to everything done in the parent class method.
source code
numeric
_fixBounds(self, val, min, max, prec)
Snaps values to the specific range and precision.
source code
 
_setValue(self, val)
Stores the given value as an integer or float with the given precision.
source code
RawRangeView
getView(self)
Returns an object that proxies as a view for the value, min, max, and precision for this object.
source code

Inherited from Setting: addObserver, clearObservers, copy, removeObserver, restore, save, serialize, unserialize

Inherited from Setting (private): _getValue, _notify

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  value = property(Setting._getValue, _setValue)
Instance Variables [hide private]
number max
Maximum value in the range
number min
Minimum value in the range
integer precision
Number of decimal places

Inherited from Setting: default, description, label, name, persist, state

Inherited from Setting (private): _cached, _observers, _value

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, state, name, default, label, description, persist, min, max, precision)
(Constructor)

source code 
Initializes all instance variables.
Overrides: Setting.__init__
(inherited documentation)

update(self, setting)

source code 
Updates the min, max, and precision in addition to everything done in the parent class method.
Parameters:
Overrides: Setting.update

_fixBounds(self, val, min, max, prec)

source code 
Snaps values to the specific range and precision.
Parameters:
  • val (numeric) - Value to bound
  • min (numeric) - Minimum of range
  • max (numeric) - Maximum of range
  • prec (integer) - Number of decimal places of precision
Returns: numeric
Number snapped to the appropriate range and rounded or truncated to the proper precision
Raises:
  • TypeError - When the value is no a numeric

_setValue(self, val)

source code 
Stores the given value as an integer or float with the given precision. Uses round to store floats and int to store integers.
Parameters:
  • val (numeric) - New value to store
Raises:
  • TypeError - When the value is not a numeric
Overrides: Setting._setValue

getView(self)

source code 
Returns an object that proxies as a view for the value, min, max, and precision for this object. Having this separate view permits other ranges to override those values with their own conversions (e.g. percent, relative ranges).
Returns: RawRangeView
A raw view of this range