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:
Aldo Cortesi 2016-07-13 19:05:32 +12:00
parent a20f8e9620
commit c9a0fe6a0e
4 changed files with 11 additions and 0 deletions

View File

@ -217,8 +217,10 @@ class ConsoleMaster(flow.FlowMaster):
def __init__(self, server, options): def __init__(self, server, options):
flow.FlowMaster.__init__(self, server, ConsoleState()) flow.FlowMaster.__init__(self, server, ConsoleState())
self.stream_path = None self.stream_path = None
self.options = options self.options = options
self.options.errored.connect(self.options_error)
if options.replacements: if options.replacements:
for i in options.replacements: for i in options.replacements:
@ -298,6 +300,12 @@ class ConsoleMaster(flow.FlowMaster):
self.__dict__[name] = value self.__dict__[name] = value
signals.update_settings.send(self) 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): def load_script(self, command, use_reloader=True):
# We default to using the reloader in the console ui. # We default to using the reloader in the console ui.
return super(ConsoleMaster, self).load_script(command, use_reloader) return super(ConsoleMaster, self).load_script(command, use_reloader)

View File

@ -140,6 +140,7 @@ class Options(urwid.WidgetWrap):
) )
self.master.loop.widget.footer.update("") self.master.loop.widget.footer.update("")
signals.update_settings.connect(self.sig_update_settings) signals.update_settings.connect(self.sig_update_settings)
master.options.changed.connect(self.sig_update_settings)
def sig_update_settings(self, sender): def sig_update_settings(self, sender):
self.lb.walker._modified() self.lb.walker._modified()

View File

@ -122,6 +122,7 @@ class StatusBar(urwid.WidgetWrap):
self._w = urwid.Pile([self.ib, self.ab]) self._w = urwid.Pile([self.ib, self.ab])
signals.update_settings.connect(self.sig_update_settings) signals.update_settings.connect(self.sig_update_settings)
signals.flowlist_change.connect(self.sig_update_settings) signals.flowlist_change.connect(self.sig_update_settings)
master.options.changed.connect(self.sig_update_settings)
self.redraw() self.redraw()
def sig_update_settings(self, sender): def sig_update_settings(self, sender):

View File

@ -125,6 +125,7 @@ class Options(options.Options):
"wsingleuser", "wsingleuser",
"whtpasswd", "whtpasswd",
] ]
def process_web_options(self, parser): def process_web_options(self, parser):
if self.wsingleuser or self.whtpasswd: if self.wsingleuser or self.whtpasswd:
if self.wsingleuser: if self.wsingleuser: