Example #1
0
    def __init__(self, debug=False):
        self._logger = logging.getLogger(__name__)
        self.debug = debug
        self.nodescfg = jsontree.clone(config().getConfig('nodes'))

        # inicjalizacja systemu pluginów - dekoderów nodów
        p = plugins(init=True)
Example #2
0
    def update(self, _new_value):
        """Add to node config "raw" value with data from wireless nodes"""
 
        new_value = jsontree.clone(_new_value)
        try: 
            if self.nodescfg.has_key(new_value.name):
                for k,v in self.nodescfg[new_value.name].sensors.iteritems():
                    self.nodescfg[new_value.name].sensors[k].raw = new_value[k]
            else:
                return
        except AttributeError:
            return
		#self.nodescfg = OrderedDict(self.nodescfg)	
        return jsontree.dumps(self.nodescfg,sort_keys=True)
Example #3
0
def load_options(app):
    options = jsontree.clone(DEFAULTS)
    try:
        with app.open('options.json') as optfile:
            options.update(jsontree.load(optfile))
    except:
        #print sys.exc_info()
        app.options = options
        save_options(app)
    if options.monitor_interval != DEFAULTS.monitor_interval:
        timer = halfcaff.util.get_timer(app.monitor)
        if timer:
            timer.interval = options.monitor_interval
    app.options = options
    if 'auto_caffeinate' in options:
        # old version
        options['auto_caffeinate_vpn'] = options['auto_caffeinate']
        options['auto_caffeinate_timemachine'] = options['auto_caffeinate']
        del options['auto_caffeinate']
        save_options(app)
    return options
 def clone(cls, src):
     return jsontree.clone(src)
Example #5
0
 def __init__(self, history, debug=True):
     self._logger = logging.getLogger(__name__)
     self.debug = True
     self.history = history
     self.nodescfg = jsontree.clone(config().getConfig('nodes'))