diff options
Diffstat (limited to 'src/setup')
-rw-r--r-- | src/setup/__init__.py | 1 | ||||
-rw-r--r-- | src/setup/level.py | 17 | ||||
-rw-r--r-- | src/setup/main.py | 61 |
3 files changed, 23 insertions, 56 deletions
diff --git a/src/setup/__init__.py b/src/setup/__init__.py index e69de29..a003759 100644 --- a/src/setup/__init__.py +++ b/src/setup/__init__.py @@ -0,0 +1 @@ +# this is a package diff --git a/src/setup/level.py b/src/setup/level.py index 907d8bd..193e8f7 100644 --- a/src/setup/level.py +++ b/src/setup/level.py @@ -1,10 +1,12 @@ ''' ''' -from lxml import etree -from utils import utils +from lxml import etree # using lxml for XML processing +from utils import strs # string constants +from utils import utils # some XML utilities -class LevelInfo(object): + +class Level(object): ''' ''' @@ -15,16 +17,17 @@ class LevelInfo(object): #open up the mlvl file and read in its basic properties root = utils.getXMLRoot(path) - self.name = root.xpath('//level-info/@name')[0] - self.description = root.xpath('//level-info/@description')[0] + self.name = root.xpath(strs.XP_LevelName)[0] + self.description = root.xpath(strs.XP_LevelName)[0] + self.path = path pass def getName(self): - '''Gets the name of this level''' + '''Returns the name of this level''' return self.name def getDescription(self): - '''Gets the description of this level''' + '''Returns the description of this level''' return self.description diff --git a/src/setup/main.py b/src/setup/main.py index 1f05f10..eaa23af 100644 --- a/src/setup/main.py +++ b/src/setup/main.py @@ -2,60 +2,23 @@ ''' +#why? if __name__ == '__main__': pass -import os - -# using lxml for XML processing -from lxml import etree -from level import LevelInfo -from utils import utils - -# constants -ConfigFile = '/home/doug/workspace/Muthris/docs/examples/config.xml' -LevelExt = '.mlvl' - -# load the configuration file -config = utils.getXMLRoot(ConfigFile) - -#for each level folder, scan for and process any Muthris level files (.mlvl) -levels = [] -folders = config.xpath('//level-folders/folder/@location') -for folder in folders: - #search for files in the level folder - list = os.listdir(folder) - print(list) - for path in list: - #make sure path is not just the filename, as isfile() would fail if it was - path = folder + '/' + path - - #only want level files - if not os.path.isfile(path): - continue - if not path.endswith(LevelExt): - continue - - #create a level object for this level file - level = LevelInfo( path ) - levels.append( level ) - -print( config ) -print( folders ) - - - -# find all the level folders - -# load all the level folders +import sys +sys.path.append('./src/') -# start the menus - -print( 'done' ) +import menus +from utils import strs +# setup logging +import logging +logging.basicConfig(filename=strs.LoggingFile,level=logging.DEBUG) +log = logging.getLogger('setup.main') -def processLevelFile( file ): - ''' ''' - pass +# start the menus +menus.begin() +print( 'done' ) |