source: branches/active/character_customization/game/ @ 833

Revision 826, 2.8 KB checked in by aspidites, 8 years ago (diff)

Patch by Aspidites:

  • removed debug print statements
  • Property svn:eol-style set to native
  • Property svn:executable set to *
[825]1#!/usr/bin/env python2
[30]2#   This program is free software: you can redistribute it and/or modify
3#   it under the terms of the GNU General Public License as published by
4#   the Free Software Foundation, either version 3 of the License, or
5#   (at your option) any later version.
[30]7#   This program is distributed in the hope that it will be useful,
8#   but WITHOUT ANY WARRANTY; without even the implied warranty of
10#   GNU General Public License for more details.
[30]12#   You should have received a copy of the GNU General Public License
13#   along with this program.  If not, see <>.
[809]15#TODO: Modularize this script
[646]16import sys
[786]17import logging
[798]19from optparse import OptionParser
[747]20from parpg.settings import Settings
[798]22# Python 2.6 or lower
23parser = OptionParser(description='PARPG Launcher Script')
[825]24parser.add_option('-p', '--paths',
[810]25                  default='.',
[825]26                  help='One or more paths to load settings from. If more than '
27                       'one path is given, be sure to surround the value in '
28                       'quotes.')
[798]29parser.add_option('-f', '--logfile',
[810]30                  help='Name of log file to save to')
[798]31parser.add_option('-l', '--loglevel', default='critical',
[810]32                  help='desired output level for log file')
[800]33opts, args = parser.parse_args()
[787]35# initialize settings
[825]36paths = opts.paths.split(' ')
37settings = Settings(*paths)
[786]39levels = {'debug': logging.DEBUG,
40          'info': logging.INFO,
41          'warning': logging.WARNING,
42          'error': logging.ERROR,
43          'critical': logging.CRITICAL}
[787]45#TODO: setup formating
[800]46logging.basicConfig(filename=opts.logfile, level=levels[opts.loglevel])
[787]47logger = logging.getLogger('parpg')
[786]50    sys.path.insert(0, settings.parpg.FifePath)
[787]51except AttributeError:
52    logger.warning('[parpg] section has no FifePath option')
55    from fife import fife
56    from parpg.application import PARPGApplication
[786]58    from parpg.common import utils
59except ImportError:
60    #TODO: pay attention to which module actually failed
[787]61    logger.critical("Could not import fife module. Please install fife or add "
[786]62                     "'FifePath' to the [parpg] section of your settings file")
63    sys.exit(1)
[786]65# enable psyco if available and in settings file
67    import psyco
68    psyco_available = True
69except ImportError:
[787]70    logger.warning('Psyco Acceleration unavailable')
[786]71    psyco_available = False
[786]73if settings.fife.UsePsyco:
74    if psyco_available:
75        psyco.full()
[787]76'Psyco Acceleration enabled')
[747]77    else:
[787]78        logger.warning('Please install psyco before attempting to use it'
[786]79                        'Psyco Acceleration disabled')
[787]81'Psycho Acceleration disabled')
[786]83# run the game
84app = PARPGApplication(settings)
Note: See TracBrowser for help on using the repository browser.