mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Show how options integrates with console
This is not functional at the moment, because all mutable options are still on master.
This commit is contained in:
parent
a20f8e9620
commit
c9a0fe6a0e
@ -217,8 +217,10 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
|
||||
def __init__(self, server, options):
|
||||
flow.FlowMaster.__init__(self, server, ConsoleState())
|
||||
|
||||
self.stream_path = None
|
||||
self.options = options
|
||||
self.options.errored.connect(self.options_error)
|
||||
|
||||
if options.replacements:
|
||||
for i in options.replacements:
|
||||
@ -298,6 +300,12 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
self.__dict__[name] = value
|
||||
signals.update_settings.send(self)
|
||||
|
||||
def options_error(self, opts, exc):
|
||||
signals.status_message.send(
|
||||
message=str(exc),
|
||||
expire=1
|
||||
)
|
||||
|
||||
def load_script(self, command, use_reloader=True):
|
||||
# We default to using the reloader in the console ui.
|
||||
return super(ConsoleMaster, self).load_script(command, use_reloader)
|
||||
|
@ -140,6 +140,7 @@ class Options(urwid.WidgetWrap):
|
||||
)
|
||||
self.master.loop.widget.footer.update("")
|
||||
signals.update_settings.connect(self.sig_update_settings)
|
||||
master.options.changed.connect(self.sig_update_settings)
|
||||
|
||||
def sig_update_settings(self, sender):
|
||||
self.lb.walker._modified()
|
||||
|
@ -122,6 +122,7 @@ class StatusBar(urwid.WidgetWrap):
|
||||
self._w = urwid.Pile([self.ib, self.ab])
|
||||
signals.update_settings.connect(self.sig_update_settings)
|
||||
signals.flowlist_change.connect(self.sig_update_settings)
|
||||
master.options.changed.connect(self.sig_update_settings)
|
||||
self.redraw()
|
||||
|
||||
def sig_update_settings(self, sender):
|
||||
|
@ -125,6 +125,7 @@ class Options(options.Options):
|
||||
"wsingleuser",
|
||||
"whtpasswd",
|
||||
]
|
||||
|
||||
def process_web_options(self, parser):
|
||||
if self.wsingleuser or self.whtpasswd:
|
||||
if self.wsingleuser:
|
||||
|
Loading…
Reference in New Issue
Block a user