Accept comments in config/setup files
Comments are lines starting with "#" - in the hope that no screen name or xrandr option will ever start with a hash sign. Fixes #50.
This commit is contained in:
parent
ff75a031ef
commit
a56981281c
|
@ -130,6 +130,8 @@ The most useful one is `$AUTORANDR_CURRENT_PROFILE`.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
* *2017-01-18* Accept comments (lines starting with `#`) in config/setup files
|
||||||
|
|
||||||
**autorandr 1.0**
|
**autorandr 1.0**
|
||||||
|
|
||||||
* *2016-12-07* Tag the current code as version 1.0.0; see github issue #54
|
* *2016-12-07* Tag the current code as version 1.0.0; see github issue #54
|
||||||
|
|
|
@ -345,6 +345,8 @@ class XrandrOutput(object):
|
||||||
for line in configuration.split("\n"):
|
for line in configuration.split("\n"):
|
||||||
if line:
|
if line:
|
||||||
line = line.split(None, 1)
|
line = line.split(None, 1)
|
||||||
|
if line and line[0].startswith("#"):
|
||||||
|
continue
|
||||||
options[line[0]] = line[1] if len(line) > 1 else None
|
options[line[0]] = line[1] if len(line) > 1 else None
|
||||||
|
|
||||||
edid = None
|
edid = None
|
||||||
|
@ -464,7 +466,7 @@ def load_profiles(profile_path):
|
||||||
if not os.path.isfile(config_name) or not os.path.isfile(setup_name):
|
if not os.path.isfile(config_name) or not os.path.isfile(setup_name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
edids = dict([ x.strip().split() for x in open(setup_name).readlines() if x.strip() ])
|
edids = dict([ x.split() for x in (y.strip() for y in open(setup_name).readlines()) if x and x[0] != "#" ])
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
buffer = []
|
buffer = []
|
||||||
|
|
Loading…
Reference in New Issue