summaryrefslogtreecommitdiff
path: root/ricky/imgrid
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-10-10 02:54:41 -0700
committeryo mama <pepper@scannerjammer.com>2015-10-10 02:54:41 -0700
commitb02cc8d49513cdcc54f4421e71db3512354d4e2e (patch)
tree2a3a83e1f99a1108eedb703d2cf8ed43613b2c22 /ricky/imgrid
parent52d85ddcb9c934ec4dc0e890633762bfa2ff51f5 (diff)
renamed options to selections
Diffstat (limited to 'ricky/imgrid')
-rw-r--r--ricky/imgrid/params.py52
-rwxr-xr-xricky/imgrid/selections.py (renamed from ricky/imgrid/options.py)28
2 files changed, 40 insertions, 40 deletions
diff --git a/ricky/imgrid/params.py b/ricky/imgrid/params.py
index 2bcb367..b541e84 100644
--- a/ricky/imgrid/params.py
+++ b/ricky/imgrid/params.py
@@ -1,15 +1,15 @@
import re, random
from ricky.params import Params
from ricky.param import Param
-from ricky.param.option import Option
-from ricky.param.options import Options
+from ricky.param.option import Selection
+from ricky.param.selections import Selections
from ricky.param.username import Username
from ricky.param.imageurl import ImageUrl
from ricky.param.multiselect import MultiSelect
from ricky.param.numberrange import NumberRange
from ricky.param.color import Color
-from ricky.imgrid.options import *
+from ricky.imgrid.selections import *
class Param_Zoom(NumberRange):
def __init__(self, **kwargs):
@@ -18,10 +18,10 @@ class Param_Zoom(NumberRange):
def test_value(self):
return not ((self.value > self.exclusion_range[0]) and (self.value < self.exclusion_range[1]))
def randomize(self):
- weights_total = sum(map(lambda x: x["weight"], self.options())) + 10
+ weights_total = sum(map(lambda x: x["weight"], self.selections())) + 10
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
@@ -47,10 +47,10 @@ class Param_Opacity(NumberRange):
def __init__(self, **kwargs):
super(Param_Opacity, self).__init__(**kwargs)
def randomize(self):
- weights_total = sum(map(lambda x: x["weight"], self.options()) + self.range_max - self.range_min)
+ weights_total = sum(map(lambda x: x["weight"], self.selections()) + self.range_max - self.range_min)
choice = random.randint(0, weights_total)
position = 0
- for elem in self.options():
+ for elem in self.selections():
position += elem["weight"]
if position >= choice:
self.value = elem["value"]
@@ -64,25 +64,25 @@ class ImGridParams(Params):
ImageUrl(name="bgimage", required=0),
ImageUrl(name="imageinstead", required=0),
ImageUrl(name="planebgimage", required=0),
- MultiSelect(name="format", required=0, options=format_options),
- MultiSelect(name="transition", required=1, options=transition_options),
- Color(name="skycolor", required=0, options=skycolor_colors),
- Color(name="planebgcolor", required=0, options=planebgcolor_colors),
- Color(name="bgcolor", required=0, options=bgcolor_colors),
- Color(name="linecolor", required=0, options=linecolor_colors),
- NumberRange(name="swing", required=0, options=swing_options, min=-170, max=170),
- NumberRange(name="tilt", required=0, options=tilt_options, min=-170, max=170),
- NumberRange(name="roll", required=0, options=roll_options, min=-170, max=170),
- NumberRange(name="width", required=0, options=width_options, min=100, max=800),
- NumberRange(name="height", required=0, options=height_options, min=100, max=800),
- NumberRange(name="linethickness", required=0, options=linethickness_options, min=1, max=30),
- NumberRange(name="opacity", required=0, options=opacity_options, min=0, max=1),
- NumberRange(name="spacing", required=0, options=spacing_options, min=2, max=100),
- MultiSelect(name="vlines", required=0, options=vlines_options),
- MultiSelect(name="hlines", required=0, options=hlines_options),
- MultiSelect(name="trim", required=0, options=trim_options),
- MultiSelect(name="shadow", required=0, options=shadow_options),
- Param_Zoom(name="zoom", required=0, options=zoom_options, min=-12, max=12, exclusion_range=[-1.1, 1.1]),
+ MultiSelect(name="format", required=0, selections=format_selections),
+ MultiSelect(name="transition", required=1, selections=transition_selections),
+ Color(name="skycolor", required=0, selections=skycolor_colors),
+ Color(name="planebgcolor", required=0, selections=planebgcolor_colors),
+ Color(name="bgcolor", required=0, selections=bgcolor_colors),
+ Color(name="linecolor", required=0, selections=linecolor_colors),
+ NumberRange(name="swing", required=0, selections=swing_selections, min=-170, max=170),
+ NumberRange(name="tilt", required=0, selections=tilt_selections, min=-170, max=170),
+ NumberRange(name="roll", required=0, selections=roll_selections, min=-170, max=170),
+ NumberRange(name="width", required=0, selections=width_selections, min=100, max=800),
+ NumberRange(name="height", required=0, selections=height_selections, min=100, max=800),
+ NumberRange(name="linethickness", required=0, selections=linethickness_selections, min=1, max=30),
+ NumberRange(name="opacity", required=0, selections=opacity_selections, min=0, max=1),
+ NumberRange(name="spacing", required=0, selections=spacing_selections, min=2, max=100),
+ MultiSelect(name="vlines", required=0, selections=vlines_selections),
+ MultiSelect(name="hlines", required=0, selections=hlines_selections),
+ MultiSelect(name="trim", required=0, selections=trim_selections),
+ MultiSelect(name="shadow", required=0, selections=shadow_selections),
+ Param_Zoom(name="zoom", required=0, selections=zoom_selections, min=-12, max=12, exclusion_range=[-1.1, 1.1]),
]
def test_values(self):
p = self.params
diff --git a/ricky/imgrid/options.py b/ricky/imgrid/selections.py
index 8ada475..7338709 100755
--- a/ricky/imgrid/options.py
+++ b/ricky/imgrid/selections.py
@@ -1,10 +1,10 @@
-from ricky.param.options import Options
-format_options = Options.from_dict(
+from ricky.param.selections import Selections
+format_selections = Selections.from_dict(
{ 'weight': 20, 'value': 'png' },
{ 'weight': 0, 'value': 'gif' },
{ 'weight': 0, 'value': 'jpg' },
)
-transition_options = Options.from_dict(
+transition_selections = Selections.from_dict(
{ "value" : "background", "weight": 1 },
{ "value" : "dither", "weight": 1 },
{ "value" : "random", "weight": 1 },
@@ -12,52 +12,52 @@ transition_options = Options.from_dict(
{ "value" : "edge", "weight": 1 },
)
skycolor_colors = \
- bgcolor_colors = planebgcolor_colors = Options.from_dict(
+ bgcolor_colors = planebgcolor_colors = Selections.from_dict(
{ "value" : "white", "weight" : 1 },
{ "value" : "silver", "weight" : 1 },
{ "value" : None, "weight" : 10 },
)
-linecolor_colors = Options.from_dict(
+linecolor_colors = Selections.from_dict(
{ "value" : "black", "weight" : 1 },
{ "value" : "white", "weight" : 1 },
{ "value" : "silver", "weight" : 1 },
)
-swing_options = tilt_options = roll_options = Options.from_dict(
+swing_selections = tilt_selections = roll_selections = Selections.from_dict(
{"value": "", "weight": 2},
{"value": 30, "weight": 1},
{"value": -30, "weight": 1},
)
-width_options = height_options = Options.from_dict(
+width_selections = height_selections = Selections.from_dict(
{ "value" : 400, "weight" : 1 },
{ "value" : 600, "weight" : 1 },
)
-linethickness_options = Options.from_dict(
+linethickness_selections = Selections.from_dict(
{"value":1, "weight": 2},
{"value":2, "weight": 1},
)
-opacity_options = Options.from_dict(
+opacity_selections = Selections.from_dict(
{"value":1, "weight": 2},
{"value":0.5, "weight": 1},
)
-spacing_options = Options.from_dict(
+spacing_selections = Selections.from_dict(
{"value":10, "weight": 1},
{"value":15, "weight": 1},
)
-vlines_options = hlines_options = Options.from_dict(
+vlines_selections = hlines_selections = Selections.from_dict(
{"value":"", "weight": 2},
{"value":"true", "weight": 1},
)
-shadow_options = Options.from_dict(
+shadow_selections = Selections.from_dict(
{"value":"", "weight": 1},
{"value":"true", "weight": 1},
)
-zoom_options = Options.from_dict(
+zoom_selections = Selections.from_dict(
{"value": 0, "weight": 3},
{"value": 1.2, "weight": 1},
{"value": -1.2, "weight": 1},
)
-trim_options = Options.from_dict(
+trim_selections = Selections.from_dict(
{"value":"", "weight": 1},
{"value":"true", "weight": 1},
)