diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-03-11 02:51:58 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-03-11 02:51:58 -0700 |
| commit | a5123bfab06f7fd8884b9b4f12f579dceec43aa1 (patch) | |
| tree | 5120729cadf48ce97caeb90c34b850308c9a9f21 /Pb_Api/ImBreak | |
| parent | d9651ca5fb6c655afbe88a014c8bb8a8f000a70d (diff) | |
finished OOP rewriteOOP
Diffstat (limited to 'Pb_Api/ImBreak')
| -rw-r--r-- | Pb_Api/ImBreak/Params.py | 58 | ||||
| -rw-r--r-- | Pb_Api/ImBreak/__init__.py | 13 |
2 files changed, 71 insertions, 0 deletions
diff --git a/Pb_Api/ImBreak/Params.py b/Pb_Api/ImBreak/Params.py new file mode 100644 index 0000000..7d15476 --- /dev/null +++ b/Pb_Api/ImBreak/Params.py @@ -0,0 +1,58 @@ +import re, random +from Pb_Api.Params import Pb_Api_Params +from Pb_Api.Param import Pb_Api_Param +from Pb_Api.Param.Option import Pb_Api_Param_Option +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 config import PATTERN_BASE_URL + + +breaktype_options = Pb_Api_Param_Options.from_dict( + {"value":"CLASSIC", "weight": 1}, + {"value":"REDUX", "weight": 1}, + {"value":"BLURRY_BREAK", "weight": 1}, + {"value":"BLURRY_BREAK_2", "weight": 1}, + {"value":"SWIPE", "weight": 1}, + {"value":"RGB_WASH", "weight": 1}, + {"value":"RGB_WASH_2", "weight": 1}, + {"value":"NOISY_BREAK", "weight": 1}, + {"value":"BROKEN_VIGNETTE", "weight": 1}, + {"value":"FAX_MACHINE", "weight": 1}, + {"value":"STRIPES", "weight": 1}, + {"value":"PHOTOCOPY", "weight": 1}, +) +breakmode_options = Pb_Api_Param_Options.from_dict( + {"value":"extreme", "weight": 1}, + {"value":"subtle", "weight": 1}, +) +finalformat_options = Pb_Api_Param_Options.from_dict( + {"value":"png", "weight": 5}, + {"value":"jpg", "weight": 2}, + {"value":"gif", "weight": 2}, +) +breakangle_options = Pb_Api_Param_Options.from_dict( + {"value":0, "weight": 9}, + {"value":90, "weight": 2}, + {"value":-180, "weight": 2}, + {"value":180, "weight": 2}, +) +expanded_options = Pb_Api_Param_Options.from_dict( + {"value": "" , "weight": 11 }, + {"value": 1, "weight": 2} +) + +class ImBreak_Params(Pb_Api_Params): + def __init__(self): + self.params = [ + Pb_Api_Param_Username(name="username", required=0), + Pb_Api_Param_Image_Url(name="url", required=1), + Pb_Api_Param_MultiSelect(name="finalformat", required=0, options=finalformat_options), + Pb_Api_Param_MultiSelect(name="breaktype", required=1, options=breaktype_options), + Pb_Api_Param_NumberRange(name="breakangle", required=0, options=breakangle_options, min=-180, max=180), + Pb_Api_Param_MultiSelect(name="breakmode", required=1, options=breakmode_options), + Pb_Api_Param_MultiSelect(name="expanded", required=0, options=expanded_options), + ] diff --git a/Pb_Api/ImBreak/__init__.py b/Pb_Api/ImBreak/__init__.py new file mode 100644 index 0000000..7836f2e --- /dev/null +++ b/Pb_Api/ImBreak/__init__.py @@ -0,0 +1,13 @@ +#!/usr/bin/python2.7 +from Pb_Api import Pb_Api +from Pb_Api.ImBreak.Params import ImBreak_Params +from config import IMBREAK_URL + +class Pb_Api_ImBreak(Pb_Api): + def __init__(self): + self.url = IMBREAK_URL + def params_init(self): + new_params = ImBreak_Params() + #new_params = self.get_from_server() + new_params.api = self + return new_params |
