Skip to content

Commit 2062452

Browse files
committed
feat: separte config strip into sections
1 parent c69abfc commit 2062452

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

termtyper/ui/widgets/typing/config_strip.py

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from textual.widget import Widget
55
from termtyper.src import config_parser
66
from termtyper.ui.widgets.typing.space import Space
7+
from textual.widgets import Static
78

89

9-
class StripSetting(Widget):
10+
class StripSetting(Static):
1011
DEFAULT_CSS = """
1112
StripSetting {
1213
width: auto;
@@ -103,7 +104,7 @@ def refresh_setting(self) -> None:
103104
self.set_class(configured_mode == "time", "enabled")
104105

105106

106-
class ModeCount(Widget):
107+
class ModeCount(Static):
107108
DEFAULT_CSS = """
108109
ModeCount {
109110
width: auto;
@@ -165,6 +166,28 @@ def render(self) -> RenderableType:
165166
return ""
166167

167168

169+
class StripSection(Widget):
170+
DEFAULT_CSS = """
171+
StripSection {
172+
layout: horizontal;
173+
width: auto;
174+
height: 1;
175+
}
176+
"""
177+
178+
179+
class LeftStripSection(StripSection):
180+
...
181+
182+
183+
class MiddleStripSection(StripSection):
184+
...
185+
186+
187+
class RightStripSection(StripSection):
188+
...
189+
190+
168191
class TypingConfigStrip(Widget):
169192
DEFAULT_CSS = """
170193
TypingConfigStrip {
@@ -178,14 +201,21 @@ class TypingConfigStrip(Widget):
178201

179202
def compose(self) -> ComposeResult:
180203
yield Bracket("left")
181-
yield PunctuationSwitch()
182-
yield NumberSwitch()
204+
205+
with LeftStripSection():
206+
yield PunctuationSwitch()
207+
yield NumberSwitch()
208+
183209
yield StripSeparator()
184-
yield WordMode()
185-
yield TimeMode()
210+
211+
with MiddleStripSection():
212+
yield WordMode()
213+
yield TimeMode()
214+
186215
yield StripSeparator()
187216

188-
for i in [15, 30, 60, 120]:
189-
yield ModeCount(i)
217+
with RightStripSection():
218+
for i in [15, 30, 60, 120]:
219+
yield ModeCount(i)
190220

191221
yield Bracket("right")

0 commit comments

Comments
 (0)