From ff0053dfabc412b3bd4d8cd53a9b4b5122e8df09 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 14 Feb 2014 18:14:48 +0100 Subject: load rc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/__main__.py') 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) -- cgit v1.2.3-70-g09d2