console: scripts to new options screen

This commit is contained in:
Aldo Cortesi
2015-04-06 17:11:02 +12:00
parent 488adcb79e
commit acb6b5667c
4 changed files with 14 additions and 10 deletions

View File

@@ -575,6 +575,7 @@ class ConsoleMaster(flow.FlowMaster):
self.unload_scripts() self.unload_scripts()
for command in commands: for command in commands:
self.load_script(command) self.load_script(command)
signals.update_settings.send(self)
def edit_tcp_filter(self, tcp): def edit_tcp_filter(self, tcp):
patterns = (x[0] for x in tcp) patterns = (x[0] for x in tcp)

View File

@@ -90,7 +90,6 @@ class HelpView(urwid.ListBox):
("o", "options"), ("o", "options"),
("q", "quit / return to flow list"), ("q", "quit / return to flow list"),
("Q", "quit without confirm prompt"), ("Q", "quit without confirm prompt"),
("s", "add/remove scripts"),
("S", "server replay"), ("S", "server replay"),
("t", "set sticky cookie expression"), ("t", "set sticky cookie expression"),
("T", "set tcp proxying pattern"), ("T", "set tcp proxying pattern"),

View File

@@ -152,7 +152,9 @@ class Options(urwid.WidgetWrap):
), ),
Option( Option(
"Scripts", "Scripts",
"S" "S",
lambda: master.scripts,
self.scripts
), ),
Heading("Interface"), Heading("Interface"),
@@ -239,6 +241,7 @@ class Options(urwid.WidgetWrap):
self.master.setheaders.clear() self.master.setheaders.clear()
self.master.replacehooks.clear() self.master.replacehooks.clear()
self.master.set_ignore_filter([]) self.master.set_ignore_filter([])
self.master.scripts = []
signals.update_settings.send(self) signals.update_settings.send(self)
signals.status_message.send( signals.status_message.send(
message = "All options cleared", message = "All options cleared",
@@ -300,3 +303,12 @@ class Options(urwid.WidgetWrap):
_set _set
) )
) )
def scripts(self):
self.master.view_grideditor(
grideditor.ScriptEditor(
self.master,
[[i.command] for i in self.master.scripts],
self.master.edit_scripts
)
)

View File

@@ -60,14 +60,6 @@ class Window(urwid.Frame):
keys = contentview.view_prompts, keys = contentview.view_prompts,
callback = self.master.change_default_display_mode callback = self.master.change_default_display_mode
) )
elif k == "s":
self.master.view_grideditor(
grideditor.ScriptEditor(
self.master,
[[i.command] for i in self.master.scripts],
self.master.edit_scripts
)
)
elif k == "S": elif k == "S":
if not self.master.server_playback: if not self.master.server_playback:
signals.status_prompt_path.send( signals.status_prompt_path.send(