summaryrefslogtreecommitdiff
path: root/ricky/param/enum.py
diff options
context:
space:
mode:
authorpepperpepperpepper <pepper@scannerjammer.com>2015-12-08 17:00:56 -0800
committerpepperpepperpepper <pepper@scannerjammer.com>2015-12-08 17:00:56 -0800
commita60b53a49e2cfa840d37b6c0b72cfe37caf29509 (patch)
treed7ed51f387183626efa7a20220ddb4e551fd949f /ricky/param/enum.py
parentac068613a47c96ea37abc9243f6c2ea71bec5ba4 (diff)
finished normalization, fixing serialization
Diffstat (limited to 'ricky/param/enum.py')
-rw-r--r--ricky/param/enum.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ricky/param/enum.py b/ricky/param/enum.py
index 137c58e..09a4cc3 100644
--- a/ricky/param/enum.py
+++ b/ricky/param/enum.py
@@ -41,11 +41,11 @@ class Enum(Param):
return my_dict
def from_normalized(self, value):
- maximum = len(self._options - 1)
+ maximum = len(self._options) - 1
idx_val = int(round(maximum * value, 0))
self.value = self._options[idx_val]
def as_normalized(self):
- maximum = len(self._options - 1)
- value = int(self.as_hex(), 16)
+ maximum = len(self._options) - 1
+ value = self._options.index(self.value)
return decimal.Decimal(value)/decimal.Decimal(maximum)