changeset 556:1d60e0223117

Added a check when a new entry is added to the settings. If get returns None, it is assumed the entry is not presenta in the current settings file, thus the default is copied and the check is repeated. If it is still not found a warning is printed.
author nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 18 Jun 2010 08:51:05 +0000
parents 63226105ac45
children c62fe35ae67c
files engine/python/fife/extensions/fife_settings.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/engine/python/fife/extensions/fife_settings.py	Thu Jun 17 20:10:48 2010 +0000
+++ b/engine/python/fife/extensions/fife_settings.py	Fri Jun 18 08:51:05 2010 +0000
@@ -202,6 +202,15 @@
 			self._entries[entry.module] = {}
 		self._entries[entry.module][entry.name] = entry
 
+		# Make sure the new entry is available
+		if self.get(entry.module, entry.name) is None:
+			print "Updating", self._settings_file, "to the default, it is missing the entry:"\
+			      , entry.name ,"for module", entry.module
+			self.setDefaults()
+		if self.get(entry.module, entry.name) is None:
+			print "WARNING:", entry.module, ":", entry.name, "still not found!"
+			print "It's probably missing in settings-dist.xml as well!"
+
 	def loadSettings(self):
 		self._tree = ET.parse(os.path.join(self._appdata, self._settings_file))
 
@@ -514,7 +523,6 @@
 		if self.OptionsDlg:
 			self.OptionsDlg.hide()
 
-
 	def _getEntries(self):
 		return self._entries