Skip to content

Commit 7451a4d

Browse files
committed
more projects
1 parent e366556 commit 7451a4d

File tree

4 files changed

+100
-14
lines changed

4 files changed

+100
-14
lines changed

src/textual/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ class App(Generic[ReturnType], DOMNode):
371371
overflow-y: auto !important;
372372
align: center middle;
373373
.-maximized {
374-
dock: initial !important;
375-
margin: 2 4;
374+
dock: initial !important;
376375
}
377376
}
378377
/* Fade the header title when app is blurred */

src/textual/demo2/projects.py

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,101 @@
1111
@dataclass
1212
class ProjectInfo:
1313
title: str
14+
author: str
1415
url: str
1516
description: str
17+
stars: str
1618

1719

1820
PROJECTS = [
1921
ProjectInfo(
2022
"Posting",
23+
"Darren Burns",
2124
"https://posting.sh/",
22-
"Posting is a beautiful open-source terminal app for developing and testing APIs.",
23-
)
24-
] * 5
25+
"""A powerful HTTP client that lives in your terminal.
26+
27+
Posting is an HTTP client, not unlike Postman and Insomnia. As a TUI application, it can be used over SSH and enables efficient keyboard-centric workflows. """,
28+
"4.7k",
29+
),
30+
ProjectInfo(
31+
"Memray",
32+
"Bloomberg",
33+
"https://github.com/bloomberg/memray",
34+
"""Memray is a memory profiler for Python. It can track memory allocations in Python code, in native extension modules, and in the Python interpreter itself. It can generate several different types of reports to help you analyze the captured memory usage data.""",
35+
"13.2k",
36+
),
37+
ProjectInfo(
38+
"Toolong",
39+
"Will McGugan",
40+
"https://github.com/Textualize/toolong",
41+
"""A terminal application to view, tail, merge, and search log files (plus JSONL).""",
42+
"3.1k",
43+
),
44+
ProjectInfo(
45+
"Dolphie",
46+
"Charles Thompson",
47+
"https://github.com/charles-001/dolphie",
48+
"Your single pane of glass for real-time analytics into MySQL/MariaDB & ProxySQL",
49+
"608",
50+
),
51+
ProjectInfo(
52+
"Harlequin",
53+
"Ted Conbeer",
54+
"https://harlequin.sh/",
55+
"""Portable, powerful, colorful.
56+
An easy, fast, and beautiful database client for the terminal.""",
57+
"3.7k",
58+
),
59+
ProjectInfo(
60+
"Elia",
61+
"Darren Burns",
62+
"https://github.com/darrenburns/elia",
63+
"""A snappy, keyboard-centric terminal user interface for interacting with large language models.
64+
Chat with Claude 3, ChatGPT, and local models like Llama 3, Phi 3, Mistral and Gemma.""",
65+
"1.8k",
66+
),
67+
ProjectInfo(
68+
"Trogon",
69+
"Textualize",
70+
"https://github.com/Textualize/trogon",
71+
"""Auto-generate friendly terminal user interfaces for command line apps.
72+
73+
Trogon works with the popular Click library for Python, but will support other libraries and languages in the future.""",
74+
"2.5k",
75+
),
76+
ProjectInfo(
77+
"TFTUI - The Terraform textual UI",
78+
"Ido Avraham",
79+
"https://github.com/idoavrah/terraform-tui",
80+
"TFTUI is a powerful textual UI that empowers users to effortlessly view and interact with their Terraform state.",
81+
"1k",
82+
),
83+
ProjectInfo(
84+
"RecoverPy",
85+
"Pablo Lecolinet",
86+
"https://github.com/PabloLec/RecoverPy",
87+
"""RecoverPy is a powerful tool that leverages your system capabilities to recover lost files.
88+
89+
Unlike others, you can not only recover deleted files but also overwritten data.""",
90+
"1.3k",
91+
),
92+
ProjectInfo(
93+
"Frogmouth",
94+
"Dave Pearson",
95+
"https://github.com/Textualize/frogmouth",
96+
"""Frogmouth is a Markdown viewer / browser for your terminal, built with Textual.
97+
98+
Frogmouth can open *.md files locally or via a URL. There is a familiar browser-like navigation stack, history, bookmarks, and table of contents.""",
99+
"2.5k",
100+
),
101+
ProjectInfo(
102+
"oterm",
103+
"Yiorgis Gozadinos",
104+
"https://github.com/ggozad/oterm",
105+
"The text-based terminal client for Ollama.",
106+
"1k",
107+
),
108+
]
25109

26110

27111
class Link(Label):
@@ -53,13 +137,15 @@ class Project(Vertical, can_focus=True):
53137
padding: 0 1;
54138
border: tall transparent;
55139
opacity: 0.8;
140+
box-sizing: border-box;
56141
57142
&:focus-within {
58143
border: tall $accent;
59144
background: $primary 40%;
60145
opacity: 1.0;
61146
}
62147
#title { text-style: bold; }
148+
#author { text-style: italic; }
63149
.stars {
64150
color: $secondary;
65151
text-align: right;
@@ -92,7 +178,8 @@ def __init__(self, project_info: ProjectInfo) -> None:
92178
def compose(self) -> ComposeResult:
93179
with Horizontal(classes="header"):
94180
yield Label(self.project_info.title, id="title")
95-
yield Label("★ 23K", classes="stars")
181+
yield Label(f"★ {self.project_info.stars}", classes="stars")
182+
yield Label(self.project_info.author, id="author")
96183
yield Link(self.project_info.url)
97184
yield Static(self.project_info.description, classes="description")
98185

@@ -110,15 +197,16 @@ class ProjectsScreen(PageScreen):
110197
DEFAULT_CSS = """
111198
ProjectsScreen {
112199
113-
margin: 1;
200+
# margin: 1;
114201
Grid {
115202
margin: 1 2;
116203
padding: 1 2;
117204
background: $boost;
118205
width: 1fr;
119206
height: auto;
120-
grid-size: 2;
207+
# grid-size: 2;
121208
grid-gutter: 1 1;
209+
grid-rows: auto;
122210
hatch: right $accent 80%;
123211
keyline:heavy $secondary;
124212

src/textual/layouts/grid.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def arrange(
4141
(container_width + gutter_horizontal)
4242
// (min_column_width + gutter_horizontal),
4343
)
44+
table_size_columns = min(table_size_columns, len(children))
4445

45-
table_size_columns = min(table_size_columns, len(children))
4646
table_size_rows = styles.grid_size_rows
4747
viewport = parent.screen.size
4848
keyline_style, _keyline_color = styles.keyline
@@ -272,8 +272,10 @@ def apply_height_limits(widget: Widget, height: int) -> int:
272272
Fraction(cell_size.width),
273273
Fraction(cell_size.height),
274274
)
275-
if column_span == 1 and row_span == 1:
276-
height = cell_height
275+
if len(children) > 1:
276+
height = (
277+
height if height > cell_size.height else Fraction(cell_size.height)
278+
)
277279
region = (
278280
Region(x, y, int(width + margin.width), int(height + margin.height))
279281
.crop_size(cell_size)

src/textual/widget.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,9 +3364,6 @@ def post_render(self, renderable: RenderableType) -> ConsoleRenderable:
33643364

33653365
def watch_mouse_hover(self, value: bool) -> None:
33663366
"""Update from CSS if mouse over state changes."""
3367-
for node in self.ancestors_with_self:
3368-
if isinstance(node, Widget):
3369-
node.mouse_hover_within = value
33703367
if self._has_hover_style:
33713368
self._update_styles()
33723369

0 commit comments

Comments
 (0)