Merge pull request #1588 from cortesi/consolereplay

console: fix client replay
This commit is contained in:
Aldo Cortesi 2016-09-30 12:35:41 +10:00 committed by GitHub
commit 05e2e55eb8
3 changed files with 13 additions and 16 deletions

View File

@ -19,6 +19,7 @@ class ClientPlayback:
def configure(self, options, updated): def configure(self, options, updated):
if "client_replay" in updated: if "client_replay" in updated:
if options.client_replay: if options.client_replay:
ctx.log.info(options.client_replay)
try: try:
flows = flow.read_flows_from_paths(options.client_replay) flows = flow.read_flows_from_paths(options.client_replay)
except exceptions.FlowReadException as e: except exceptions.FlowReadException as e:

View File

@ -635,14 +635,6 @@ class ConsoleMaster(flow.FlowMaster):
def edit_scripts(self, scripts): def edit_scripts(self, scripts):
self.options.scripts = [x[0] for x in scripts] self.options.scripts = [x[0] for x in scripts]
def stop_client_playback_prompt(self, a):
if a != "n":
self.stop_client_playback()
def stop_server_playback_prompt(self, a):
if a != "n":
self.stop_server_playback()
def quit(self, a): def quit(self, a):
if a != "n": if a != "n":
raise urwid.ExitMainLoop raise urwid.ExitMainLoop

View File

@ -40,13 +40,11 @@ class Window(urwid.Frame):
def handle_replay(self, k): def handle_replay(self, k):
if k == "c": if k == "c":
if not self.master.client_playback: creplay = self.master.addons.get("clientplayback")
signals.status_prompt_path.send( if self.master.options.client_replay and creplay.count():
self, def stop_client_playback_prompt(a):
prompt = "Client replay path", if a != "n":
callback = self.master.client_playback_path self.master.options.client_replay = None
)
else:
signals.status_prompt_onekey.send( signals.status_prompt_onekey.send(
self, self,
prompt = "Stop current client replay?", prompt = "Stop current client replay?",
@ -54,7 +52,13 @@ class Window(urwid.Frame):
("yes", "y"), ("yes", "y"),
("no", "n"), ("no", "n"),
), ),
callback = self.master.stop_client_playback_prompt, callback = stop_client_playback_prompt
)
else:
signals.status_prompt_path.send(
self,
prompt = "Client replay path",
callback = lambda x: self.master.options.setter("client_replay")([x])
) )
elif k == "s": elif k == "s":
a = self.master.addons.get("serverplayback") a = self.master.addons.get("serverplayback")