Skip to content

Commit 7f55375

Browse files
authored
✨ upgrade textual
1 parent 20932cf commit 7f55375

File tree

6 files changed

+90
-19
lines changed

6 files changed

+90
-19
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ works on local and remote file systems.
2020

2121
<body>
2222
<div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
23-
<img src="docs/_static/screenshot_utils.png" alt="Image 1">
24-
<img src="docs/_static/screenshot_datatable.png" alt="Image 2">
25-
<img src="docs/_static/screenshot_mona_lisa.png" alt="Image 3">
26-
<img src="docs/_static/screenshot_markdown.png" alt="Image 4">
23+
<picture>
24+
<img src="docs/_static/screenshot_utils.png" alt="Image 1" href="">
25+
</picture>
26+
<picture>
27+
<img src="docs/_static/screenshot_datatable.png" alt="Image 2" href="">
28+
</picture>
29+
<picture>
30+
<img src="docs/_static/screenshot_mona_lisa.png" alt="Image 3" href="">
31+
</picture>
32+
<picture>
33+
<img src="docs/_static/screenshot_markdown.png" alt="Image 4" href="">
34+
</picture>
2735
</div>
2836
</body>
2937

@@ -62,6 +70,8 @@ with a file browser. You can also give it a URL to a remote file system, like AW
6270
browsr s3://my-bucket/my-file.parquet
6371
```
6472

73+
### [Check out the Documentation](https://juftin.com/browsr/) for more
74+
6575
## License
6676

6777
**`browsr`** is distributed under the terms of the [MIT license](LICENSE).

browsr/_base.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class UniversalDirectoryTree(DirectoryTree):
136136
A Universal DirectoryTree supporting different filesystems
137137
"""
138138

139-
def load_directory(self, node: TreeNode[DirEntry]) -> None:
139+
def _load_directory(self, node: TreeNode[DirEntry]) -> None:
140140
"""
141141
Load Directory Using Universal Pathlib
142142
"""
@@ -156,11 +156,24 @@ def load_directory(self, node: TreeNode[DirEntry]) -> None:
156156
path_name = str(path).replace("s3://", "").rstrip("/")
157157
node.add(
158158
path_name,
159-
data=DirEntry(str(path), path.is_dir()),
159+
data=DirEntry(path),
160160
allow_expand=path.is_dir(),
161161
)
162162
node.expand()
163163

164+
def reload(self) -> None:
165+
"""
166+
Reload the `DirectoryTree` contents.
167+
"""
168+
self.reset(str(self.path), DirEntry(UPath(self.path)))
169+
self._load_directory(self.root)
170+
171+
def validate_path(self, path: Union[str, UPath]) -> UPath: # type: ignore[override]
172+
"""
173+
Ensure that the path is of the `UPath` type.
174+
"""
175+
return UPath(path)
176+
164177
def _handle_top_level_bucket(self, dir_path: UPath) -> Optional[Iterable[UPath]]:
165178
"""
166179
Handle scenarios when someone wants to browse all of s3

docs/index.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,61 @@
1616
It's a simple way to browse your files and take a peek at their contents. Plus it
1717
works on local and remote file systems.
1818

19+
<style>
20+
.grid-item {
21+
transition: all 0.5s ease;
22+
}
23+
24+
.grid-item:hover {
25+
transform: scale(1.2);
26+
}
27+
28+
.expanded {
29+
position: fixed;
30+
top: 0;
31+
left: 0;
32+
width: 100%;
33+
height: 100%;
34+
background-color: rgba(0, 0, 0, 0.9);
35+
display: flex;
36+
align-items: center;
37+
justify-content: center;
38+
z-index: 9999;
39+
}
40+
41+
.expanded img {
42+
max-width: 80%;
43+
max-height: 80%;
44+
object-fit: contain;
45+
}
46+
</style>
47+
1948
<body>
20-
<div style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
21-
<img src="_static/screenshot_utils.png" alt="Image 1">
22-
<img src="_static/screenshot_datatable.png" alt="Image 2">
23-
<img src="_static/screenshot_mona_lisa.png" alt="Image 3">
24-
<img src="_static/screenshot_markdown.png" alt="Image 4">
25-
</div>
49+
<div class="grid" style="display: grid; grid-template-columns: repeat(2, 1fr); grid-gap: 10px;">
50+
<div class="grid-item">
51+
<img src="_static/screenshot_utils.png" alt="Image 1">
52+
</div>
53+
<div class="grid-item">
54+
<img src="_static/screenshot_datatable.png" alt="Image 2">
55+
</div>
56+
<div class="grid-item">
57+
<img src="_static/screenshot_mona_lisa.png" alt="Image 3">
58+
</div>
59+
<div class="grid-item">
60+
<img src="_static/screenshot_markdown.png" alt="Image 4">
61+
</div>
62+
</div>
63+
64+
<div class="expanded" style="display: none;">
65+
<img src="">
66+
</div>
67+
68+
<script>
69+
var expanded = document.querySelector('.expanded');
70+
expanded.onclick = function() {
71+
this.style.display = 'none';
72+
};
73+
</script>
2674
</body>
2775

2876
## Installation

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies = [
2121
"rich~=13.3.5",
2222
"rich-click~=1.5.2",
2323
"rich-pixels~=2.1.1",
24-
"textual~=0.22.3",
24+
"textual~=0.24.1",
2525
"universal-pathlib~=0.0.21",
2626
"Pillow>=9.1.0",
2727
"PyMuPDF~=1.22.3"

requirements/requirements-dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,9 +1451,9 @@ six==1.16.0 \
14511451
# google-auth
14521452
# isodate
14531453
# python-dateutil
1454-
textual==0.22.3 \
1455-
--hash=sha256:1ef6457b9d8b727a67d2344bf2d0b530dce1afab55e1bf4e964e430929301baa \
1456-
--hash=sha256:a68172f7797e9f269270491e039f1e48096530dff64dbfe893e8477f2d4e200c
1454+
textual==0.24.1 \
1455+
--hash=sha256:4c7e1f4ed12b9615c63fa3eb7cb9df68d29e0ae5b2352997958cd7ee5533f926 \
1456+
--hash=sha256:a7deb7ac5a1502424c754fe165ae13cb3890e47ddc514d3f089cb2984c336d1d
14571457
# via -r requirements.in
14581458
tomli==2.0.1 \
14591459
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \

requirements/requirements-prod.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,9 @@ six==1.16.0 \
965965
# google-auth
966966
# isodate
967967
# python-dateutil
968-
textual==0.22.3 \
969-
--hash=sha256:1ef6457b9d8b727a67d2344bf2d0b530dce1afab55e1bf4e964e430929301baa \
970-
--hash=sha256:a68172f7797e9f269270491e039f1e48096530dff64dbfe893e8477f2d4e200c
968+
textual==0.24.1 \
969+
--hash=sha256:4c7e1f4ed12b9615c63fa3eb7cb9df68d29e0ae5b2352997958cd7ee5533f926 \
970+
--hash=sha256:a7deb7ac5a1502424c754fe165ae13cb3890e47ddc514d3f089cb2984c336d1d
971971
# via -r requirements.in
972972
typing-extensions==4.5.0 \
973973
--hash=sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb \

0 commit comments

Comments
 (0)