Skip to content

Application actions import without Textual, so Qt lists the same menu - #1812

Merged
trissim merged 1 commit into
mainfrom
claude-a/application-actions-shared
Nov 16, 2026
Merged

trissim merged 1 commit into
mainfrom
claude-a/application-actions-shared

Conversation

@trissim

@trissim trissim commented Nov 16, 2026

Copy link
Copy Markdown

The ApplicationAction family now imports without Textual, so the Qt client's ☰ menu can list the same actions instead of its own two hard-coded items.

Depends on OpenHCSDev/metaclass-registry#14 (key declarations moved out of Textual) and OpenHCSDev/textual#314 (Textual imports them back). Both are merged.

Shape

  • toad.client.application_actions (imports with Textual blocked):
    • DeclaredAction, the root of every action (keys declared per InputMode, title, summary, offered, label, available, parse, apply)
    • ApplicationAction and its menu(app)
    • System, YieldingKey, ReplacesFrameworkAction
    • the members whose bodies only need the shared client: New thread, Channels, Direct messages, Quit
  • Stays in Textual, same family (toad.application_actions): OpenBus, Settings, Team and Keymap push Textual screens; TransferMenu uses Textual's transfer widget; OpenUrl and SetFooter/ToggleFooter are the terminal link and the footer; HelpQuit is the ctrl+c double-press; the Vim workspace actions use Textual's workspace screen. ApplicationCommands is the Textual palette.
  • Channels' body ran app.run_worker(app.session_navigation.reveal). It is now app.run_operation(ChannelsReveal, ...), through the shared host.
  • Turning declared keys into Textual bindings moves from each action class to DeclaredWidgetActions (key_bindings, mode_bindings, exclusive_bindings, configured_bindings, active_declared_bindings). There is still one family and no per-member Textual subclass. Widget Action adds its footer group and engine key through refine_binding.

Qt menu

ApplicationAction.menu(app) gives (command, label) pairs; run one with await command.apply(app).

Checks

  • textual_free.py toad.client.application_actions prints OK.
  • ruff --select F on every touched file: clean. It also fixed pre-existing unused or duplicate imports in question.py, side_bar.py and test_main_menu_transfer.py.
  • Smoke: ToadApp.__abstractmethods__ is [].
  • ToadApp's declared bindings in all four key modes, plus every action_* dispatcher: the same set before and after, compared with the module rename normalised.

What changes for a user

  • The four moved actions' keymap ids now start with toad.client.application_actions. instead of toad.application_actions.. A saved remap of ctrl+s, ctrl+shift+d or ctrl+q would stop applying; on this machine's toad.json only KeymapAction (not moved) is remapped.
  • The hamburger menu follows declaration order, so New thread, Channels, Direct messages and Quit now come first.

🤖 Generated with Claude Code

https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn

The action family root (DeclaredAction: keys, title, summary, availability, menu
offering, apply) and ApplicationAction with its menu move to
toad.client.application_actions, built on metaclass_registry's key declarations. New
thread, Channels, Direct messages and Quit live there too: their bodies only need the
shared client and host. Channels runs its reveal as a ChannelsReveal operation instead of
a Textual worker. The members that push Textual screens or use Textual widgets stay in
toad.application_actions, still in the same family, so the Textual menu, palette and keys
list the whole family and Qt lists whatever its process imported.

Turning a declaration's keys into Textual bindings moves from the action classes to
DeclaredWidgetActions (key_bindings, mode_bindings, exclusive_bindings,
configured_bindings, active_declared_bindings). Widget Action adds its footer group and
engine key through refine_binding. ToadApp's bindings are the same set before and after.
System, YieldingKey and ReplacesFrameworkAction move with the family. Every importer is
repointed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn
@trissim
trissim merged commit 9761829 into main Nov 16, 2026
1 of 2 checks passed
@github-actions

Copy link
Copy Markdown

debt-src at b58269e blocks on 11 lines:

grew NoneAbsence:src/toad/client/application_actions.py +3
grew TypeErrors:src/toad/application_actions.py +19
grew TypeErrors:src/toad/client/application_actions.py +5
grew TypeErrors:src/toad/keymap.py +1
grew TypeErrors:src/toad/widget_actions.py +1
found NoneAbsence:src/toad/client/application_actions.py at src/toad/client/application_actions.py:113 src/toad/client/application_actions.py:106 src/toad/client/application_actions.py:41
found TypeErrors:src/toad/application_actions.py at src/toad/application_actions.py:42 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:53 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:68 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:81 (Argument 1 of "offered" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:84 (Argument 1 of "label" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:93 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:110 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:125 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:141 (Argument 1 of "label" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:148 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:155 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:164 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:175 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:196 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:215 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:234 (Argument 1 of "apply" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "ClientApplication"  [override]) src/toad/application_actions.py:257 (Argument 1 to "menu" of "ApplicationAction" has incompatible type "App[object]"; expected "ClientApplication"  [arg-type]) src/toad/application_actions.py:262 (Argument 1 to "apply" of "DeclaredAction" has incompatible type "App[object]"; expected "ClientApplication"  [arg-type]) src/toad/application_actions.py:267 (Argument 1 to "menu" of "ApplicationAction" has incompatible type "App[object]"; expected "ClientApplication"  [arg-type]) src/toad/application_actions.py:268 (Argument 1 to "apply" of "DeclaredAction" has incompatible type "App[object]"; expected "ClientApplication"  [arg-type])
found TypeErrors:src/toad/client/application_actions.py at src/toad/client/application_actions.py:20 (Cannot find implementation or library stub for module named "metaclass_registry.key_declarations"  [import-not-found]) src/toad/client/application_actions.py:174 ("SessionNavigator" has no attribute "open_thread_form"  [attr-defined]) src/toad/client/application_actions.py:174 ("SessionNavigator" has no attribute "selected_project"  [attr-defined]) src/toad/client/application_actions.py:184 ("SessionNavigator" has no attribute "reveal"  [attr-defined]) src/toad/client/application_actions.py:193 ("SessionNavigator" has no attribute "direct_messages"  [attr-defined])
found TypeErrors:src/toad/keymap.py at src/toad/keymap.py:18 (Cannot find implementation or library stub for module named "metaclass_registry.key_declarations"  [import-not-found])
found TypeErrors:src/toad/widget_actions.py at src/toad/widget_actions.py:15 (Cannot find implementation or library stub for module named "metaclass_registry.key_declarations"  [import-not-found]) src/toad/widget_actions.py:59 (Argument 1 of "refine_binding" is incompatible with supertype "toad.client.application_actions.DeclaredAction"; supertype defines the argument type as "Binding"  [override])
introduced NoneAbsence:src/toad/client/application_actions.py at lines [41, 106, 113]
Warn-only, never blocks (8)
src/toad/client/application_actions.py: LintFindings +5
src/toad/keymap.py: LintFindings +1
src/toad/menus.py: LintFindings +1
src/toad/client/application_actions.py: Unformatted +1
found LintFindings:src/toad/client/application_actions.py at src/toad/client/application_actions.py:6 (I001 [*] Import block is un-sorted or un-formatted) src/toad/client/application_actions.py:33 (UP046 Generic class `DeclaredAction` uses `Generic` subclass instead of type parameters) src/toad/client/application_actions.py:180 (RUF012 Mutable default value for class attribute) src/toad/client/application_actions.py:190 (RUF012 Mutable default value for class attribute) src/toad/client/application_actions.py:199 (RUF012 Mutable default value for class attribute)
found LintFindings:src/toad/keymap.py at src/toad/keymap.py:2 (I001 [*] Import block is un-sorted or un-formatted)
found LintFindings:src/toad/menus.py at src/toad/menus.py:3 (I001 [*] Import block is un-sorted or un-formatted)
found Unformatted:src/toad/client/application_actions.py at src/toad/client/application_actions.py:1 (Black would reformat this file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant