mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
Merge pull request #3157 from gcmurphy/issue/3147
Adjust options when changed
This commit is contained in:
commit
8a76970944
@ -107,6 +107,7 @@ class OptManager:
|
||||
choices: typing.Optional[typing.Sequence[str]] = None
|
||||
) -> None:
|
||||
self._options[name] = _Option(name, typespec, default, help, choices)
|
||||
self.changed.send(self, updated={name})
|
||||
|
||||
@contextlib.contextmanager
|
||||
def rollback(self, updated, reraise=False):
|
||||
|
@ -106,6 +106,8 @@ class OptionListWalker(urwid.ListWalker):
|
||||
self.master.options.changed.connect(self.sig_mod)
|
||||
|
||||
def sig_mod(self, *args, **kwargs):
|
||||
self.opts = sorted(self.master.options.keys())
|
||||
self.maxlen = max(len(i) for i in self.opts)
|
||||
self._modified()
|
||||
self.set_focus(self.index)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user