def enable_module(names,enable):
	disabledModules = parse_settings.get_disabled_modules()
	enabledModules = parse_settings.get_modules()
	toEnable=[]
	toDisable=[]
	changed  = False
	for name in names:
		if any(item == name for item in disabledModules+enabledModules):
			if (name in enabledModules):
				if (enable):
					print "module %s is already enabled"%name
				else:
					toDisable.append(name)
					changed  = True				
					print "disabled module ",name
			else:
				if (enable):
					toEnable.append(name)
					changed  = True				
					print "enabled module ",name
				else:
					print "module %s is already disabled"%name
		else:
			print "Module %s not found"%name

	if (changed):
		enabledModules += toEnable
		disabledModules += toDisable
		enabledModules = list(set(enabledModules) - set(toDisable))
		disabledModules = list(set(disabledModules) - set(toEnable))
		enabledModules = sorted(enabledModules, key=lambda k: parse_modules.get_module_priority(k))
		disabledModules = sorted(disabledModules, key=lambda k: parse_modules.get_module_priority(k))		
		parse_settings.set_settings('Modules',enabledModules)
		parse_settings.set_settings('DisabledModules',disabledModules)
		project_files.update_main_file()	
Exemplo n.º 2
0
def add_module(names):
	currentModules = parse_settings.get_all_modules()
	added  = False
	for name in names:
		if any(item['Name'] == name for item in parse_modules.get_available_modules()):
			if (name in currentModules):
				print "module %s is already added"%name
			else:
				currentModules.append(name)
				added  = True
				print "adding module ",name
		else:
			print "Module %s not found"%name

	if (added):
		currentModules = sorted(currentModules, key=lambda k: parse_modules.get_module_priority(k))
		parse_settings.set_settings('Modules',currentModules)
		project_files.update_main_file()
Exemplo n.º 3
0
def add_module(names):
	currentModules = parse_settings.get_all_modules()
	added  = False
	for name in names:
		if any(item['Name'] == name for item in parse_modules.get_available_modules()):
			if (name in currentModules):
				print "module %s is already added"%name
			else:
				currentModules.append(name)
				added  = True				
				print "adding module ",name
		else:
			print "Module %s not found"%name

	if (added): 
		currentModules = sorted(currentModules, key=lambda k: parse_modules.get_module_priority(k))
		parse_settings.set_settings('Modules',currentModules)
		project_files.update_main_file()	
Exemplo n.º 4
0
def enable_module(names, enable):
    disabledModules = parse_settings.get_disabled_modules()
    enabledModules = parse_settings.get_modules()
    toEnable = []
    toDisable = []
    changed = False
    for name in names:
        if any(item == name for item in disabledModules + enabledModules):
            if (name in enabledModules):
                if (enable):
                    print "module %s is already enabled" % name
                else:
                    toDisable.append(name)
                    changed = True
                    print "disabled module ", name
            else:
                if (enable):
                    toEnable.append(name)
                    changed = True
                    print "enabled module ", name
                else:
                    print "module %s is already disabled" % name
        else:
            print "Module %s not found" % name

    if (changed):
        enabledModules += toEnable
        disabledModules += toDisable
        enabledModules = list(set(enabledModules) - set(toDisable))
        disabledModules = list(set(disabledModules) - set(toEnable))
        enabledModules = sorted(
            enabledModules, key=lambda k: parse_modules.get_module_priority(k))
        disabledModules = sorted(
            disabledModules,
            key=lambda k: parse_modules.get_module_priority(k))
        parse_settings.set_settings('Modules', enabledModules)
        parse_settings.set_settings('DisabledModules', disabledModules)
        project_files.update_main_file()