Test line-wide attributes
This commit is contained in:
parent
ce73a7d3bf
commit
0a104afd4a
1 changed files with 19 additions and 4 deletions
|
|
@ -7,10 +7,13 @@ from cheuph import AT, AttributedLines, AttributedLinesWidget
|
||||||
|
|
||||||
class TestWidget(urwid.WidgetWrap):
|
class TestWidget(urwid.WidgetWrap):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
long_line = AT("super", style="red")
|
||||||
|
long_line += AT(" long", style="cyan")
|
||||||
|
long_line += AT(" line", style="magenta")
|
||||||
lines = [
|
lines = [
|
||||||
({}, AT("a")),
|
({}, AT("abc", style="green")),
|
||||||
({}, AT("Hello world")),
|
({"style": "blue"}, AT("Hello world")),
|
||||||
({}, AT("super long line " * 20)),
|
({}, AT(" ").join([long_line] * 10)),
|
||||||
]
|
]
|
||||||
self.lines = AttributedLinesWidget(AttributedLines(lines))
|
self.lines = AttributedLinesWidget(AttributedLines(lines))
|
||||||
super().__init__(self.lines)
|
super().__init__(self.lines)
|
||||||
|
|
@ -32,7 +35,19 @@ class TestWidget(urwid.WidgetWrap):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
screen = urwid.curses_display.Screen()
|
screen = urwid.curses_display.Screen()
|
||||||
loop = urwid.MainLoop(TestWidget(), screen=screen)
|
palette = [
|
||||||
|
("red", "light red", ""),
|
||||||
|
("yellow", "yellow", ""),
|
||||||
|
("green", "light green", ""),
|
||||||
|
("blue", "light blue", ""),
|
||||||
|
("magenta", "light magenta", ""),
|
||||||
|
("cyan", "light cyan", ""),
|
||||||
|
]
|
||||||
|
loop = urwid.MainLoop(
|
||||||
|
TestWidget(),
|
||||||
|
screen=screen,
|
||||||
|
palette=palette,
|
||||||
|
)
|
||||||
loop.run()
|
loop.run()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue