Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle changes in Textual 0.48 #543

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/memray/reporters/tree.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Label {
padding: 1 3;
}

#frame-detail-grid Label {
color: $text;
height: auto;
width: 100%;
background: $panel-lighten-1;
}

#frame-detail-grid {
grid-size: 1 2;
grid-gutter: 1 2;
padding: 0 1;
border: thick $background 80%;
background: $surface;
}

#detailcol {
width: 40%;
max-width: 100;
}

TextArea {
scrollbar-size-vertical: 0;
border: none;
padding: 0;
}
31 changes: 2 additions & 29 deletions src/memray/reporters/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def compose(self) -> ComposeResult:
text.show_line_numbers = False
text.can_focus = False
text.cursor_blink = False
text.soft_wrap = False

labels: list[Label] = []
content_by_label_id = self._get_content_by_label_id()
Expand Down Expand Up @@ -230,35 +231,7 @@ class TreeApp(App[None]):
),
]

DEFAULT_CSS = """
Label {
padding: 1 3;
}

#frame-detail-grid Label {
color: $text;
height: auto;
width: 100%;
background: $panel-lighten-1;
}

#frame-detail-grid {
grid-size: 1 2;
grid-gutter: 1 2;
padding: 0 1;
border: thick $background 80%;
background: $surface;
}

#detailcol {
width: 40%;
max-width: 100;
}

TextArea {
scrollbar-size-vertical: 0;
}
"""
CSS_PATH = "tree.css"

def __init__(
self,
Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import socket
import sys

import pytest

Expand All @@ -10,3 +11,12 @@ def free_port():
port_number = s.getsockname()[1]
s.close()
return port_number


def pytest_configure(config):
# Several of the tree reporter tests require Textual 0.48, which does not
# support Python 3.7, but skipping those tests causes the test suite to
# fail due to unused snapshots. Override the configuration for Python 3.7
# so that unused snapshots are a warning, not an error.
if sys.version_info < (3, 8):
config.option.warn_unused_snapshots = True
Loading
Loading