Skip to content

Commit

Permalink
Fix wrong column widths selecting Producer/Recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
mitaa committed Sep 7, 2024
1 parent 115d07e commit 1fd09d0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/production_planner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import os
from copy import copy
from dataclasses import dataclass
from pathlib import Path
import importlib.metadata

Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1fd09d0

Please sign in to comment.