Changeset 627 for trunk/game/run.py


Ignore:
Timestamp:
08/06/10 08:45:53 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

  • Added SettingsVersion? to settings. This contains the version (currently a date of the last change) of the settings. The version will be checked with the version in settings-dist.xml and if the versions don't match the settings.xml file will be renamed to settings-old.xml. The version string has to be set manually when editing settings-dist.xml.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/run.py

    r609 r627  
    1515 
    1616import os 
    17 from scripts.common import utils 
     17import shutil 
    1818 
    1919from fife import fife 
    2020print "Using the FIFE python module found here: ", \ 
    2121    os.path.dirname(fife.__file__) 
    22 from fife.extensions.fife_settings import Setting 
     22 
    2323from scripts.parpg import PARPGApplication 
     24from scripts.common.utils import loadSettings 
     25 
     26from scripts.common import utils 
    2427 
    2528# add paths to the swig extensions 
     
    2730utils.addPaths ('./lib', './lib/extensions') 
    2831 
    29  
    30 TDS = Setting(app_name="PARPG", 
    31               settings_file="./settings.xml",  
    32               settings_gui_xml="") 
    3332 
    3433"""This folder holds the main meta-data for PARPG. This file should be 
     
    3938def main(): 
    4039    """Application code starts from here""" 
    41     app = PARPGApplication(TDS) 
     40    dist_version = loadSettings("./settings-dist.xml").get("PARPG", "SettingsVersion") 
     41    version = loadSettings().get("PARPG", "SettingsVersion") 
     42    if (version != dist_version): 
     43        print "Newer settings-dist.xml found, renaming settings.xml to settings-old-xml" 
     44        shutil.copyfile('./settings.xml', './settings-old.xml') 
     45        shutil.copyfile('./settings-dist.xml', './settings.xml') 
     46    app = PARPGApplication(loadSettings()) 
    4247    app.run() 
    4348 
    4449if __name__ == '__main__': 
    45     if TDS.get("FIFE", "UsePsyco"): 
     50    if loadSettings().get("FIFE", "UsePsyco"): 
    4651        # Import Psyco if available 
    4752        try: 
Note: See TracChangeset for help on using the changeset viewer.