diff --git a/CHANGELOG.md b/CHANGELOG.md index 575952148..8feba707c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.1.15] - Unreleased + +### Added + +- Added Windows Driver + ## [1.1.14] - 2022-01-09 ### Changed diff --git a/examples/animation.py b/examples/animation.py index 2578834c2..bf5f9ae8e 100644 --- a/examples/animation.py +++ b/examples/animation.py @@ -32,7 +32,7 @@ class SmoothApp(App): 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) diff --git a/src/textual/app.py b/src/textual/app.py index c664f9ff0..4c6f58873 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -2,7 +2,6 @@ from __future__ import annotations import os import asyncio -from functools import partial import platform from typing import Any, Callable, ClassVar, Type, TypeVar import warnings @@ -31,6 +30,8 @@ from .view import View from .views import DockView from .widget import Widget, Reactive +PLATFORM = platform.system() +WINDOWS = PLATFORM == "Windows" # asyncio will warn against resources not being cleared warnings.simplefilter("always", ResourceWarning) @@ -118,7 +119,7 @@ class App(MessagePump): Returns: Driver: A Driver class which manages input and display. """ - if platform.system() == "Windows": + if WINDOWS: from .drivers.windows_driver import WindowsDriver driver_class = WindowsDriver @@ -302,6 +303,7 @@ class App(MessagePump): self.console.print_exception() else: try: + self.console = Console() self.title = self._title self.refresh() await self.animator.start() @@ -344,7 +346,9 @@ class App(MessagePump): await self.close_messages() 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: console = self.console try: diff --git a/src/textual/drivers/win32.py b/src/textual/drivers/win32.py index 3455b31bb..55ca6cfe2 100644 --- a/src/textual/drivers/win32.py +++ b/src/textual/drivers/win32.py @@ -1,5 +1,4 @@ from asyncio import AbstractEventLoop, run_coroutine_threadsafe -from codecs import getincrementaldecoder import ctypes from ctypes import byref, Structure, Union, wintypes @@ -9,11 +8,10 @@ import os import sys import threading -from tkinter.tix import WINDOW from typing import IO, Callable, List, Optional from ..geometry import Size -from ..events import Event, Key, Resize +from ..events import Event, Resize from .._types import EventTarget from .._xterm_parser import XTermParser