summaryrefslogtreecommitdiff
path: root/ricky/imgrid
diff options
context:
space:
mode:
Diffstat (limited to 'ricky/imgrid')
-rw-r--r--ricky/imgrid/__init__.py14
-rwxr-xr-xricky/imgrid/options.py63
-rw-r--r--ricky/imgrid/params.py130
-rw-r--r--ricky/imgrid/probabilities.json87
4 files changed, 0 insertions, 294 deletions
diff --git a/ricky/imgrid/__init__.py b/ricky/imgrid/__init__.py
deleted file mode 100644
index e977115..0000000
--- a/ricky/imgrid/__init__.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from ricky.im import Im
-from ricky.imgrid.params import Params
-from ricky.config import IMGRID_URL
-
-
-class ImGrid(Im):
- def __init__(self):
- self.url = IMGRID_URL
-
- def params_init(self):
- new_params = Params()
- # new_params = self.get_from_server()
- new_params.api = self
- return new_params
diff --git a/ricky/imgrid/options.py b/ricky/imgrid/options.py
deleted file mode 100755
index 38ba1ee..0000000
--- a/ricky/imgrid/options.py
+++ /dev/null
@@ -1,63 +0,0 @@
-format_probabilities = Probabilities.from_dict(
- { 'weight': 20, 'value': 'png' },
- { 'weight': 0, 'value': 'gif' },
- { 'weight': 0, 'value': 'jpg' },
-)
-transition_probabilities = Probabilities.from_dict(
- { "value" : "background", "weight": 1 },
- { "value" : "dither", "weight": 1 },
- { "value" : "random", "weight": 1 },
- { "value" : "tile", "weight": 1 },
- { "value" : "edge", "weight": 1 },
-)
-skycolor_colors = \
- bgcolor_colors = planebgcolor_colors = Probabilities.from_dict(
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 },
- { "value" : None, "weight" : 10 },
-)
-
-linecolor_colors = Probabilities.from_dict(
- { "value" : "black", "weight" : 1 },
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 },
-)
-swing_probabilities = tilt_probabilities = roll_probabilities = Probabilities.from_dict(
- {"value": "", "weight": 2},
- {"value": 30, "weight": 1},
- {"value": -30, "weight": 1},
-)
-width_probabilities = height_probabilities = Probabilities.from_dict(
- { "value" : 400, "weight" : 1 },
- { "value" : 600, "weight" : 1 },
-)
-linethickness_probabilities = Probabilities.from_dict(
- {"value":1, "weight": 2},
- {"value":2, "weight": 1},
-)
-opacity_probabilities = Probabilities.from_dict(
- {"value":1, "weight": 2},
- {"value":0.5, "weight": 1},
-)
-spacing_probabilities = Probabilities.from_dict(
- {"value":10, "weight": 1},
- {"value":15, "weight": 1},
-)
-vlines_probabilities = hlines_probabilities = Probabilities.from_dict(
- {"value":"", "weight": 2},
- {"value":"true", "weight": 1},
-)
-shadow_probabilities = Probabilities.from_dict(
- {"value":"", "weight": 1},
- {"value":"true", "weight": 1},
-)
-zoom_probabilities = Probabilities.from_dict(
- {"value": 0, "weight": 3},
- {"value": 1.2, "weight": 1},
- {"value": -1.2, "weight": 1},
-)
-trim_probabilities = Probabilities.from_dict(
- {"value":"", "weight": 1},
- {"value":"true", "weight": 1},
-)
-
diff --git a/ricky/imgrid/params.py b/ricky/imgrid/params.py
deleted file mode 100644
index 01f1ff7..0000000
--- a/ricky/imgrid/params.py
+++ /dev/null
@@ -1,130 +0,0 @@
-from ricky.params import Params as _Params
-from ricky.param.username import Username
-from ricky.param.imageurl import ImageUrl
-from ricky.param.enum import Enum
-from ricky.param.constrainednumber import ConstrainedNumber
-from ricky.param.color import Color
-from ricky.param.bool import Bool
-
-_TRANSITION_OPTIONS = [
- "background",
- "dither",
- "random",
- "tile",
- "edge"
-]
-
-_FILETYPE_OPTIONS = [
- "png",
- "jpg",
- "gif",
-]
-
-
-class Params(_Params):
- def __init__(self):
- self._params = (
- Username(name="username", required=False),
- ImageUrl(name="bgimage", required=False),
- ImageUrl(name="imageinstead", required=False),
- ImageUrl(name="planebgimage", required=False),
- Enum(
- name="format",
- required=False,
- options=_FILETYPE_OPTIONS
- ),
- Enum(
- name="transition",
- required=True,
- options=_TRANSITION_OPTIONS
- ),
- Color(name="skycolor", required=False),
- Color(name="planebgcolor", required=False),
- Color(name="bgcolor", required=False),
- Color(name="linecolor", required=False),
- ConstrainedNumber(
- name="swing",
- required=False,
- enforce_int=True,
- min=-170,
- max=170),
- ConstrainedNumber(
- name="tilt",
- required=False,
- enforce_int=True,
- min=-170,
- max=170),
- ConstrainedNumber(
- name="roll",
- required=False,
- enforce_int=True,
- min=-170,
- max=170),
- ConstrainedNumber(
- name="width",
- required=False,
- enforce_int=True,
- min=100,
- max=800),
- ConstrainedNumber(
- name="height",
- required=False,
- enforce_int=True,
- min=100,
- max=800),
- ConstrainedNumber(
- name="linethickness",
- required=False,
- enforce_int=True,
- min=1,
- max=30
- ),
- ConstrainedNumber(
- name="opacity", required=False, min=0, max=1, prec=2),
- ConstrainedNumber(
- name="spacing",
- enforce_int=True,
- required=False,
- min=2,
- max=100),
- Bool(name="vlines", required=False),
- Bool(name="hlines", required=False),
- Bool(name="trim", required=False),
- Bool(name="shadow", required=False),
- ConstrainedNumber(
- name="zoom",
- required=False,
- min=-12,
- max=12,
- forbidden_range_min=-1.1,
- forbidden_range_max=1.1,
- prec=1
- )
- )
-
- def _test_values(self):
- return not any([
- (self.__getitem__('spacing').value >
- self.__getitem__('width').value),
- (self.__getitem__('spacing').value >
- self.__getitem__('height').value),
- (self.__getitem__('linethickness').value >
- self.__getitem__('width').value),
- (self.__getitem__('linethickness').value >
- self.__getitem__('height').value),
- ])
-
- def randomize(self):
- p = self._params
- for el in p:
- if el in ['spacing', 'linethickness']:
- continue
- el.randomize()
- for name in ['spacing', 'linethickness']:
- max_tries = 10000
- while(max_tries):
- self.__getitem__(name).randomize()
- if self._test_values():
- return
- max_tries -= 1
- raise ValueError
diff --git a/ricky/imgrid/probabilities.json b/ricky/imgrid/probabilities.json
deleted file mode 100644
index f9defe8..0000000
--- a/ricky/imgrid/probabilities.json
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- "format" : [
- { "weight": 20, "value": "png" },
- { "weight": 0, "value": "gif" },
- { "weight": 0, "value": "jpg" }
- ],
- "transition" : [
- { "value" : "background", "weight": 1 },
- { "value" : "dither", "weight": 1 },
- { "value" : "random", "weight": 1 },
- { "value" : "tile", "weight": 1 },
- { "value" : "edge", "weight": 1 }
- ],
- "skycolor" : [
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 },
- { "value" : null, "weight" : 10 }
- ],
- "bgcolor" : [
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 },
- { "value" : null, "weight" : 10 }
- ],
- "planebgcolor" : [
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 },
- { "value" : null, "weight" : 10 }
- ],
-
- "linecolor" : [
- { "value" : "black", "weight" : 1 },
- { "value" : "white", "weight" : 1 },
- { "value" : "silver", "weight" : 1 }
- ],
- "swing" : [
- {"value": ", "weight": 2},
- {"value": 30, "weight": 1},
- {"value": -30, "weight": 1}
- ],
- "tilt" : [
- {"value": ", "weight": 2},
- {"value": 30, "weight": 1},
- {"value": -30, "weight": 1}
- ],
- "roll" : [
- {"value": ", "weight": 2},
- {"value": 30, "weight": 1},
- {"value": -30, "weight": 1}
- ],
- "width" : "height" : [
- { "value" : 400, "weight" : 1 },
- { "value" : 600, "weight" : 1 }
- ],
- "linethickness" : [
- {"value":1, "weight": 2},
- {"value":2, "weight": 1}
- ],
- "opacity" : [
- {"value":1, "weight": 2},
- {"value":0.5, "weight": 1}
- ],
- "spacing" : [
- {"value":10, "weight": 1},
- {"value":15, "weight": 1}
- ],
- "vlines" : [
- {"value":", "weight": 2},
- {"value":"true", "weight": 1}
- ],
- "hlines" : [
- {"value":", "weight": 2},
- {"value":"true", "weight": 1}
- ],
- "shadow" : [
- {"value":", "weight": 1},
- {"value":"true", "weight": 1}
- ],
- "zoom" : [
- {"value": 0, "weight": 3},
- {"value": 1.2, "weight": 1},
- {"value": -1.2, "weight": 1}
- ],
- "trim" : [
- {"value":", "weight": 1},
- {"value":"true", "weight": 1}
- ]
-}