Skip to content

Commit

Permalink
Clean up settings.yml.
Browse files Browse the repository at this point in the history
  • Loading branch information
rec committed Dec 28, 2014
1 parent 5138544 commit f04dbb4
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 41 deletions.
8 changes: 5 additions & 3 deletions code/python/echomesh/Instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def do_quit():

self.display = Display.display(self.callback)
self.keyboard_runnable = self.osc = None
if Settings.get('control_program'):
if Settings.get('execution', 'control_program'):
from echomesh.util.thread import Keyboard
args = {}
keyboard, self.keyboard_runnable = Keyboard.keyboard(
Expand Down Expand Up @@ -101,12 +101,14 @@ def callback(self, data):
if data == 'start':
self.after_server_starts()
else:
print(data)
#print(data)
pass

def after_server_starts(self):
if cechomesh.LOADED:
run_after(self.run,
Expression.convert(Settings.get('delay_before_run')))
Expression.convert(Settings.get('execution',
'delay_before_run')))
else:
self.run()
if self.display:
Expand Down
2 changes: 1 addition & 1 deletion code/python/echomesh/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def p(msg=''):
Settings.reconfigure(sys.argv[1:])
p()

if Settings.get('autostart') and not Settings.get(
if Settings.get('execution', 'autostart') and not Settings.get(
'permission', 'autostart'):
print()
from echomesh.util import Log
Expand Down
2 changes: 1 addition & 1 deletion code/python/echomesh/base/Reconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def reconfigure(args):
if not isinstance(tags, (list, tuple)):
tags = [tags]

prompt = not get('autostart')
prompt = not get('execution', 'autostart')
return _make(name, tags, project, prompt, args)
2 changes: 1 addition & 1 deletion code/python/echomesh/base/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def assign(values):

# Automatically save any changed variables on exit.
def save(log=True):
if get('autosave'):
if get('execution', 'autosave'):
files = MERGE_SETTINGS.save()
if log and files:
print(
Expand Down
2 changes: 1 addition & 1 deletion code/python/echomesh/remote/Transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def transfer(_, **data):
o.write(value['contents'])
os.utime(fname, (value['atime'], value['mtime']))

if Settings.get('delete_backups_after_transfer'):
if Settings.get('execution', 'delete_backups_after_transfer'):
try:
shutil.rmtree(backup_directory)
except:
Expand Down
73 changes: 40 additions & 33 deletions code/python/echomesh/settings/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ type: config
aliases:
save_with_project: false

# Can you remotely request the shutdown and restart of this machine?
allow_shutdown: true

# Do changes to the configuration save automatically?
autosave: true

# Enable autostart.
#
# You still have to configure your computer to automatically run echomesh before
# this flag has any effect. It's mostly used for temporarily turning off the
# program actually starting while you're debugging it.

autostart: false

audio:
# The audio section is the longest section in the whole config file.

Expand Down Expand Up @@ -71,24 +57,6 @@ audio:
# Disabled, see https://github.com/rec/echomesh/issues/197.
route: audio

# Do we get and process commands from the keyboard?
# Set this to "false" for autostart jobs.
# TODO: this needs to be rethought and perhaps re-integrated with autostart.
control_program: true

delay_before_keyboard_activates: 0.5 seconds
delay_before_run: 0.1 seconds

# The "transfer" operation overwrites all the score files on all the target
# machines. A backup is made during the transfer in case it fails halfway
# through.
#
# If :delete_backups_after_transfer is true, that backup is deleted after the
# transfer is complete, otherwise that backup is kept around until the next
# transfer is started.

delete_backups_after_transfer: false

# Turns on various debugging mechanisms and gives better diagnositics.
debug: false

Expand All @@ -107,6 +75,43 @@ diagnostics:
# If true, on quit echomesh prints a list of configs that were never read.
unused_configs: false

execution:
# Can you remotely request the shutdown and restart of this machine?
allow_shutdown: true

# Do changes to the configuration save automatically?
autosave: true

# Enable autostart.
#
# You still have to configure your computer to automatically run echomesh before
# this flag has any effect. It's mostly used for temporarily turning off the
# program actually starting while you're debugging it.
autostart: false

# Handling of the visualiser windows.
close_button_quits: false
close_button_closes_window: true
new_pattern_opens_window: true

# Do we get and process commands from the keyboard?
# Set this to "false" for autostart jobs.
# TODO: this needs to be rethought and perhaps re-integrated with autostart.
control_program: true

delay_before_keyboard_activates: 0.5 seconds
delay_before_run: 0.1 seconds

# The "transfer" operation overwrites all the score files on all the target
# machines. A backup is made during the transfer in case it fails halfway
# through.
#
# If :delete_backups_after_transfer is true, that backup is deleted after the
# transfer is complete, otherwise that backup is kept around until the next
# transfer is started.

delete_backups_after_transfer: false

# The git section sets the user, project name and server for a git repository
# connected to the echomesh project. Please note that you'll still have to
# authenticate your machine to your git host if you want to check in changes
Expand All @@ -124,7 +129,7 @@ hardware:
shutdown_pin_bounce_time: 300

# Enable lighting control. Note that your program has to be running as sudo
# for the lighting to work.
# for the SPI lighting to work on the RP.
light:
brightness: 100%
count: 0
Expand Down Expand Up @@ -270,6 +275,8 @@ pi3d:
# The path to your project's root directory.
project: ""

# A scale factor for time. A value greater than 1.0 (100%) means that events
# occur faster, less than 1.0 (100%) means that they occur slower.
speed: 100%

tag: []
Expand Down
3 changes: 2 additions & 1 deletion code/python/echomesh/util/thread/Keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def processor(line):
except:
LOGGER.error('Error processing command line.')

sleep = Expression.convert(Settings.get('delay_before_keyboard_activates'))
sleep = Expression.convert(Settings.get('execution',
'delay_before_keyboard_activates'))
keyboard = Keyboard(sleep=sleep, message=MESSAGE, processor=processor,
writer=writer, reader=reader)
if new_thread:
Expand Down

0 comments on commit f04dbb4

Please sign in to comment.