Modules reloading for restore feature
To reflect settings changes on screen restore module reload all modules after reading settings from file. Change-Id: Ia8c3b40214fbda0f5238a8ef424b437a9766007d Closes-Bug: #1527111 Depends-On: If2930991501b1718174d1b84b0d8d53af6f6a789
This commit is contained in:
parent
15ebb0d4bb
commit
9dd7e7da83
@ -160,13 +160,6 @@ class FuelSetup(object):
|
||||
size = self.screen.get_cols_rows()
|
||||
self.screen.draw_screen(size, self.frame.render(size))
|
||||
|
||||
def refreshChildScreen(self, name):
|
||||
child = self.children[int(self.choices.index(name))]
|
||||
|
||||
child.screen = child.screenUI()
|
||||
|
||||
self.draw_child_screen(child.screen)
|
||||
|
||||
def main(self):
|
||||
text_header = (u"Fuel %s setup "
|
||||
u"Use Up/Down/Left/Right to navigate. F8 exits. "
|
||||
@ -320,6 +313,15 @@ class FuelSetup(object):
|
||||
self.settings.write(outfn=consts.SETTINGS_FILE)
|
||||
return True, None
|
||||
|
||||
def reload_modules(self):
|
||||
for child in self.children:
|
||||
if hasattr(child, 'load') and callable(child.load):
|
||||
child.load()
|
||||
child.screen = child.screenUI()
|
||||
self.draw_child_screen(child.screen)
|
||||
|
||||
self.refreshScreen()
|
||||
|
||||
|
||||
def setup():
|
||||
urwid.web_display.set_preferences("Fuel Setup")
|
||||
|
@ -75,7 +75,6 @@ is accessible"}
|
||||
|
||||
self.load()
|
||||
self.screen = None
|
||||
self.fixEtcHosts()
|
||||
|
||||
def fixEtcHosts(self):
|
||||
# replace ip for env variable HOSTNAME in /etc/hosts
|
||||
@ -202,6 +201,8 @@ is accessible"}
|
||||
return responses
|
||||
|
||||
def apply(self, args):
|
||||
self.fixEtcHosts()
|
||||
|
||||
responses = self.check(args)
|
||||
if responses is False:
|
||||
log.error("Check failed. Not applying")
|
||||
|
@ -77,9 +77,8 @@ class restore(urwid.WidgetWrap):
|
||||
"(Use 'Shell Login' if you want fetch "
|
||||
"settings manually from a remote host and then "
|
||||
"return to this menu to restore them.)",
|
||||
"NOTE: After restoring settings in this "
|
||||
"section, please exit from the menu without "
|
||||
"saving changes."]
|
||||
"",
|
||||
"Attention! All unsaved settings will be lost."]
|
||||
self.fields = ["PATH"]
|
||||
self.defaults = {
|
||||
"PATH": {
|
||||
@ -176,7 +175,8 @@ class restore(urwid.WidgetWrap):
|
||||
return False
|
||||
self.parent.footer.set_text("Applying changes...")
|
||||
self.save(responses)
|
||||
self.parent.footer.set_text("Changes saved successfully.")
|
||||
self.parent.reload_modules()
|
||||
self.parent.footer.set_text("Setings restored successfully.")
|
||||
return True
|
||||
|
||||
def load(self):
|
||||
|
Loading…
Reference in New Issue
Block a user