From dccdfc988dc6968363271540d9b528a3920f9228 Mon Sep 17 00:00:00 2001 From: Storm Date: Fri, 25 Mar 2016 09:59:45 -0400 Subject: [PATCH] Added xdg path stuff to initialization. --- .gitignore | 1 + numnastics/storm_games.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/numnastics/storm_games.py b/numnastics/storm_games.py index 47baa68..c937335 100755 --- a/numnastics/storm_games.py +++ b/numnastics/storm_games.py @@ -6,14 +6,12 @@ import os from os import listdir from os.path import isfile, join from inspect import isfunction +from xdg import BaseDirectory import pygame import random import speechd import time -def __init__(): - random.seed() - spd = speechd.Client() def speak(text, interupt = True): if interupt == True: spd.cancel() @@ -25,6 +23,12 @@ def exit_game(): exit() def initialize_gui(gameTitle): + # Check for, and possibly create, storm-games path + global HOME + HOME = BaseDirectory.xdg_config_home + "/storm-games" + if not os.path.exists(HOME): os.makedirs(HOME) + # Seed the random generator to the clock + random.seed() # Set game's name global gameName gameName = gameTitle