diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-02-25 08:09:53 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-02-25 08:12:13 +0100 |
commit | 7cd2c283f5231324ff63db367073207b2fe8c04b (patch) | |
tree | 7a9aa48be2f815c841fc77a8c6c181c3e50966f8 | |
parent | typo (diff) | |
download | blueshift-7cd2c283f5231324ff63db367073207b2fe8c04b.tar.gz blueshift-7cd2c283f5231324ff63db367073207b2fe8c04b.tar.bz2 blueshift-7cd2c283f5231324ff63db367073207b2fe8c04b.tar.xz |
add uses_adhoc_settings
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | examples/comprehensive | 9 | ||||
-rw-r--r-- | info/blueshift.texinfo | 9 | ||||
-rwxr-xr-x | src/__main__.py | 17 |
3 files changed, 28 insertions, 7 deletions
diff --git a/examples/comprehensive b/examples/comprehensive index 05407b5..d361bea 100644 --- a/examples/comprehensive +++ b/examples/comprehensive @@ -6,7 +6,8 @@ # negative image, inverted image, sigmoid correction, or free # function modifier. Neither does it support multiple screens, # this is normally not an issue because Xinerama is normally used -# to put all monitors on the same screen. +# to put all monitors on the same screen; nor does it parse +# ad-hoc settings # Geographical coodinates. @@ -163,6 +164,12 @@ monitor_controller = lambda : randr(*monitors) ''' +uses_adhoc_opts = False +''' +:bool `True` if the configuration screens parses the ad-hoc settings +''' + + last_dayness = None def periodically(year, month, day, hour, minute, second, weekday, fade): ''' diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo index 1d0da93..0555cf5 100644 --- a/info/blueshift.texinfo +++ b/info/blueshift.texinfo @@ -339,6 +339,15 @@ arguments passed onto the configuration script; and store information is required to survive a configuration reload, such as replaced functions. +If you want to use the settings intended for ad-hoc +mode, set @code{uses_adhoc_opts} to @code{True}. This +lets you use @code{parser}, which is an instance of +@code{ArgParser} (from the argparser library) which +@code{parser} and @code{support_alternatives} already +invoked, without a warning being printed. If you do +not do this, @code{parser} will be @code{None} at the +time @code{periodically} is first invoked by Blueshift. + @node Colour curve manipulators @section Colour curve manipulators diff --git a/src/__main__.py b/src/__main__.py index f432a23..d7827cd 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -31,7 +31,7 @@ PROGRAM_VERSION = '1.7' ## Set global variables global DATADIR, i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate global periodically, wait_period, fadein_time, fadeout_time, fadein_steps, fadeout_steps -global monitor_controller, running, continuous_run, panic, _globals_, conf_storage +global monitor_controller, running, continuous_run, panic, _globals_, conf_storage, parser global signal_SIGTERM, signal_SIGUSR1, signal_SIGUSR2 @@ -125,6 +125,11 @@ panic = False :bool `True` if the program has received two terminate signals ''' +uses_adhoc_opts = False +''' +:bool `True` if the configuration screens parses the ad-hoc settings +''' + conf_opts = None ''' :list<str> This list will never be `None` and it will always have at least @@ -356,11 +361,6 @@ output = parser.opts['--output'] if output is None: output = [] -if config_file is not None: - if any([doreset, location, gammas, rgb_brightnesses, cie_brightnesses, temperatures, output]): - print('--configurations can only be combined with --panicgate') - sys.exit(1) - a = lambda opt : 0 if parser.opts[opt] is None else len(parser.opts[opt]) for opt in ('--configurations', '--panicgate', '--reset', '--location'): if a(opt) > 1: @@ -474,6 +474,11 @@ else: print('No configuration file found') sys.exit(1) + # Warn about ad-hoc settings + if not uses_adhoc_opts: + if any([doreset, location, gammas, rgb_brightnesses, cie_brightnesses, temperatures, output]): + print('%s: warning: --configurations can only be combined with --panicgate' % sys.argv[0]) + parser = None ## Run periodically if configured to if periodically is not None: |