summaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-14 18:14:48 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-14 18:14:48 +0100
commitff0053dfabc412b3bd4d8cd53a9b4b5122e8df09 (patch)
treee4ca78cf3f648556acbac5c509d9b904a4f2414c /src/__main__.py
parentwhitespace (diff)
downloadblueshift-ff0053dfabc412b3bd4d8cd53a9b4b5122e8df09.tar.gz
blueshift-ff0053dfabc412b3bd4d8cd53a9b4b5122e8df09.tar.bz2
blueshift-ff0053dfabc412b3bd4d8cd53a9b4b5122e8df09.tar.xz
load rc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/__main__.py')
-rwxr-xr-xsrc/__main__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 1194f3d..aa9f09e 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -31,11 +31,28 @@ from curve import *
#clip()
+
+## Load extension and configurations via ponysayrc
+for file in ('$XDG_CONFIG_HOME/%/%rc', '$HOME/.config/%/%rc', '$HOME/.%rc', '/etc/%rc'):
+ file = file.replace('%', 'blueshift')
+ for arg in ('XDG_CONFIG_HOME', 'HOME'):
+ file = file.replace('$' + arg, os.environ[arg].replace('$', '\0'))
+ file = file.replace('\0', '$')
+ if (file is not None) and os.path.exists(file):
+ with open(file, 'rb') as script:
+ code = script.read().decode('utf8', 'error') + '\n'
+ code = compile(code, file, 'exec')
+ exec(code)
+ break
+
+
+## Translate curve from float to integer
for curve in (r_curve, g_curve, b_curve):
for i in range(i_size):
curve[i] = int(curve[i] * (o_size - 1) + 0.5)
if clip_result:
curve[i] = min(max(0, curve[i]), (o_size - 1))
+
print(r_curve)
print(g_curve)
print(b_curve)