23 |
|
|
24 |
import resource |
import resource |
25 |
|
|
|
from Thuban.common import Str2Num |
|
|
|
|
26 |
ID_CLASSGEN_GEN = 4001 |
ID_CLASSGEN_GEN = 4001 |
27 |
ID_CLASSGEN_CLOSE = 4002 |
ID_CLASSGEN_CLOSE = 4002 |
28 |
ID_CLASSGEN_GENCOMBO = 4007 |
ID_CLASSGEN_GENCOMBO = 4007 |
480 |
return valid |
return valid |
481 |
|
|
482 |
def __CalcStepping(self, min, max, ngroups): |
def __CalcStepping(self, min, max, ngroups): |
483 |
step = Str2Num(str((max - min) / float(ngroups))) |
step = (max - min) / float(ngroups) |
484 |
if self.fieldType == FIELDTYPE_INT: |
if self.fieldType == FIELDTYPE_INT: |
485 |
step = int(step) |
step = int(step) |
486 |
|
|
821 |
clazz = Classification() |
clazz = Classification() |
822 |
|
|
823 |
#step = int((max - min) / float(numGroups)) |
#step = int((max - min) / float(numGroups)) |
|
step = int(Str2Num(str((max - min + 1) / float(numGroups)))) |
|
824 |
|
|
825 |
if numGroups > 0: |
if numGroups > 0: |
826 |
|
|
827 |
|
step = int((max - min + 1) / float(numGroups)) |
828 |
cur_value = min |
cur_value = min |
829 |
|
|
830 |
ramp.SetNumGroups(numGroups) |
ramp.SetNumGroups(numGroups) |
831 |
|
|
832 |
for prop in ramp: |
for prop in ramp: |
833 |
clazz.AppendGroup( |
clazz.AppendGroup(ClassGroupSingleton(cur_value), prop) |
|
ClassGroupSingleton( |
|
|
Str2Num(str(cur_value)), |
|
|
prop)) |
|
834 |
cur_value += step |
cur_value += step |
835 |
|
|
836 |
return clazz |
return clazz |
851 |
|
|
852 |
ramp.SetNumGroups(numGroups) |
ramp.SetNumGroups(numGroups) |
853 |
|
|
854 |
step = Str2Num(str((max - min) / float(numGroups))) |
step = (max - min) / float(numGroups) |
855 |
|
|
856 |
if intStep: |
if intStep: |
857 |
step = int(step) |
step = int(step) |
867 |
|
|
868 |
# this check guards against rounding issues |
# this check guards against rounding issues |
869 |
if cur_min != cur_max: |
if cur_min != cur_max: |
870 |
clazz.AppendGroup( |
clazz.AppendGroup(ClassGroupRange(cur_min, cur_max, prop)) |
|
ClassGroupRange( |
|
|
Str2Num(str(cur_min)), |
|
|
Str2Num(str(cur_max)), |
|
|
prop)) |
|
871 |
|
|
872 |
cur_min = cur_max |
cur_min = cur_max |
873 |
cur_max += step |
cur_max += step |