comparison main.py @ 2:06145a6ee387

Fixed resource path dependencies issue that caused PARPG to crash on start. * PARPG should now run without issue (system installation not tested). * Utilized FIFE's VFS module to remove path dependencies from most PARPG modules. * The new parpg.vfs module is a singleton with a single global variable, VFS, which is a reference to the global VFS instance. Although a singleton is not ideal it should be replaced once PARPG's core code is refactored. * The parpg.vfs singleton is initialized in the parpg.applicaiton.PARPGApplication class with the absolute path to the data directory via the parpg.settings module and corresponding configuration file. * A new DataPath entry was added to the default system configuration file template under the [parpg] section to support the new parpg.vfs module. * Updated the parpg-assets subrepo to revision 3 to fix some dialog file format issues (for details see commit message for parpg-assets). * Fixed a few bugs in the parpg.dialogueparsers.YAMLDialogueParser class related to exception handling.
author M. George Hansen <technopolitica@gmail.com>
date Mon, 06 Jun 2011 15:56:14 -1000
parents 7a89ea5404b1
children 06be71be07f1
comparison
equal deleted inserted replaced
1:4912a6f97c52 2:06145a6ee387
16 import sys 16 import sys
17 import logging 17 import logging
18 18
19 from optparse import OptionParser 19 from optparse import OptionParser
20 20
21 from parpg.settings import Settings
22
21 usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n' 23 usage = ('usage: %prog [options] settings_path [system_path user_path]\n\n'
22 'The settings_path argument is mandatory and is the directory in \n' 24 'The settings_path argument is mandatory and is the directory in \n'
23 'which your system.cfg file is located. Optionally, you may \n' 25 'which your system.cfg file is located. Optionally, you may \n'
24 'specify where data files are located (system_path), and where \n' 26 'specify where data files are located (system_path), and where \n'
25 'the user settings and data files should be saved to (user_path)\n\n' 27 'the user settings and data files should be saved to (user_path)\n\n'
28 parser = OptionParser(description='PARPG Launcher Script', usage=usage) 30 parser = OptionParser(description='PARPG Launcher Script', usage=usage)
29 parser.add_option('-f', '--logfile', 31 parser.add_option('-f', '--logfile',
30 help='Name of log file to save to') 32 help='Name of log file to save to')
31 parser.add_option('-l', '--loglevel', default='critical', 33 parser.add_option('-l', '--loglevel', default='critical',
32 help='desired output level for log file') 34 help='desired output level for log file')
33 parser.add_option('-m', '--module',
34 help='location of the parpg module')
35 opts, args = parser.parse_args() 35 opts, args = parser.parse_args()
36 36
37 if not args: 37 if not args:
38 parser.print_help() 38 parser.print_help()
39 sys.exit(1) 39 sys.exit(1)
40 40
41 41
42 # initialize settings
43 if opts.module:
44 print('added ' + opts.module)
45 sys.path.insert(0, opts.module)
46
47 from parpg.settings import Settings
48 42
49 settings = Settings(*args) 43 settings = Settings(*args)
50 44
51 levels = {'debug': logging.DEBUG, 45 levels = {'debug': logging.DEBUG,
52 'info': logging.INFO, 46 'info': logging.INFO,