forked from mitmproxy/mitmproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mitmproxy#2742 from mhils/dataviewer-fix-edit
Dataviewer: disable (broken) edit
- Loading branch information
Showing
4 changed files
with
52 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
A display-only column that displays any data type. | ||
""" | ||
|
||
import typing | ||
|
||
import urwid | ||
from mitmproxy.tools.console.grideditor import base | ||
from mitmproxy.utils import strutils | ||
|
||
|
||
class Column(base.Column): | ||
def Display(self, data): | ||
return Display(data) | ||
|
||
Edit = Display | ||
|
||
def blank(self): | ||
return "" | ||
|
||
|
||
class Display(base.Cell): | ||
def __init__(self, data: typing.Any) -> None: | ||
self.data = data | ||
if isinstance(data, bytes): | ||
data = strutils.bytes_to_escaped_str(data) | ||
if not isinstance(data, str): | ||
data = repr(data) | ||
w = urwid.Text(data, wrap="any") | ||
super().__init__(w) | ||
|
||
def get_data(self) -> typing.Any: | ||
return self.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters