diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-10-09 21:22:01 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-10-09 21:22:01 -0700 |
| commit | 52d85ddcb9c934ec4dc0e890633762bfa2ff51f5 (patch) | |
| tree | 54a442e6a622c364a16705ad6b1f3785d143a87b | |
| parent | ba52731f22dfc9abe1a8f64d964931b52fe460b2 (diff) | |
ok I've figured it out
| -rw-r--r-- | ricky/imgradient/options.py | 44 | ||||
| -rw-r--r-- | ricky/imgradient/params.py | 6 | ||||
| -rw-r--r-- | ricky/param/numberrange.py | 19 |
3 files changed, 47 insertions, 22 deletions
diff --git a/ricky/imgradient/options.py b/ricky/imgradient/options.py index e9ebc9a..dd14cba 100644 --- a/ricky/imgradient/options.py +++ b/ricky/imgradient/options.py @@ -1,12 +1,13 @@ from ricky.param.options import Options width_options = Options.from_dict( - {"value": 400, "weight": 3}, - {"value": 600, "weight": 1}, + {"value": 40, "weight": 60}, + {"value": 20, "weight": 60}, + {"value": 60, "weight": 60}, + {"value": 80, "weight": 60}, ) height_options = Options.from_dict( - {"value": 400, "weight": 3}, - {"value": 600, "weight": 1}, + {"value": 400, "weight": 900}, ) color1_options = Options.from_dict( {"value": "", "weight": 0}, @@ -23,15 +24,22 @@ stripes_options = Options.from_dict( {"value": "false", "weight": 1}, ) stripenumber_options = Options.from_dict( - {"value": "", "weight": 0}, + {"value": 3, "weight": 10}, + {"value": 10, "weight": 10}, + {"value": 20, "weight": 10}, + {"value": 100, "weight": 10}, + {"value": 40, "weight": 10}, # {"value": 1, "weight": 50}, # {"value": 2, "weight": 50}, # {"value": 2, "weight": 50}, ) +stripeintensity_options = Options.from_dict( + {"value": 1000, "weight": 10}, + {"value": 4, "weight": 10}, +) # contrast_options = \ -stripeintensity_options = \ - brightness_options = \ +brightness_options = \ saturation_options = \ hue_options = \ Options.from_dict( @@ -39,18 +47,18 @@ stripeintensity_options = \ # {"value": "", "weight": 300}, ) halftone_options = Options.from_dict( - {"value": "", "weight": 20}, - {"value": "checkeredfade", "weight": 1}, - {"value": "etchedtransition", "weight": 1}, - {"value": "bendaydots", "weight": 1}, - {"value": "smallerdots1", "weight": 1}, - {"value": "smallerdots2", "weight": 1}, - {"value": "flatstripes", "weight": 1}, + {"value": "", "weight": 60}, + {"value": "checkeredfade", "weight": 10}, + {"value": "etchedtransition", "weight": 10}, + {"value": "bendaydots", "weight": 10}, + {"value": "smallerdots1", "weight": 10}, + {"value": "smallerdots2", "weight": 10}, + {"value": "flatstripes", "weight": 10}, ) bevel_options = Options.from_dict( {"value": "", "weight": 4}, {"value": "flatout", "weight": 1}, - {"value": "flatinner", "weight": 1}, + {"value": "flatinner", "weight": 0}, {"value": "evenlyframed", "weight": 1}, # {"value": "biginner", "weight": 1}, {"value": "bigouter", "weight": 1}, @@ -62,7 +70,7 @@ blurriness_options = \ percentbeveled_options = Options.from_dict( {"value": 30, "weight": 20}, {"value": 10, "weight": 2}, - {"value": "", "weight": 100}, + {"value": "", "weight": 1}, ) rotate_options = \ tilt_options = Options.from_dict( @@ -88,6 +96,6 @@ gradienttype_options = Options.from_dict( {"value": "colorspace", "weight": 1}, {"value": "plasmawash", "weight": 2}, {"value": "gradientwash", "weight": 1}, - {"value": "mirrored", "weight": 1}, - {"value": "noise", "weight": 3}, + {"value": "mirrored", "weight": 0}, + {"value": "noise", "weight": 1}, ) diff --git a/ricky/imgradient/params.py b/ricky/imgradient/params.py index e88e7a4..f950429 100644 --- a/ricky/imgradient/params.py +++ b/ricky/imgradient/params.py @@ -15,14 +15,14 @@ class Params(_Params): name="width", required=1, options=width_options, - min=100, + min=10, max=800 ), NumberRange( name="height", required=1, - options=width_options, - min=100, + options=height_options, + min=10, max=800 ), Color(name="color1", required=1, options=color1_options), diff --git a/ricky/param/numberrange.py b/ricky/param/numberrange.py index 30b9a6a..8fe517b 100644 --- a/ricky/param/numberrange.py +++ b/ricky/param/numberrange.py @@ -11,8 +11,15 @@ class NumberRange(Param): def randomize(self): weights_total = sum( map(lambda x: x["weight"], self.options()) - ) + self.range_max - self.range_min + )# + self.range_max - self.range_min + if weights_total < 100: + weights_total = 100; choice = random.randint(0, weights_total) + import sys + sys.stderr.write("choosing %s: random_int: %s, options: %s\n" % ( + self.name, + choice, + self.options())) position = 0 for elem in self.options(): position += elem["weight"] @@ -30,6 +37,16 @@ class NumberRange(Param): @value.setter def value(self, value): self._value = value + import sys + sys.stderr.write("%s \n" % self.name) + sys.stderr.write("%s \n" % self._value) + if self._value < self.range_min: + sys.stderr.write("PROBLEM HERE1") + if self._value > self.range_max: + sys.stderr.write("%s > %s\n" % (self._value, self.range_max)) + sys.stderr.write("%s\n" % type(self._value)) + sys.stderr.write("%s\n" % type(self.range_max)) + sys.stderr.write("PROBLEM HERE2") if self._value and \ (self._value < self.range_min or self._value > self.range_max): raise ValueError( |
