mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Disable highlighting of primitives
This commit prevents rich from highlighting python-looking syntax like numbers, arrays, 'None' etc.
This commit is contained in:
parent
94d6a01cca
commit
e3ee4e515d
@ -3,6 +3,7 @@ from contextlib import asynccontextmanager, contextmanager
|
|||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import AsyncIterator, Iterator, List, Optional, Type
|
from typing import AsyncIterator, Iterator, List, Optional, Type
|
||||||
|
|
||||||
|
from rich.console import Console
|
||||||
from rich.progress import Progress, TaskID
|
from rich.progress import Progress, TaskID
|
||||||
|
|
||||||
|
|
||||||
@ -22,9 +23,11 @@ class TerminalConductor:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._stopped = False
|
self._stopped = False
|
||||||
self._lock = asyncio.Lock()
|
self._lock = asyncio.Lock()
|
||||||
self._progress = Progress()
|
|
||||||
self._lines: List[str] = []
|
self._lines: List[str] = []
|
||||||
|
|
||||||
|
self._console = Console(highlight=False)
|
||||||
|
self._progress = Progress(console=self._console)
|
||||||
|
|
||||||
async def _start(self) -> None:
|
async def _start(self) -> None:
|
||||||
for task in self._progress.tasks:
|
for task in self._progress.tasks:
|
||||||
task.visible = True
|
task.visible = True
|
||||||
@ -61,7 +64,7 @@ class TerminalConductor:
|
|||||||
if self._stopped:
|
if self._stopped:
|
||||||
self._lines.append(line)
|
self._lines.append(line)
|
||||||
else:
|
else:
|
||||||
self._progress.console.print(line)
|
self._console.print(line)
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def exclusive_output(self) -> AsyncIterator[None]:
|
async def exclusive_output(self) -> AsyncIterator[None]:
|
||||||
|
Loading…
Reference in New Issue
Block a user