-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add builder and shortcut window #140
Draft
PhilippMDoerner
wants to merge
15
commits into
can-lehmann:main
Choose a base branch
from
PhilippMDoerner:add-builder-and-shortcut-window
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add builder and shortcut window #140
PhilippMDoerner
wants to merge
15
commits into
can-lehmann:main
from
PhilippMDoerner:add-builder-and-shortcut-window
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This proc allows you to create any Gtkwidget just via className
It is now a dialog
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.