From 3bc8f17708f683ba0b6b297273f8b0051dbf9ebe Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 20 Nov 2022 14:26:02 +0000 Subject: [PATCH 1/3] fix twitter link --- docs/blog/posts/steal-this-code.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/posts/steal-this-code.md b/docs/blog/posts/steal-this-code.md index 2e2053d4a..124a54794 100644 --- a/docs/blog/posts/steal-this-code.md +++ b/docs/blog/posts/steal-this-code.md @@ -67,7 +67,7 @@ Here's a quick example of its use. It works like a dictionary until you reach a {'bar': 2, 'baz': 3, 'egg': 4} ``` -In Textual, we use a [LRUCache](https://github.com/Textualize/textual/search?q=LRUCache) to store the results of rendering content to the terminal. For example, in a [datatable](https://twitter.com/search?q=%23textualdatatable) it is too costly to render everything up front. So Textual renders only the lines that are currently visible on the "screen". The cache ensures that scrolling only needs to render the newly exposed lines, and lines that haven't been displayed in a while are discarded to save memory. +In Textual, we use a [LRUCache](https://github.com/Textualize/textual/search?q=LRUCache) to store the results of rendering content to the terminal. For example, in a [datatable](https://twitter.com/search?q=%23textualdatatable&src=typed_query&f=live) it is too costly to render everything up front. So Textual renders only the lines that are currently visible on the "screen". The cache ensures that scrolling only needs to render the newly exposed lines, and lines that haven't been displayed in a while are discarded to save memory. ## Color From 91927a4503353c4a8513f41cae8968b0c7130184 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 20 Nov 2022 15:49:22 +0000 Subject: [PATCH 2/3] bumped version --- CHANGELOG.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 185cbb530..cf2a8f542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ 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/). -## [0.5.0] - Unreleased +## [0.5.0] - 2022-11-20 ### Added diff --git a/pyproject.toml b/pyproject.toml index bf55b935b..56cdb4b80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.4.0" +version = "0.5.0" homepage = "https://github.com/Textualize/textual" description = "Modern Text User Interface framework" authors = ["Will McGugan "] From e7743d306921989661b81993161ef337bd921fb9 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 20 Nov 2022 16:38:07 +0000 Subject: [PATCH 3/3] fix for freeze issue --- src/textual/app.py | 4 ++-- src/textual/message_pump.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/textual/app.py b/src/textual/app.py index 0e22d3869..27fbc352a 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -2011,7 +2011,7 @@ class App(Generic[ReturnType], DOMNode): for children in reversed(node_children): # Closing children can be done asynchronously. close_messages = [ - child._close_messages() for child in children if child._running + child._close_messages(wait=True) for child in children if child._running ] # TODO: What if a message pump refuses to exit? if close_messages: @@ -2019,7 +2019,7 @@ class App(Generic[ReturnType], DOMNode): for child in children: self._unregister(child) - await root._close_messages() + await root._close_messages(wait=False) self._unregister(root) async def action_check_bindings(self, key: str) -> None: diff --git a/src/textual/message_pump.py b/src/textual/message_pump.py index 615ec0742..9d28f738b 100644 --- a/src/textual/message_pump.py +++ b/src/textual/message_pump.py @@ -284,7 +284,7 @@ class MessagePump(metaclass=MessagePumpMeta): async def _on_close_messages(self, message: messages.CloseMessages) -> None: await self._close_messages() - async def _close_messages(self) -> None: + async def _close_messages(self, wait: bool = True) -> None: """Close message queue, and optionally wait for queue to finish processing.""" if self._closed or self._closing: return @@ -296,7 +296,7 @@ class MessagePump(metaclass=MessagePumpMeta): await self._message_queue.put(events.Unmount(sender=self)) Reactive._reset_object(self) await self._message_queue.put(None) - if self._task is not None and asyncio.current_task() != self._task: + if wait and self._task is not None and asyncio.current_task() != self._task: # Ensure everything is closed before returning await self._task