From 1fd09d0dd6313705f87014d7c5c83a0db9276e45 Mon Sep 17 00:00:00 2001 From: mitaa Date: Sat, 7 Sep 2024 05:15:13 +0200 Subject: [PATCH] Fix wrong column widths selecting Producer/Recipe https://github.com/Textualize/textual/issues/4928 --- src/production_planner/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/production_planner/__init__.py b/src/production_planner/__init__.py index 3232fdd..50d4a54 100644 --- a/src/production_planner/__init__.py +++ b/src/production_planner/__init__.py @@ -27,7 +27,6 @@ import os from copy import copy -from dataclasses import dataclass from pathlib import Path import importlib.metadata @@ -36,7 +35,7 @@ from textual import events from textual.app import App, ComposeResult from textual.widgets import Header, Footer -from textual.coordinate import Coordinate +from textual import work from rich.style import Style from rich.color import Color @@ -263,6 +262,9 @@ def callback(assignments: [SetCellValue]): cell.set(ass.value) node.update() self.update(sel_ctxt) + # FIXME: https://github.com/Textualize/textual/issues/4928 + from textual import messages + self.table.post_message(messages.Prompt()) self.push_screen(cell.selector(), callback) def action_move_up(self): @@ -310,8 +312,6 @@ def on_key(self, event: events.Key) -> None: if instance is None: return - node = instance.node_main - if (col is None) or (not col(instance).access_guard() or col.read_only): self.num_write_mode = False return @@ -407,7 +407,9 @@ def _update_highlight_info(self, rows: [[Cell]]): row_highlight += [style_empty] self.table.highlight_cols += [row_highlight] - def update(self, selected: SelectionContext = None): + # FIXME: https://github.com/Textualize/textual/issues/4928 + @work(exclusive=True) + async def update(self, selected: SelectionContext = None): if self.loaded_hash != hash(self.data): self.title = f"*{CONFIG.store['last_file']}" else: