summaryrefslogtreecommitdiff
path: root/Pb_Api/ImGrid/Params.py
diff options
context:
space:
mode:
Diffstat (limited to 'Pb_Api/ImGrid/Params.py')
-rw-r--r--Pb_Api/ImGrid/Params.py72
1 files changed, 33 insertions, 39 deletions
diff --git a/Pb_Api/ImGrid/Params.py b/Pb_Api/ImGrid/Params.py
index 7c304ad..ff21e52 100644
--- a/Pb_Api/ImGrid/Params.py
+++ b/Pb_Api/ImGrid/Params.py
@@ -6,6 +6,9 @@ from Pb_Api.Param.Options import Pb_Api_Param_Options
from Pb_Api.Param.Username import Pb_Api_Param_Username
from Pb_Api.Param.Image_Url import Pb_Api_Param_Image_Url
from Pb_Api.Param.MultiSelect import Pb_Api_Param_MultiSelect
+from Pb_Api.Param.NumberRange import Pb_Api_Param_NumberRange
+from Pb_Api.Param.Color import Pb_Api_Param_Color
+from Pb_Api.Param.Bool import Pb_Api_Param_Bool
class Pattern_Url_Option(Pb_Api_Param_Option):
def __init__(self, **kwargs):
@@ -15,6 +18,11 @@ class Pattern_Url_Option(Pb_Api_Param_Option):
formatted = "{}/{}.png".format(PATTERN_BASE_URL, kwargs["value"])
return cls(weight=kwargs["weight"], value=formatted )
+class Param_Zoom(Pb_Api_Param_NumberRange):
+ def __init__(self, **kwargs):
+ super(Pb_Api_Param_Option, self).__init__(**kwargs)
+ self.exclusion_range = kwargs['exclusion_range']
+
class ImPattern_Params(Pb_Api_Params):
def __init__(self):
self.params = [
@@ -25,47 +33,33 @@ class ImPattern_Params(Pb_Api_Params):
Pb_Api_Param_MultiSelect(name="format", required=0, options=format_options),
Pb_Api_Param_MultiSelect(name="transition", required=1, options=transition_options),
Pb_Api_Param_Color(name="skycolor", required=0, preferred_colors=skycolor_colors),
- Pb_Api_Param_Angle(name="swing", required=0, preferred_angles=preferred_angles),
- Pb_Api_Param_Angle(name="tilt", required=0, preferred_angles=preferred_angles),
- Pb_Api_Param_Angle(name="roll", required=0, preferred_angles=preferred_angles),
+ Pb_Api_Param_Color(name="planebgcolor", required=0, preferred_colors=planebgcolor_colors),
+ Pb_Api_Param_Color(name="bgcolor", required=0, preferred_colors=bgcolor_colors),
+ Pb_Api_Param_Color(name="linecolor", required=0, preferred_colors=linecolor_colors),
+ Pb_Api_Param_NumberRange(name="swing", required=0, options=swing_options),
+ Pb_Api_Param_NumberRange(name="tilt", required=0, options=tilt_options),
+ Pb_Api_Param_NumberRange(name="roll", required=0, options=roll_options),
+ Pb_Api_Param_NumberRange(name="width", required=0, options=width_options),
+ Pb_Api_Param_NumberRange(name="height", required=0, options=height_options),
+ Pb_Api_Param_NumberRange(name="linethickness", required=0, options=height_options),
+ Pb_Api_Param_NumberRange(name="opacity", required=0, options=height_options),
+ Pb_Api_Param_NumberRange(name="spacing", required=0, options=height_options),
+ Pb_Api_Param_Bool(name="vlines", required=0, options=vlines_options),
+ Pb_Api_Param_Bool(name="hlines", required=0, options=hlines_options),
+ Pb_Api_Param_Bool(name="trim", required=0, options=trim_options),
+ Pb_Api_Param_Bool(name="shadow", required=0, options=shadow_options),
+ Param_Zoom(name="zoom", required=0, options=zoom_options),
]
-#what about width and height, same as angle, just set a max and min? yeah can be that so should angle inherit from a number
-#class? yes i would make Number class which doesn't have prefered numbers, and angle can inherit and add preferend number functionality
- "width"
- "height"
-
- "skycolor"
- "planebgcolor"
- "bgcolor"
- "linecolor"
-
-#ok these are similar too, they have a limited range though
- "linethickness"
- "opacity"
- "spacing"
-
-
-
-
- "vlines"
- "hlines"
-
-
- "trim"
- "shadow"
-
-#ok swing tilt roll zoom is a number between -180 and 180
-#but it would be nice to prefer 0, 90, etc?
-#seems sort of similar to colors? yeah custom class basically the same logic as color? yeah can be same
+ def randomize(self):
+ super(ImPattern_Params, self).randomize()
+ p = self.params()
+ if any([
+ p['spacing'].value > p['width'].value,
+ p['spacing'].value > p['height'].value,
+ p['linethickness'] > p['width'].value,
+ p['linethickness'] > p['height'].value ]):
+ self.randomize()
- "swing"
- "tilt"
- "roll"
-#ok two more, the thing with this is that it has
-#a much smaller range than the others, and it can't be a number between 1 and -1
-#very weird parameters I guess that's the last thing
- "zoom"
-#like that? yep ok next thing is this above
skycolor_colors = Pb_Api_Param_Options(
Pb_Api_Param_Option( value='black', weight=50 ),
Pb_Api_Param_Option( value='silver', weight=20 ),