summaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-14 18:24:09 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-14 18:24:09 +0100
commit402cedbfcf32a31b6936cb868533f9bbe62f4de9 (patch)
tree87376718425a42783578609881adfb74ab7d23c4 /src/__main__.py
parentfix derp on whitepoint adj (diff)
downloadblueshift-402cedbfcf32a31b6936cb868533f9bbe62f4de9.tar.gz
blueshift-402cedbfcf32a31b6936cb868533f9bbe62f4de9.tar.bz2
blueshift-402cedbfcf32a31b6936cb868533f9bbe62f4de9.tar.xz
fix rc exec
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/__main__.py')
-rwxr-xr-xsrc/__main__.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 9d5dd9a..1c04cf4 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -14,34 +14,41 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
+
from colour import *
from curve import *
-#temperature(6500, lambda T : divide_by_maximum(series_d(T)), True)
-#temperature(6500, lambda T : clip_whitepoint(simple_whitepoint(T)), True)
-#rgb_contrast(1.0, 1.0, 1.0)
-#cie_contrast(1.0)
-#rgb_brightness(1.0, 1.0, 1.0)
-#cie_brightness(1.0)
-#gamma(1.0, 1.0, 1.0)
-#sigmoid(None, None, None)
-#clip()
-
+temperature(6500, lambda T : divide_by_maximum(series_d(T)), True)
+temperature(6500, lambda T : clip_whitepoint(simple_whitepoint(T)), True)
+rgb_contrast(1.0, 1.0, 1.0)
+cie_contrast(1.0)
+rgb_brightness(1.0, 1.0, 1.0)
+cie_brightness(1.0)
+gamma(1.0, 1.0, 1.0)
+sigmoid(None, None, None)
+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)
+ if arg in os.environ:
+ print(arg)
+ file = file.replace('$' + arg, os.environ[arg].replace('$', '\0'))
+ else:
+ file = None
break
+ if file is not None:
+ file = file.replace('\0', '$')
+ if 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