Working (I hope), config writer.
This commit is contained in:
		| @@ -14,12 +14,17 @@ import requests | |||||||
| import speechd | import speechd | ||||||
| import time | import time | ||||||
|  |  | ||||||
| config = configparser.ConfigParser() | localConfig = configparser.ConfigParser() | ||||||
|  | globalConfig = configparser.ConfigParser() | ||||||
| spd = speechd.Client() | spd = speechd.Client() | ||||||
|  |  | ||||||
| #def write_config(config, path = gamePath + "/config"): | def write_config(writeGlobal = False): | ||||||
|     #with open(path, 'w') as configfile: |     if writeGlobal == False: | ||||||
|         #config.write(configfile) |         with open(gamePath, 'w') as configfile: | ||||||
|  |             localConfig.write(configfile) | ||||||
|  |     else: | ||||||
|  |         with open(globalPath, 'w') as configfile: | ||||||
|  |             globalConfig.write(configfile) | ||||||
|  |  | ||||||
| def speak(text, interupt = True): | def speak(text, interupt = True): | ||||||
|     if interupt == True: spd.cancel() |     if interupt == True: spd.cancel() | ||||||
| @@ -32,10 +37,11 @@ def exit_game(): | |||||||
|  |  | ||||||
| def initialize_gui(gameTitle): | def initialize_gui(gameTitle): | ||||||
|     # Check for, and possibly create, storm-games path     |     # Check for, and possibly create, storm-games path     | ||||||
|     global HOME |     global globalPath | ||||||
|     global gamePath |     global gamePath | ||||||
|     HOME = BaseDirectory.xdg_config_home + "/storm-games" |     globalPath = BaseDirectory.xdg_config_home + "/storm-games" | ||||||
|     gamePath = HOME + "/" + str.lower(str.replace(gameTitle, " ", "-")) |     gamePath = globalPath + "/" + str.lower(str.replace(gameTitle, " ", "-") + "config") | ||||||
|  |     globalPath = globalPath + "/config" | ||||||
|     if not os.path.exists(gamePath): os.makedirs(gamePath) |     if not os.path.exists(gamePath): os.makedirs(gamePath) | ||||||
|     # Seed the random generator to the clock |     # Seed the random generator to the clock | ||||||
|     random.seed() |     random.seed() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user