Skip to content

Commit a4dabb7

Browse files
committed
line segment with info to the left of the bar
1 parent a355fce commit a4dabb7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

leetcode/models/styles.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
ALERT = Style(color='red', bold=True)
3030

3131
class LeetTable(Table):
32-
def __init__(self, *args, **kwargs):
32+
def __init__(self, *args, width=100,**kwargs):
3333
super().__init__(*args, **kwargs)
3434
self.box = rich.box.ROUNDED
3535
self.header_style = Style(color='blue', bold=True)
36-
self.width = 100
36+
self.width = width
3737

3838
self.difficulty_column_index = None
3939
self.status_column_index = None
@@ -66,13 +66,14 @@ def __init__(
6666
self,
6767
end: float,
6868
*,
69+
info: str = None,
6970
size: float = 50,
7071
begin: float = 0,
7172
width: Optional[int] = 50,
7273
color: Union[Color, str] = "default",
7374
bgcolor: Union[Color, str] = "default"):
7475
super().__init__(size, begin, end, width=width, color=color, bgcolor=bgcolor)
75-
76+
self.info = info
7677

7778
def __rich_console__(self, console, options):
7879
width = min(
@@ -107,6 +108,8 @@ def __rich_console__(self, console, options):
107108

108109
suffix = self.BACKGROUND_BLOCK * (width - len(body))
109110

111+
if self.info is not None:
112+
yield self.info + ' '
110113
yield Segment(prefix + body[len(prefix):] + suffix, self.style)
111114
yield Segment.line()
112115

@@ -133,4 +136,6 @@ def __rich_console__(self, console, options):
133136

134137
columns = Columns([runtime_panel, memory_panel])
135138
yield columns
136-
139+
140+
# class statsContainer():
141+
# def __init__()

0 commit comments

Comments
 (0)