Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created March 11, 2012 12:07
Show Gist options
  • Save AeroNotix/2016207 to your computer and use it in GitHub Desktop.
Save AeroNotix/2016207 to your computer and use it in GitHub Desktop.
class Defaults:
def __init__(self, *defaults):
"""
defaults: A list of (name, value, description) tuples.
"""
self.defaults = defaults
def load(self, target, config):
"""
Loads a dict of attributes, using specified defaults, onto target.
"""
debug_file = open("/home/xeno/qtile_debug", "a")
debug_file.write(''.join([str(target), '\n']))
for item in self.defaults:
debug_file.write(str(item))
debug_file.write('\n')
debug_file.write('\n\n')
debug_file.close()
for i in self.defaults:
val = config.get(i[0], i[1])
setattr(target, i[0], val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment