report progress through screens via context
This commit is contained in:
parent
fa39f10651
commit
1f1937b03f
|
@ -444,10 +444,14 @@ class Application:
|
||||||
json.dump(cur.serialize(), fp)
|
json.dump(cur.serialize(), fp)
|
||||||
|
|
||||||
def select_screen(self, new):
|
def select_screen(self, new):
|
||||||
log.info("moving to screen %s", new.name)
|
new.context.enter("starting UI")
|
||||||
if self.opts.screens and new.name not in self.opts.screens:
|
if self.opts.screens and new.name not in self.opts.screens:
|
||||||
raise Skip
|
raise Skip
|
||||||
|
try:
|
||||||
new.start_ui()
|
new.start_ui()
|
||||||
|
except Skip:
|
||||||
|
new.context.exit("(skipped)")
|
||||||
|
raise
|
||||||
state_path = os.path.join(self.state_dir, 'last-screen')
|
state_path = os.path.join(self.state_dir, 'last-screen')
|
||||||
with open(state_path, 'w') as fp:
|
with open(state_path, 'w') as fp:
|
||||||
fp.write(new.name)
|
fp.write(new.name)
|
||||||
|
@ -456,6 +460,7 @@ class Application:
|
||||||
self.save_state()
|
self.save_state()
|
||||||
old = self.controllers.cur
|
old = self.controllers.cur
|
||||||
if old is not None:
|
if old is not None:
|
||||||
|
old.context.exit("completed")
|
||||||
old.end_ui()
|
old.end_ui()
|
||||||
while True:
|
while True:
|
||||||
self.controllers.index += increment
|
self.controllers.index += increment
|
||||||
|
|
Loading…
Reference in New Issue