summaryrefslogtreecommitdiff
path: root/ricky/impattern/params.py
diff options
context:
space:
mode:
authorpepperpepperpepper <pepper@scannerjammer.com>2015-09-30 00:56:49 -0700
committerpepperpepperpepper <pepper@scannerjammer.com>2015-09-30 00:56:49 -0700
commit5521785e6c52dd4603699d057d62a5797844fd13 (patch)
tree3516ba416147ebd00104f3f5fc666371432af0ae /ricky/impattern/params.py
parent20a896ed6a8d54c3e59baa33ce3fce7a26343c20 (diff)
huge rename
Diffstat (limited to 'ricky/impattern/params.py')
-rw-r--r--ricky/impattern/params.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/ricky/impattern/params.py b/ricky/impattern/params.py
new file mode 100644
index 0000000..34d70bf
--- /dev/null
+++ b/ricky/impattern/params.py
@@ -0,0 +1,33 @@
+import re
+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.username import Username
+from ricky.param.imageurl import ImageUrl
+from ricky.param.multiselect import MultiSelect
+
+from ricky.config import PATTERN_BASE_URL
+
+class Pattern_UrlOption(Option):
+ def __init__(self, **kwargs):
+ super(Pattern_UrlOption, self).__init__(**kwargs)
+ @classmethod
+ def from_name(cls, **kwargs):
+ formatted = "{}/{}.png".format(PATTERN_BASE_URL, kwargs["value"])
+ return cls(weight=kwargs["weight"], value=formatted )
+
+class ImPatternParams(Params):
+ def __init__(self):
+ self.params = [
+ Username(name="username", required=0),
+ ImageUrl(name="imageurl", required=1),
+ MultiSelect(name="pattern_url", required=1, options=pattern_url_options)
+ ]
+
+pattern_url_options = Options(*[
+ Pattern_UrlOption.from_name(weight=0, value=i) for i in range(1,100) ] + [
+ Pattern_UrlOption.from_name(weight=0, value="a{}".format(i)) for i in range(0, 42)
+])
+
+pattern_url_options.search("a10").weight = 20;