sync: добавил файл реализации tui
This commit is contained in:
35
src/dbg_tui.py
Normal file
35
src/dbg_tui.py
Normal file
@ -0,0 +1,35 @@
|
||||
from dpdebugger import Debugger
|
||||
from dataclasses import dataclass
|
||||
from rich import print as rprint
|
||||
from rich.layout import Layout
|
||||
from rich.live import Live
|
||||
|
||||
@dataclass
|
||||
class SourceLines:
|
||||
active: int
|
||||
begining_number: int
|
||||
lines: list[str]
|
||||
|
||||
def _get_source_lines(
|
||||
srcline: int,
|
||||
lines: list[str],
|
||||
max_height: int
|
||||
) -> SourceLines:
|
||||
"""
|
||||
Собирает выборку из строк исходного кода так, чтобы она
|
||||
подходила по количесту строчек
|
||||
"""
|
||||
start = max(srcline - max_height//2, 1) + 1
|
||||
upper_length = srcline - start
|
||||
end =
|
||||
|
||||
|
||||
|
||||
def main(debugger: Debugger, srcfile: str):
|
||||
layout = Layout()
|
||||
layout.split_column(
|
||||
Layout(name="source"),
|
||||
Layout(name="terminal")
|
||||
)
|
||||
rprint(layout)
|
||||
|
||||
Reference in New Issue
Block a user