Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This provides a first draft on how we might add support for the ShortcutsWindow widget via the Builder interface.
Overall it adds support for these Widgets:
Further functionality that was added and may be useful:
setProperty
proc and refactored some parts of owlkettle to make use of it instead of the same 3+ lines of code to do soHow it works:
When initially building it provides "Pseudo-Widgets" for ShortcutsSection/Group/Shortcut that can be put into ShortcutsWindow and thus be kind-of their own XML representation, but with better support by nim's type system.
Note: This does not enable updating the values after the fact.
ShortcutsWindow uses
toNode
procs to turnShortcutsSection
into XMLNodes, which usestoNode
procs to turnShortcutsGroup
into XmlNodes etc..This goes on until one gigantic XMLNode has been created, which gets stringified and used as "uiString" to create a builder, from which the ShortcutsWindow can be extracted.
In order to be able to extract the widget from the builder, an "id"-property must be set in the uiString of the ShortcutsWindow tag, which I just set to "widget". It's a technical detail so it can't be customized by anybody.
Small niceties:
This also provides an example! I reimplemented this ui file for the example in shortcuts_window.nim, in large parts in order to triple check if I didn't miss some part of their spec. Works nicely!
Word explanation:
Example video:
Screencast.from.2023-11-16.23-07-54.webm
This is a draft because I believe we'll have a fair amount to talk about this as this does a fair amount of stuff.
Particularly: ... how to we run this as a modal when clicking on a popup menu entry? I honestly have no clue.