Skip to content

Commit 42564c5

Browse files
authored
Merge pull request #26 from Textualize/style-update
styles
2 parents fbb0c9c + 3030835 commit 42564c5

File tree

5 files changed

+57
-37
lines changed

5 files changed

+57
-37
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "trogon"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "Automatically generate a Textual TUI for your Click CLI"
55
authors = ["Darren Burns <darrenb900@gmail.com>"]
66
readme = "README.md"

trogon/trogon.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ class CommandBuilder(Screen):
5151
key="ctrl+t", action="focus_command_tree", description="Focus Command Tree"
5252
),
5353
Binding(key="ctrl+o", action="show_command_info", description="Command Info"),
54-
Binding(key="f1", action="about", description="About Trogon"),
55-
Binding(
56-
key="ctrl+s",
57-
action="focus('search')",
58-
description="Search",
59-
),
54+
Binding(key="ctrl+s", action="focus('search')", description="Search"),
55+
Binding(key="f1", action="about", description="About"),
6056
]
6157

6258
def __init__(

trogon/trogon.scss

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
#home-body {
66
height: 100%;
7-
width: auto;
7+
width: 1fr;
88
}
99

1010
#home-body-scroll {
11-
height: 100%;
11+
width: 1fr;
12+
height: 1fr;
13+
1214
}
1315

1416
#home-exec-preview {
@@ -65,10 +67,9 @@
6567
height: 4;
6668
padding: 1 2;
6769
color: $text;
68-
background: $accent-lighten-2 5%;
70+
background: $accent-lighten-2 5%;
6971
}
7072

71-
7273
CommandBuilder .version-string {
7374
color: $text-muted;
7475
background: $background 50%;
@@ -128,13 +129,13 @@ CommandTree > .tree--guides-hover {
128129
}
129130

130131
ParameterControls {
131-
height: auto;
132+
height: auto;
132133
}
133134

134135
ControlGroup {
135136
height: auto;
136137
border: solid $panel-lighten-2;
137-
margin: 0 1;
138+
138139
}
139140

140141
ControlGroup.single-item {
@@ -160,10 +161,16 @@ Pretty {
160161
}
161162

162163
.add-another-button {
163-
margin: 0 2;
164-
padding: 0 1;
165-
height: 1;
166-
border: none;
164+
margin-right: 1;
165+
background: transparent;
166+
color: $success;
167+
border: none;
168+
background: $boost;
169+
height: 1;
170+
}
171+
172+
.add-another-button:hover {
173+
background: transparent;
167174
}
168175

169176
.add-another-button-container {
@@ -190,7 +197,7 @@ $command-info-header-bg: $primary-darken-1;
190197
dock: top;
191198
background: $command-info-header-bg;
192199
color: $text;
193-
height: auto;
200+
height: auto;
194201
}
195202

196203
.command-info-container {
@@ -236,7 +243,7 @@ Tabs:focus .underline--bar {
236243
}
237244

238245
Select.command-form-select {
239-
margin: 0 1 0 1;
246+
240247
}
241248

242249
Select.command-form-select SelectCurrent {
@@ -246,3 +253,16 @@ Select.command-form-select SelectCurrent {
246253
Select.command-form-select:focus SelectCurrent {
247254
border: tall $accent;
248255
}
256+
257+
.command-form-multiple-choice {
258+
margin-left: 0;
259+
border: tall transparent;
260+
background: $boost;
261+
padding: 0 1;
262+
margin-top: 0;
263+
}
264+
265+
.command-form-multiple-choice:focus-within {
266+
267+
border: tall $accent;
268+
}

trogon/widgets/form.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,21 @@ class CommandForm(Widget):
2929
"""Form which is constructed from an introspected Click app. Users
3030
make use of this form in order to construct CLI invocation strings."""
3131

32-
DEFAULT_CSS = """
32+
DEFAULT_CSS = """
3333
.command-form-heading {
34-
padding: 1 0 0 2;
34+
padding: 1 0 0 1;
3535
text-style: u;
36-
color: $text 70%;
36+
color: $text;
3737
}
38-
.command-form-input {
39-
margin: 0 1 0 1;
38+
.command-form-input {
4039
border: tall transparent;
4140
}
4241
.command-form-label {
43-
padding: 1 0 0 2;
44-
}
45-
46-
.command-form-multiple-choice {
47-
margin: 0 0 0 2;
42+
padding: 1 0 0 1;
4843
}
4944
.command-form-checkbox {
5045
background: $boost;
51-
margin: 1 0 0 1;
46+
margin: 1 0 0 0;
5247
padding-left: 1;
5348
border: tall transparent;
5449
}
@@ -59,7 +54,9 @@ class CommandForm(Widget):
5954
text-style: none;
6055
}
6156
.command-form-command-group {
57+
6258
margin: 1 2;
59+
padding: 0 1;
6360
height: auto;
6461
background: $foreground 3%;
6562
border: panel $background;
@@ -71,10 +68,11 @@ class CommandForm(Widget):
7168
.command-form-command-group:focus-within {
7269
border: panel $primary;
7370
}
74-
.command-form-control-help-text {
75-
margin: 0 0 0 2;
71+
.command-form-control-help-text {
7672
height: auto;
7773
color: $text 40%;
74+
padding-top: 0;
75+
padding-left: 1;
7876
}
7977
"""
8078

trogon/widgets/parameter_controls.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ def apply_filter(self, filter_query: str) -> bool:
8181
should_be_visible = name_contains_query
8282
else:
8383
# Option names are lists since they can have multiple names (e.g. -v and --verbose)
84-
name_contains_query = any(filter_query in name.casefold() for name in self.schema.name)
85-
help_contains_query = filter_query in getattr(self.schema, "help", "").casefold()
84+
name_contains_query = any(
85+
filter_query in name.casefold() for name in self.schema.name
86+
)
87+
help_contains_query = (
88+
filter_query in getattr(self.schema, "help", "").casefold()
89+
)
8690
should_be_visible = name_contains_query or help_contains_query
8791

8892
self.display = should_be_visible
@@ -92,7 +96,9 @@ def apply_filter(self, filter_query: str) -> bool:
9296
try:
9397
help_label = self.query_one(".command-form-control-help-text", Static)
9498
new_help_text = Text(help_text)
95-
new_help_text.highlight_words(filter_query.split(), "black on yellow", case_sensitive=False)
99+
new_help_text.highlight_words(
100+
filter_query.split(), "black on yellow", case_sensitive=False
101+
)
96102
help_label.update(new_help_text)
97103
except NoMatches:
98104
pass
@@ -183,7 +189,7 @@ def compose(self) -> ComposeResult:
183189
# button.
184190
if multiple or nargs == -1 and not isinstance(argument_type, click.Choice):
185191
with Horizontal(classes="add-another-button-container"):
186-
yield Button("+ value", variant="primary", classes="add-another-button")
192+
yield Button("+ value", variant="success", classes="add-another-button")
187193

188194
# Render the dim help text below the form controls
189195
if help_text:
@@ -269,7 +275,7 @@ def list_to_tuples(
269275
# Unspecified number of arguments as per Click docs.
270276
tuple_size = 1
271277
return [
272-
tuple(lst[i: i + tuple_size]) for i in range(0, len(lst), tuple_size)
278+
tuple(lst[i : i + tuple_size]) for i in range(0, len(lst), tuple_size)
273279
]
274280

275281
controls = list(self.query(f".{self.schema.key}"))

0 commit comments

Comments
 (0)