From 7e83acb966d16e4951c9f16479866d60b84a863e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:14:12 +0000 Subject: [PATCH 01/11] Add regression test for #1814. --- tests/test_message_handling.py | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/test_message_handling.py diff --git a/tests/test_message_handling.py b/tests/test_message_handling.py new file mode 100644 index 000000000..31edeb2cf --- /dev/null +++ b/tests/test_message_handling.py @@ -0,0 +1,45 @@ +from textual.app import App, ComposeResult +from textual.message import Message +from textual.widget import Widget + + +async def test_message_inheritance_namespace(): + """Inherited messages get their correct namespaces. + + Regression test for https://github.com/Textualize/textual/issues/1814. + """ + + class BaseWidget(Widget): + class Fired(Message): + pass + + def trigger(self) -> None: + self.post_message(self.Fired()) + + class Left(BaseWidget): + class Fired(BaseWidget.Fired): + pass + + class Right(BaseWidget): + class Fired(BaseWidget.Fired): + pass + + handlers_called = [] + + class MessageInheritanceApp(App[None]): + def compose(self) -> ComposeResult: + yield Left() + yield Right() + + def on_left_fired(self): + handlers_called.append("left") + + def on_right_fired(self): + handlers_called.append("right") + + app = MessageInheritanceApp() + async with app.run_test(): + app.query_one(Left).trigger() + app.query_one(Right).trigger() + + assert handlers_called == ["left", "right"] From b00b4fb0600ac97157863b0f195d92cb78a5441c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:17:16 +0000 Subject: [PATCH 02/11] Fix #1814. --- CHANGELOG.md | 1 + src/textual/message_pump.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3e1b7eae..41a47a1f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `Pilot.click` not correctly creating the mouse events https://github.com/Textualize/textual/issues/2022 - Fixes issue where the horizontal scrollbar would be incorrectly enabled https://github.com/Textualize/textual/pull/2024 - Fixes for tracebacks not appearing on exit https://github.com/Textualize/textual/issues/2027 +- Fixed how the namespace for messages is calculated to facilitate inheriting messages https://github.com/Textualize/textual/issues/1814 ### Added diff --git a/src/textual/message_pump.py b/src/textual/message_pump.py index 3a1ac9eb2..0ce2b981b 100644 --- a/src/textual/message_pump.py +++ b/src/textual/message_pump.py @@ -62,7 +62,7 @@ class MessagePumpMeta(type): isclass = inspect.isclass for value in class_dict.values(): if isclass(value) and issubclass(value, Message): - if not value.namespace: + if "namespace" not in value.__dict__: value.namespace = namespace class_obj = super().__new__(cls, name, bases, class_dict, **kwargs) return class_obj From dd49a723ee338243680c38f7070868e4e619897d Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 13 Mar 2023 15:31:29 +0000 Subject: [PATCH 03/11] Simplify the disabled snapshot test Initially this was "throw most if not all widgets at the display and disable everything" test; but in #2028 it was requested that this be simplified, just using the same widget, in enabled and disabled states. Button seems like a good choice here. To ensure that things work as intended, I'm going with the approach of disabling via a container as that's one big change that the disabled facility brought in. --- .../snapshot_apps/disable_widgets.py | 85 ++++--------------- 1 file changed, 17 insertions(+), 68 deletions(-) diff --git a/tests/snapshot_tests/snapshot_apps/disable_widgets.py b/tests/snapshot_tests/snapshot_apps/disable_widgets.py index 8965fbdac..6677fa5de 100644 --- a/tests/snapshot_tests/snapshot_apps/disable_widgets.py +++ b/tests/snapshot_tests/snapshot_apps/disable_widgets.py @@ -1,83 +1,32 @@ from textual.app import App, ComposeResult -from textual.containers import Vertical, Horizontal -from textual.widgets import ( - Header, - Footer, - Button, - DataTable, - Input, - ListView, - ListItem, - Label, - Markdown, - MarkdownViewer, - Tree, - TextLog, -) - +from textual.containers import Horizontal +from textual.widgets import Button class WidgetDisableTestApp(App[None]): CSS = """ Horizontal { height: auto; } - DataTable, ListView, Tree, TextLog { - height: 2; - } - Markdown, MarkdownViewer { - height: 1fr; + Button { + width: 1fr; } """ - @property - def data_table(self) -> DataTable: - data_table = DataTable[str]() - data_table.add_columns("Column 1", "Column 2", "Column 3", "Column 4") - data_table.add_rows( - [(str(n), str(n * 10), str(n * 100), str(n * 1000)) for n in range(100)] - ) - return data_table - - @property - def list_view(self) -> ListView: - return ListView(*[ListItem(Label(f"This is list item {n}")) for n in range(20)]) - - @property - def test_tree(self) -> Tree: - tree = Tree[None](label="This is a test tree") - for n in range(10): - tree.root.add_leaf(f"Leaf {n}") - tree.root.expand() - return tree - def compose(self) -> ComposeResult: - yield Header() - yield Vertical( - Horizontal( - Button(), - Button(variant="primary"), - Button(variant="success"), - Button(variant="warning"), - Button(variant="error"), - ), - self.data_table, - self.list_view, - self.test_tree, - TextLog(), - Input(), - Input(placeholder="This is an empty input with a placeholder"), - Input("This is some text in an input"), - Markdown("# Hello, World!"), - MarkdownViewer("# Hello, World!"), - id="test-container", - ) - yield Footer() - - def on_mount(self) -> None: - self.query_one(TextLog).write("Hello, World!") - self.query_one("#test-container", Vertical).disabled = True - + for _ in range(4): + with Horizontal(): + yield Button() + yield Button(variant="primary") + yield Button(variant="success") + yield Button(variant="warning") + yield Button(variant="error") + with Horizontal(disabled=True): + yield Button() + yield Button(variant="primary") + yield Button(variant="success") + yield Button(variant="warning") + yield Button(variant="error") if __name__ == "__main__": WidgetDisableTestApp().run() From cf62a4a76a7e85c6cb3b157d52a8070047ef74ef Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 13 Mar 2023 15:37:45 +0000 Subject: [PATCH 04/11] Update the snapshots --- .../__snapshots__/test_snapshots.ambr | 174 +++++++++--------- 1 file changed, 85 insertions(+), 89 deletions(-) diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index cb7b92d30..c142d5d3d 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -12328,165 +12328,161 @@ font-weight: 700; } - .terminal-717671184-matrix { + .terminal-3590440526-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-717671184-title { + .terminal-3590440526-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-717671184-r1 { fill: #c5c8c6 } - .terminal-717671184-r2 { fill: #e3e3e3 } - .terminal-717671184-r3 { fill: #313437 } - .terminal-717671184-r4 { fill: #324f70 } - .terminal-717671184-r5 { fill: #4f9262 } - .terminal-717671184-r6 { fill: #a4823a } - .terminal-717671184-r7 { fill: #904354 } - .terminal-717671184-r8 { fill: #e1e1e1 } - .terminal-717671184-r9 { fill: #7c7d7e;font-weight: bold } - .terminal-717671184-r10 { fill: #75828b;font-weight: bold } - .terminal-717671184-r11 { fill: #192e1f;font-weight: bold } - .terminal-717671184-r12 { fill: #3a2a13;font-weight: bold } - .terminal-717671184-r13 { fill: #978186;font-weight: bold } - .terminal-717671184-r14 { fill: #101011 } - .terminal-717671184-r15 { fill: #0c1e39 } - .terminal-717671184-r16 { fill: #156034 } - .terminal-717671184-r17 { fill: #825210 } - .terminal-717671184-r18 { fill: #5b132a } - .terminal-717671184-r19 { fill: #768189 } - .terminal-717671184-r20 { fill: #3a2a13 } - .terminal-717671184-r21 { fill: #7b7b7b } - .terminal-717671184-r22 { fill: #78838b } - .terminal-717671184-r23 { fill: #7f8081 } - .terminal-717671184-r24 { fill: #7c7d7e } - .terminal-717671184-r25 { fill: #31220c;font-weight: bold } - .terminal-717671184-r26 { fill: #e2e3e3 } - .terminal-717671184-r27 { fill: #104e2d } - .terminal-717671184-r28 { fill: #7a7b7b } - .terminal-717671184-r29 { fill: #1c1c1c } - .terminal-717671184-r30 { fill: #191919 } - .terminal-717671184-r31 { fill: #181818 } - .terminal-717671184-r32 { fill: #7c7c7c } - .terminal-717671184-r33 { fill: #494949 } - .terminal-717671184-r34 { fill: #14191f } - .terminal-717671184-r35 { fill: #ddedf9 } + .terminal-3590440526-r1 { fill: #454a50 } + .terminal-3590440526-r2 { fill: #507bb3 } + .terminal-3590440526-r3 { fill: #7ae998 } + .terminal-3590440526-r4 { fill: #ffcf56 } + .terminal-3590440526-r5 { fill: #e76580 } + .terminal-3590440526-r6 { fill: #c5c8c6 } + .terminal-3590440526-r7 { fill: #e2e3e3;font-weight: bold } + .terminal-3590440526-r8 { fill: #dde6ed;font-weight: bold } + .terminal-3590440526-r9 { fill: #0a180e;font-weight: bold } + .terminal-3590440526-r10 { fill: #211505;font-weight: bold } + .terminal-3590440526-r11 { fill: #f5e5e9;font-weight: bold } + .terminal-3590440526-r12 { fill: #000000 } + .terminal-3590440526-r13 { fill: #001541 } + .terminal-3590440526-r14 { fill: #008139 } + .terminal-3590440526-r15 { fill: #b86b00 } + .terminal-3590440526-r16 { fill: #780028 } + .terminal-3590440526-r17 { fill: #313437 } + .terminal-3590440526-r18 { fill: #324f70 } + .terminal-3590440526-r19 { fill: #4f9262 } + .terminal-3590440526-r20 { fill: #a4823a } + .terminal-3590440526-r21 { fill: #904354 } + .terminal-3590440526-r22 { fill: #7c7d7e;font-weight: bold } + .terminal-3590440526-r23 { fill: #75828b;font-weight: bold } + .terminal-3590440526-r24 { fill: #192e1f;font-weight: bold } + .terminal-3590440526-r25 { fill: #3a2a13;font-weight: bold } + .terminal-3590440526-r26 { fill: #978186;font-weight: bold } + .terminal-3590440526-r27 { fill: #101011 } + .terminal-3590440526-r28 { fill: #0c1e39 } + .terminal-3590440526-r29 { fill: #156034 } + .terminal-3590440526-r30 { fill: #825210 } + .terminal-3590440526-r31 { fill: #5b132a } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - WidgetDisableTestApp + WidgetDisableTestApp - - - - WidgetDisableTestApp - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - ButtonButtonButtonButtonButton - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ -  Column 1  Column 2  Column 3  Column 4  -  0         0         0         0         - This is list item 0 - This is list item 1 - ▼ This is a test tree - ├── Leaf 0 - Hello, World! - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - This is an empty input with a placeholder - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ - This is some text in an input - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▇▇ - + + + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ + ButtonButtonButtonButtonButton + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ From eea61c1b0b97062fa0af3f022d1469324ad29e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:16:00 +0000 Subject: [PATCH 05/11] Fix changelog. [skip ci] --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf71b928..49d764f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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/). + +## Unreleased + +### Fixed + +- Fixed how the namespace for messages is calculated to facilitate inheriting messages https://github.com/Textualize/textual/issues/1814 + ## [0.15.0] - 2023-03-13 ### Fixed @@ -14,7 +21,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `Pilot.click` not correctly creating the mouse events https://github.com/Textualize/textual/issues/2022 - Fixes issue where the horizontal scrollbar would be incorrectly enabled https://github.com/Textualize/textual/pull/2024 - Fixes for tracebacks not appearing on exit https://github.com/Textualize/textual/issues/2027 -- Fixed how the namespace for messages is calculated to facilitate inheriting messages https://github.com/Textualize/textual/issues/1814 ### Added From ae83e124831df027d15fbf99c13e5833aeda3ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:28:51 +0000 Subject: [PATCH 06/11] Simplify namespace for inherited messages. Related issues: #1814. Related PRs: 2038. --- src/textual/widgets/_checkbox.py | 3 --- src/textual/widgets/_radio_button.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/textual/widgets/_checkbox.py b/src/textual/widgets/_checkbox.py index 510e47189..1bba2f3f5 100644 --- a/src/textual/widgets/_checkbox.py +++ b/src/textual/widgets/_checkbox.py @@ -14,9 +14,6 @@ class Checkbox(ToggleButton): This message can be handled using an `on_checkbox_changed` method. """ - # https://github.com/Textualize/textual/issues/1814 - namespace = "checkbox" - @property def checkbox(self) -> Checkbox: """The checkbox that was changed.""" diff --git a/src/textual/widgets/_radio_button.py b/src/textual/widgets/_radio_button.py index f76f6dc6f..b47f6b427 100644 --- a/src/textual/widgets/_radio_button.py +++ b/src/textual/widgets/_radio_button.py @@ -21,9 +21,6 @@ class RadioButton(ToggleButton): This message can be handled using an `on_radio_button_changed` method. """ - # https://github.com/Textualize/textual/issues/1814 - namespace = "radio_button" - @property def radio_button(self) -> RadioButton: """The radio button that was changed.""" From 98f56aa1f6a5db306d0a0878b31650e925b767bb Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 14 Mar 2023 09:47:28 +0000 Subject: [PATCH 07/11] Fix a typo in example code in the 0.14.0 release blog post (#2047) Credit to #2021 for the spot. --- docs/blog/posts/release0-14-0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/posts/release0-14-0.md b/docs/blog/posts/release0-14-0.md index 359750338..fb09659a7 100644 --- a/docs/blog/posts/release0-14-0.md +++ b/docs/blog/posts/release0-14-0.md @@ -35,7 +35,7 @@ Additionally, we've simplified constructing messages classes. Previously all mes So prior to 0.14.0 you might have posted messages like the following: ```python -async self.post_message(self.Changed(self, item=self.item)) +await self.post_message(self.Changed(self, item=self.item)) ``` You can now replace it with this simpler function call: From b9c6520db4ff8c08a99c25f6037716928b7d9a60 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 14 Mar 2023 09:47:51 +0000 Subject: [PATCH 08/11] Make the Python code for dock.md more... Pythonic (#2046) Fixes #2043. --- docs/styles/dock.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/styles/dock.md b/docs/styles/dock.md index 28462fd4f..51a4b8ec7 100644 --- a/docs/styles/dock.md +++ b/docs/styles/dock.md @@ -68,10 +68,10 @@ dock: top; /* Docks on the top edge of the parent container. */ ## Python ```python -widget.styles.dock = bottom; # Dock bottom. -widget.styles.dock = left; # Dock left. -widget.styles.dock = right; # Dock right. -widget.styles.dock = top; # Dock top. +widget.styles.dock = "bottom" # Dock bottom. +widget.styles.dock = "left" # Dock left. +widget.styles.dock = "right" # Dock right. +widget.styles.dock = "top" # Dock top. ``` ## See also From 551d93c7c82957a40a45f5b88771ebd1a261e4bf Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 14 Mar 2023 09:48:20 +0000 Subject: [PATCH 09/11] Ensure that `Tab` is available from `textual.widgets` (#2045) Fixes #2044 --- CHANGELOG.md | 1 + src/textual/widgets/_tab.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 src/textual/widgets/_tab.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 49d764f65..3e87e2d20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed how the namespace for messages is calculated to facilitate inheriting messages https://github.com/Textualize/textual/issues/1814 +- `Tab` is now correctly made available from `textual.widgets`. ## [0.15.0] - 2023-03-13 diff --git a/src/textual/widgets/_tab.py b/src/textual/widgets/_tab.py new file mode 100644 index 000000000..2d5a4aa81 --- /dev/null +++ b/src/textual/widgets/_tab.py @@ -0,0 +1,3 @@ +from ._tabs import Tab + +__all__ = ["Tab"] From 507ee48967cfddaf3a3ae9a4a9cec811c838f64d Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 14 Mar 2023 09:57:31 +0000 Subject: [PATCH 10/11] version bump (#2049) --- CHANGELOG.md | 4 +++- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e87e2d20..a67f57845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## Unreleased +## [0.15.1] - 2023-03-14 ### Fixed @@ -591,6 +591,8 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040 - New handler system for messages that doesn't require inheritance - Improved traceback handling +[0.15.1]: https://github.com/Textualize/textual/compare/v0.15.0...v0.15.1 +[0.15.0]: https://github.com/Textualize/textual/compare/v0.14.0...v0.15.0 [0.14.0]: https://github.com/Textualize/textual/compare/v0.13.0...v0.14.0 [0.13.0]: https://github.com/Textualize/textual/compare/v0.12.1...v0.13.0 [0.12.1]: https://github.com/Textualize/textual/compare/v0.12.0...v0.12.1 diff --git a/pyproject.toml b/pyproject.toml index 5dfef09c5..42dbb358f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.15.0" +version = "0.15.1" homepage = "https://github.com/Textualize/textual" description = "Modern Text User Interface framework" authors = ["Will McGugan "] From 85cce4a09e7e6e346a13020f3ea0d1685b1593a4 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 14 Mar 2023 09:59:37 +0000 Subject: [PATCH 11/11] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a67f57845..0d853dee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed how the namespace for messages is calculated to facilitate inheriting messages https://github.com/Textualize/textual/issues/1814 -- `Tab` is now correctly made available from `textual.widgets`. +- `Tab` is now correctly made available from `textual.widgets`. https://github.com/Textualize/textual/issues/2044 ## [0.15.0] - 2023-03-13