MCPcopy
hub / github.com/Textualize/textual / compose

Method compose

examples/theme_sandbox.py:319–480  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

317 print(theme_name)
318
319 def compose(self) -> ComposeResult:
320 self.title = "Theme Sandbox"
321 with Grid(id="palette"):
322 theme = self.current_theme
323 for variable, value in vars(theme).items():
324 if variable not in {
325 "name",
326 "dark",
327 "luminosity_spread",
328 "text_alpha",
329 "variables",
330 }:
331 yield ColorSample(f"{variable}", classes=variable)
332 for color_name in [
333 "muted",
334 "primary",
335 "secondary",
336 "accent",
337 "warning",
338 "error",
339 "success",
340 ]:
341 yield ColorSample(
342 f"text-{color_name} on background",
343 classes=f"text-{color_name} background hover-surface",
344 )
345
346 for color_name in [
347 "primary",
348 "secondary",
349 "accent",
350 "warning",
351 "error",
352 "success",
353 ]:
354 yield ColorSample(
355 f"text-{color_name} on {color_name}-muted",
356 classes=f"text-{color_name} {color_name}-muted",
357 )
358
359 yield Header(show_clock=True, icon="🐟")
360 yield ThemeList(id="theme-list")
361 with VerticalScroll(id="widget-list", can_focus=False) as container:
362 yield Switch()
363 yield ToggleButton(label="Toggle Button")
364 yield SelectionList[int](
365 ("Falken's Maze", 0, True),
366 ("Black Jack", 1),
367 ("Gin Rummy", 2),
368 ("Hearts", 3),
369 ("Bridge", 4),
370 ("Checkers", 5),
371 ("Chess", 6, True),
372 ("Poker", 7),
373 ("Fighter Combat", 8, True),
374 )
375 yield RadioSet(
376 "Amanda",

Callers

nothing calls this directly

Calls 15

advanceMethod · 0.95
writeMethod · 0.95
GridClass · 0.90
HeaderClass · 0.90
VerticalScrollClass · 0.90
SwitchClass · 0.90
ToggleButtonClass · 0.90
RadioSetClass · 0.90
SelectClass · 0.90
CollapsibleClass · 0.90
LabelClass · 0.90
ProgressBarClass · 0.90

Tested by

no test coverage detected