Mercurial > fife-parpg
comparison engine/python/fife/extensions/fife_settings.py @ 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 |
comparison
equal
deleted
inserted
replaced
554:9b549d42f9ea | 555:63226105ac45 |
---|---|
419 Opens the options dialog box. Usually you would bind this to a button. | 419 Opens the options dialog box. Usually you would bind this to a button. |
420 """ | 420 """ |
421 self.changesRequireRestart = False | 421 self.changesRequireRestart = False |
422 self.isSetToDefault = False | 422 self.isSetToDefault = False |
423 | 423 |
424 if os.path.isfile(self._settings_gui_xml): | 424 self.OptionsDlg = self._loadWidget(self._settings_gui_xml) |
425 self.OptionsDlg = pychan.loadXML(self._settings_gui_xml) | |
426 else: | |
427 self.OptionsDlg = pychan.loadXML(StringIO(self._settings_gui_xml)) | |
428 self.OptionsDlg.stylize(self._gui_style) | 425 self.OptionsDlg.stylize(self._gui_style) |
429 self.fillWidgets() | 426 self.fillWidgets() |
430 self.OptionsDlg.mapEvents({ | 427 self.OptionsDlg.mapEvents({ |
431 'okButton' : self.applySettings, | 428 'okButton' : self.applySettings, |
432 'cancelButton' : self.OptionsDlg.hide, | 429 'cancelButton' : self.OptionsDlg.hide, |
433 'defaultButton' : self.setDefaults | 430 'defaultButton' : self.setDefaults |
434 }) | 431 }) |
435 self.OptionsDlg.show() | 432 self.OptionsDlg.show() |
433 | |
434 def _loadWidget(self, dialog): | |
435 """Loads a widget. Can load both files and pure xml strings""" | |
436 if os.path.isfile(self._settings_gui_xml): | |
437 return pychan.loadXML(dialog) | |
438 else: | |
439 return pychan.loadXML(StringIO(dialog)) | |
440 | |
436 | 441 |
437 def fillWidgets(self): | 442 def fillWidgets(self): |
438 for module in self._entries.itervalues(): | 443 for module in self._entries.itervalues(): |
439 for entry in module.itervalues(): | 444 for entry in module.itervalues(): |
440 widget = self.OptionsDlg.findChildByName(entry.settingwidgetname) | 445 widget = self.OptionsDlg.findChildByName(entry.settingwidgetname) |
477 | 482 |
478 | 483 |
479 def _showChangeRequireRestartDialog(self): | 484 def _showChangeRequireRestartDialog(self): |
480 """Shows a dialog that informes the user that a restart is required | 485 """Shows a dialog that informes the user that a restart is required |
481 to perform the changes.""" | 486 to perform the changes.""" |
482 RestartDlg = pychan.loadXML(StringIO(self._changes_gui_xml)) | 487 RestartDlg = self._loadWidget(self._changes_gui_xml) |
488 RestartDlg.stylize(self._gui_style) | |
483 RestartDlg.mapEvents({ 'closeButton' : RestartDlg.hide }) | 489 RestartDlg.mapEvents({ 'closeButton' : RestartDlg.hide }) |
484 RestartDlg.show() | 490 RestartDlg.show() |
485 | 491 |
486 | 492 |
487 def setAvailableScreenResolutions(self, reslist): | 493 def setAvailableScreenResolutions(self, reslist): |