mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Change console_order and console_order_reversed options
Change console_order and console_order_reversed to view_order and view_order_reversed, and move them to the view addon.
This commit is contained in:
parent
e533d02d98
commit
7bbd89b121
@ -145,6 +145,17 @@ class View(collections.Sequence):
|
||||
self.focus = Focus(self)
|
||||
self.settings = Settings(self)
|
||||
|
||||
def load(self, loader):
|
||||
loader.add_option(
|
||||
"view_order", str, "time",
|
||||
"Flow sort order.",
|
||||
choices=list(map(lambda c: c[1], orders)),
|
||||
)
|
||||
loader.add_option(
|
||||
"view_order_reversed", bool, False,
|
||||
"Reverse the sorting order."
|
||||
)
|
||||
|
||||
def store_count(self):
|
||||
return len(self._store)
|
||||
|
||||
@ -442,14 +453,14 @@ class View(collections.Sequence):
|
||||
"Invalid interception filter: %s" % ctx.options.view_filter
|
||||
)
|
||||
self.set_filter(filt)
|
||||
if "console_order" in updated:
|
||||
if ctx.options.console_order not in self.orders:
|
||||
if "view_order" in updated:
|
||||
if ctx.options.view_order not in self.orders:
|
||||
raise exceptions.OptionsError(
|
||||
"Unknown flow order: %s" % ctx.options.console_order
|
||||
"Unknown flow order: %s" % ctx.options.view_order
|
||||
)
|
||||
self.set_order(self.orders[ctx.options.console_order])
|
||||
if "console_order_reversed" in updated:
|
||||
self.set_reversed(ctx.options.console_order_reversed)
|
||||
self.set_order(self.orders[ctx.options.view_order])
|
||||
if "view_order_reversed" in updated:
|
||||
self.set_reversed(ctx.options.view_order_reversed)
|
||||
if "console_focus_follow" in updated:
|
||||
self.focus_follow = ctx.options.console_focus_follow
|
||||
|
||||
|
@ -107,15 +107,6 @@ class ConsoleAddon:
|
||||
"console_mouse", bool, True,
|
||||
"Console mouse interaction."
|
||||
)
|
||||
loader.add_option(
|
||||
"console_order", str, "time",
|
||||
"Flow sort order.",
|
||||
choices=view_orders,
|
||||
)
|
||||
loader.add_option(
|
||||
"console_order_reversed", bool, False,
|
||||
"Reverse the sorting order."
|
||||
)
|
||||
|
||||
@command.command("console.layout.options")
|
||||
def layout_options(self) -> typing.Sequence[str]:
|
||||
|
@ -199,10 +199,10 @@ class StatusBar(urwid.WidgetWrap):
|
||||
r.append("[")
|
||||
r.append(("heading_key", "M"))
|
||||
r.append(":%s]" % self.master.options.default_contentview)
|
||||
if self.master.options.has_changed("console_order"):
|
||||
if self.master.options.has_changed("view_order"):
|
||||
r.append("[")
|
||||
r.append(("heading_key", "o"))
|
||||
r.append(":%s]" % self.master.options.console_order)
|
||||
r.append(":%s]" % self.master.options.view_order)
|
||||
|
||||
opts = []
|
||||
if self.master.options.anticache:
|
||||
@ -244,7 +244,7 @@ class StatusBar(urwid.WidgetWrap):
|
||||
else:
|
||||
offset = self.master.view.focus.index + 1
|
||||
|
||||
if self.master.options.console_order_reversed:
|
||||
if self.master.options.view_order_reversed:
|
||||
arrow = common.SYMBOL_UP
|
||||
else:
|
||||
arrow = common.SYMBOL_DOWN
|
||||
|
Loading…
Reference in New Issue
Block a user