# HG changeset patch # User nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1275154069 0 # Node ID 4da56756a6179b9885302fc2c9a941b0545dc073 # Parent 801746c5bb9a4150322b6411f56762a63d20a22a Fixed a small bug that didn't allow to use xml files as gui input for the setting extension diff -r 801746c5bb9a -r 4da56756a617 engine/python/fife/extensions/fife_settings.py --- a/engine/python/fife/extensions/fife_settings.py Fri May 28 21:47:59 2010 +0000 +++ b/engine/python/fife/extensions/fife_settings.py Sat May 29 17:27:49 2010 +0000 @@ -132,7 +132,7 @@ if self._settings_gui_xml == "": self._settings_gui_xml = SETTINGS_GUI_XML - + if self._changes_gui_xml == "": self._changes_gui_xml = CHANGES_REQUIRE_RESTART @@ -147,7 +147,7 @@ #default settings self._resolutions = ['640x480', '800x600', '1024x768', '1280x800', '1440x900'] - + self.loadSettings() def loadSettings(self): @@ -353,15 +353,18 @@ kv_pair = i.split(" : ") dict[kv_pair[0]] = kv_pair[1] return dict - + def onOptionsPress(self): """ Opens the options dialog box. Usually you would bind this to a button. """ self.changesRequireRestart = False self.isSetToDefault = False - - self.OptionsDlg = pychan.loadXML(StringIO(self._settings_gui_xml)) + + if os.path.isfile(self._settings_gui_xml): + self.OptionsDlg = pychan.loadXML(self._settings_gui_xml) + else: + self.OptionsDlg = pychan.loadXML(StringIO(self._settings_gui_xml)) self.OptionsDlg.distributeInitialData({ 'screen_resolution' : self._resolutions, 'render_backend' : ['OpenGL', 'SDL'] @@ -412,9 +415,9 @@ """ A list of valid default screen resolutions. This should be called once right after you instantiate Settings. - + Valid screen resolutions must be strings in the form of: WIDTHxHEIGHT - + Example: settings.setAvailableScreenResolutions(["800x600", "1024x768"]) """ @@ -428,6 +431,6 @@ self.changesRequireRestart = True self.loadSettings() self.applySettings() - + if self.OptionsDlg: self.OptionsDlg.hide()