mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
re-construct console
This commit is contained in:
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [1.1.15] - Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added Windows Driver
|
||||||
|
|
||||||
## [1.1.14] - 2022-01-09
|
## [1.1.14] - 2022-01-09
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SmoothApp(App):
|
|||||||
|
|
||||||
self.bar.layout_offset_x = -40
|
self.bar.layout_offset_x = -40
|
||||||
|
|
||||||
self.set_timer(10, lambda: self.action("quit"))
|
# self.set_timer(10, lambda: self.action("quit"))
|
||||||
|
|
||||||
|
|
||||||
SmoothApp.run(log="textual.log", log_verbosity=2)
|
SmoothApp.run(log="textual.log", log_verbosity=2)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from functools import partial
|
|
||||||
import platform
|
import platform
|
||||||
from typing import Any, Callable, ClassVar, Type, TypeVar
|
from typing import Any, Callable, ClassVar, Type, TypeVar
|
||||||
import warnings
|
import warnings
|
||||||
@@ -31,6 +30,8 @@ from .view import View
|
|||||||
from .views import DockView
|
from .views import DockView
|
||||||
from .widget import Widget, Reactive
|
from .widget import Widget, Reactive
|
||||||
|
|
||||||
|
PLATFORM = platform.system()
|
||||||
|
WINDOWS = PLATFORM == "Windows"
|
||||||
|
|
||||||
# asyncio will warn against resources not being cleared
|
# asyncio will warn against resources not being cleared
|
||||||
warnings.simplefilter("always", ResourceWarning)
|
warnings.simplefilter("always", ResourceWarning)
|
||||||
@@ -118,7 +119,7 @@ class App(MessagePump):
|
|||||||
Returns:
|
Returns:
|
||||||
Driver: A Driver class which manages input and display.
|
Driver: A Driver class which manages input and display.
|
||||||
"""
|
"""
|
||||||
if platform.system() == "Windows":
|
if WINDOWS:
|
||||||
from .drivers.windows_driver import WindowsDriver
|
from .drivers.windows_driver import WindowsDriver
|
||||||
|
|
||||||
driver_class = WindowsDriver
|
driver_class = WindowsDriver
|
||||||
@@ -302,6 +303,7 @@ class App(MessagePump):
|
|||||||
self.console.print_exception()
|
self.console.print_exception()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
self.console = Console()
|
||||||
self.title = self._title
|
self.title = self._title
|
||||||
self.refresh()
|
self.refresh()
|
||||||
await self.animator.start()
|
await self.animator.start()
|
||||||
@@ -344,7 +346,9 @@ class App(MessagePump):
|
|||||||
await self.close_messages()
|
await self.close_messages()
|
||||||
|
|
||||||
def refresh(self, repaint: bool = True, layout: bool = False) -> None:
|
def refresh(self, repaint: bool = True, layout: bool = False) -> None:
|
||||||
sync_available = os.environ.get("TERM_PROGRAM", "") != "Apple_Terminal"
|
sync_available = (
|
||||||
|
os.environ.get("TERM_PROGRAM", "") != "Apple_Terminal" and not WINDOWS
|
||||||
|
)
|
||||||
if not self._closed:
|
if not self._closed:
|
||||||
console = self.console
|
console = self.console
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from asyncio import AbstractEventLoop, run_coroutine_threadsafe
|
from asyncio import AbstractEventLoop, run_coroutine_threadsafe
|
||||||
from codecs import getincrementaldecoder
|
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes import byref, Structure, Union, wintypes
|
from ctypes import byref, Structure, Union, wintypes
|
||||||
@@ -9,11 +8,10 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from tkinter.tix import WINDOW
|
|
||||||
from typing import IO, Callable, List, Optional
|
from typing import IO, Callable, List, Optional
|
||||||
|
|
||||||
from ..geometry import Size
|
from ..geometry import Size
|
||||||
from ..events import Event, Key, Resize
|
from ..events import Event, Resize
|
||||||
from .._types import EventTarget
|
from .._types import EventTarget
|
||||||
from .._xterm_parser import XTermParser
|
from .._xterm_parser import XTermParser
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user