Textualize / trogon

Easily turn your Click CLI into a powerful terminal application
MIT License
2.45k stars 56 forks source link

Trogon footer broken in Textual 0.60.0 and above #82

Closed daneah closed 1 week ago

daneah commented 4 months ago

On Textual 0.63.0 and above, the footer in Trogon is no longer functional. The Close and Run option and the About option still work, but other options don't respond to keyboard shortcuts or clicks.

Textual 0.63.0 changed the footer behavior, which may be related.

Downgrading to Textual 0.62.0 restores the functionality.

Reproduction and more details here.

daneah commented 4 months ago

Er, sorry, before you get at all deep into this—although the visual footer change occured in 0.63.0, I think the actual functional part is broken earlier than 0.63.0—looking for that version now and will update.

daneah commented 4 months ago

It appears the functional portion of the footer broke in version 0.60.0 and above.

TomJGooding commented 3 months ago

The problem is this change in Textual v0.61.0:

Breaking change: Actions (as used in bindings) will no longer check the app if they are unhandled. This was undocumented anyway, and not that useful. https://github.com/Textualize/textual/pull/4516

The fix is pretty simple but would require a new Trojon release:

diff --git a/trogon/trogon.py b/trogon/trogon.py
index 1238747..36b1884 100644
--- a/trogon/trogon.py
+++ b/trogon/trogon.py
@@ -48,10 +48,14 @@ class CommandBuilder(Screen):
     BINDINGS = [
         Binding(key="ctrl+r", action="close_and_run", description="Close & Run"),
         Binding(
-            key="ctrl+t", action="focus_command_tree", description="Focus Command Tree"
+            key="ctrl+t",
+            action="app.focus_command_tree",
+            description="Focus Command Tree",
         ),
-        Binding(key="ctrl+o", action="show_command_info", description="Command Info"),
-        Binding(key="ctrl+s", action="focus('search')", description="Search"),
+        Binding(
+            key="ctrl+o", action="app.show_command_info", description="Command Info"
+        ),
+        Binding(key="ctrl+s", action="app.focus('search')", description="Search"),
         Binding(key="f1", action="about", description="About"),
     ]