Mercurial > fife-parpg
diff engine/python/fife/extensions/fife_settings.py @ 543:cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 02 Jun 2010 21:43:03 +0000 |
parents | 4c7b5eee211c |
children | 9b549d42f9ea |
line wrap: on
line diff
--- a/engine/python/fife/extensions/fife_settings.py Tue Jun 01 21:38:14 2010 +0000 +++ b/engine/python/fife/extensions/fife_settings.py Wed Jun 02 21:43:03 2010 +0000 @@ -81,9 +81,6 @@ EMPTY_SETTINGS="""\ <?xml version='1.0' encoding='UTF-8'?> <Settings> - <Module name="FIFE"> - - </Module> </Settings> """ @@ -101,7 +98,7 @@ screen_height = settings.get("FIFE", "ScreenHeight", 768) """ - def __init__(self, app_name="", settings_file="", settings_gui_xml="", changes_gui_xml=""): + def __init__(self, app_name="", settings_file="", settings_gui_xml="", changes_gui_xml="", copy_dist=True): """ Initializes the Setting object. @@ -115,8 +112,8 @@ @type settings_file: C{string} @param settings_gui_xml: If you specify this parameter you can customize the look of the settings dialog box. - @note: As of now you MUST have all the elements of the default settings dialog box. - At some point we may make it customizable. + @param copy_dist: Copies the settings-dist.xml file to the settings_file location. If + this is False it will create a new empty xml file. """ self._app_name = app_name @@ -140,7 +137,7 @@ if not os.path.exists(os.path.join(self._appdata, self._settings_file)): - if os.path.exists('settings-dist.xml'): + if os.path.exists('settings-dist.xml') and copy_dist: shutil.copyfile('settings-dist.xml', os.path.join(self._appdata, self._settings_file)) else: #no settings file found @@ -204,6 +201,7 @@ def loadSettings(self): self._tree = ET.parse(os.path.join(self._appdata, self._settings_file)) + self._root_element = self._tree.getroot() self.validateTree()