This repository has been archived by the owner on Nov 3, 2020. It is now read-only.
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
… into enh/ribbon-contribution
xref: #6 |
@johntyree it looks good to me as a first implementation. @tonyroberts any thoughts? Or shall I merge? |
@dpinte sure, looks good to me (except the dead cat, poor animal!) |
;-) merging |
Did I add that cat picture? Yikes. I'm sure I must have had plans to update that... |
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 is a prototype for how we might extend the ribbon from PyXLL extensions.
There's a bit of a hacky workaround with the config right now, because PyXLL parses it prior to loading extensions and then doesn't reexamine the ConfigParser object.
We have to specify two files, a
default_ribbon
and the normalribbon
. Thedefault_ribbon
is really just the oldribbon
file and serves as a starting point. Then the extensions all submit their fragments to be included and they are combined by the extension loading code. Finally, we write out the new complete to ribbon xml to whatever fileribbon
is set to, since PyXLL is hardcoded to load that.It's not beautiful, but it works nicely.
This PR doesn't handle layout whatsoever. We have no control over the order in which extensions are loaded and there's no effort here to try to order the fragments smartly. If they extension submits a new tab it just goes at the end of list. If the extension submits an tab that matches an existing tab, the groups just get appended to that tab. If one knows the names of all the fragments, one can ask for them to be combined in a particular order, but there's no easy way to know right now.
The API might be nicer if we extract the element ids as the name rather than make the extension pass it in, which can be error prone. I'm not sure about this yet.