Mercurial > fife-parpg
changeset 555:63226105ac45
Load the changes_gui_xml correcty, even if it is set to a file
Stylize the changes require restart dialog
author | nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 17 Jun 2010 20:10:48 +0000 |
parents | 9b549d42f9ea |
children | 1d60e0223117 |
files | engine/python/fife/extensions/fife_settings.py |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/python/fife/extensions/fife_settings.py Thu Jun 17 15:28:46 2010 +0000 +++ b/engine/python/fife/extensions/fife_settings.py Thu Jun 17 20:10:48 2010 +0000 @@ -421,10 +421,7 @@ self.changesRequireRestart = False self.isSetToDefault = False - 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 = self._loadWidget(self._settings_gui_xml) self.OptionsDlg.stylize(self._gui_style) self.fillWidgets() self.OptionsDlg.mapEvents({ @@ -434,6 +431,14 @@ }) self.OptionsDlg.show() + def _loadWidget(self, dialog): + """Loads a widget. Can load both files and pure xml strings""" + if os.path.isfile(self._settings_gui_xml): + return pychan.loadXML(dialog) + else: + return pychan.loadXML(StringIO(dialog)) + + def fillWidgets(self): for module in self._entries.itervalues(): for entry in module.itervalues(): @@ -479,7 +484,8 @@ def _showChangeRequireRestartDialog(self): """Shows a dialog that informes the user that a restart is required to perform the changes.""" - RestartDlg = pychan.loadXML(StringIO(self._changes_gui_xml)) + RestartDlg = self._loadWidget(self._changes_gui_xml) + RestartDlg.stylize(self._gui_style) RestartDlg.mapEvents({ 'closeButton' : RestartDlg.hide }) RestartDlg.show()