def saveConfig():

        ConfigToSave = {"config": Config.values}

        with open(Config.MAIN_CONFIG_PATH, 'w') as outfile:
            json.dump(ConfigToSave, outfile, indent="	")
            Logger.success("Config", "Configuration file saved successfully !")
    def saveInputs():

        InputsToSave = {"inputs": Config.inputs}

        with open(Config.KEYBOARD_CONFIG_PATH, 'w') as outfile:
            json.dump(InputsToSave, outfile, indent="	")
            Logger.success("Config",
                           "Key configuration file saved successfully !")
    def check():

        import os

        # Check if the "data" folder exists (and create it if necessary)
        path = Config.DATA_FOLDER
        if not (os.path.exists(path)) and not (os.path.isdir(path)):
            Logger.info("Config", "Creating '%s' folder..." % path)
            try:
                os.mkdir(path)
                Logger.success("Config", "Done !")
            except OSError:
                Logger.error("Config",
                             "Creation of the directory %s failed" % path)
                exit()

        # Check if the "data/config" folder exists (and create it if necessary)
        path = Config.DATA_FOLDER + "/config"
        if not (os.path.exists(path)) and not (os.path.isdir(path)):
            Logger.info("Config", "Creating '%s' folder..." % path)
            try:
                os.mkdir(path)
                Logger.success("Config", "Done !")
            except OSError:
                Logger.error("Config",
                             "Creation of the directory %s failed" % path)
                exit()

        # Check if the main configuration file exists (and create it if necessary)
        path = Config.MAIN_CONFIG_PATH
        if not (os.path.exists(path)):
            Logger.info("Config",
                        "Creating the user-specific configuration file...")
            Config.createDefaultConfig()

        # Check if the keyboard configuration file exists (and create it if necessary)
        path = Config.KEYBOARD_CONFIG_PATH
        if not (os.path.exists(path)):
            Logger.info(
                "Config",
                "Creating the user-specific key configuration file...")
            Config.createDefaultInputs()
Beispiel #4
0
    def checkServerConfig():

        import os

        # Check if the "data" folder exists (and create it if necessary)
        path = Config.DATA_FOLDER
        if not (os.path.exists(path)) and not (os.path.isdir(path)):
            Logger.info("Config", "Creating '%s' folder..." % path)
            try:
                os.mkdir(path)
                Logger.success("Config", "Done !")
            except OSError:
                Logger.error("Config",
                             "Creation of the directory %s failed" % path)
                exit()

        # Check if the server configuration file exists (and create it if necessary)
        path = Config.SERVER_CONFIG_PATH
        if not (os.path.exists(path)):
            Logger.info(
                "Config",
                "A configuration file needs to be created to connect to the server"
            )
            Config.createDefaultServerConfig()
Beispiel #5
0
    def saveServerConfig():

        with open(Config.SERVER_CONFIG_PATH, 'w') as outfile:
            json.dump(Config.server, outfile, indent="	")
            Logger.success("Config",
                           "Server configuration file saved successfully !")