Mercurial > fife-parpg
changeset 532:4da56756a617
Fixed a small bug that didn't allow to use xml files as gui input for the setting extension
author | nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 29 May 2010 17:27:49 +0000 |
parents | 801746c5bb9a |
children | 082e919cc348 |
files | engine/python/fife/extensions/fife_settings.py |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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()