Beispiel #1
0
def refresh( submodule ):
    if submodule in _loaded_module_objects:
        module = _loaded_module_objects[submodule]
        dlog("Attempting reload '%s'..." % submodule)
        try:
            module = reload(module)
        except Exception, e:
            dtrace("There was an error reloading %s :" % module.__file__)
            return False
        finally:
Beispiel #2
0
    def parse_conf(self, conf):
        p = self.parser
        p.read([conf])
        for section in p.sections():
            newmat = Material(self.app.conf)
            newmat.name = section
            newmat.icon = " "
            if p.has_option(section, 'icon'):
                newmat.icon = p.get(section, 'icon')[0]
            # parse colors
            try:
                fg = [int(c) for c in p.get(section, 'fg').split(',')]
                bg = [int(c) for c in p.get(section, 'bg').split(',')]
            except:
                dlog("Couldn't parse color in '{0}', skipping...")
                if not self.materials.get(section):
                    self.materials[section] = Material()
                continue

            newmat.fg = Color(*fg)
            newmat.bg = Color(*bg)
            self.materials[section] = newmat
    def parse_conf(self, conf):
	p = self.parser
	p.read([conf])
	for section in p.sections():
	    newmat = Material(self.app.conf)
	    newmat.name = section
	    newmat.icon = " "
	    if p.has_option(section, 'icon'):
		newmat.icon = p.get(section, 'icon')[0]
	    # parse colors
	    try:
		fg = [int(c) for c in p.get(section, 'fg').split(',')]
		bg = [int(c) for c in p.get(section, 'bg').split(',')]
	    except:
		dlog("Couldn't parse color in '{0}', skipping...")
		if not self.materials.get(section):
		    self.materials[section] = Material()
		continue
	    
	    newmat.fg = Color(*fg)
	    newmat.bg = Color(*bg)
	    self.materials[section] = newmat
Beispiel #4
0
    # Return a reference to the class itself, not an instantiated object.
    return class_obj, module_obj

_loaded_module_objects = {} 

def refresh( submodule ):
    if submodule in _loaded_module_objects:
        module = _loaded_module_objects[submodule]
        dlog("Attempting reload '%s'..." % submodule)
        try:
            module = reload(module)
        except Exception, e:
            dtrace("There was an error reloading %s :" % module.__file__)
            return False
        finally:
            dlog("Successfully refreshed %s." % submodule)
            _loaded_module_objects[submodule] = module
            return True
    else:
        return False

def load_all(modulename):
    submodules = get_all(modulename)
    dynamics = {}
    for sub in submodules:
        dynamics[sub] = get(modulename, sub)
    return dynamics

def get_all( modulename ):
    module = _get_module('src.%s' % modulename)
    module_list = []