Adds BgcodeThumbnailProvider and BgcodePreviewHandler
Summary of the Pull Request
PR Checklist
- [X] Closes: #30352
- [X] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [X] Tests: Added/updated and all pass
- [X] Localization: All end user facing strings can be localized
- [ ] Dev docs: Added/updated
- [X] New binaries: Added on the required places
- [X] JSON for signing for new binaries
- [X] WXS for installer for new binaries and localization folder
- [ ] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
- Close PowerToys if installed in your machine
- Full build the solution: PowerToys.sln
- Start PowerToys from PowerToys\x64\Debug\PowerToys.exe or PowerToys\x64\Release\PowerToys.exe
- Toggle the "Binary G-code thumbnail previewer" setting to enable
- Open HelperFiles folder on the tests and check if the icon changes to an image
- Check explorer preview to see if image is also shown there
So, first things first: the Binary G-code format was created by Prusa and made open-source under AGPL-3.0 license.
I have taken their specifications document and ported only what was required to read and decode the thumbnails inside the binary g-code data.
I did discuss with @crutkas to merge this inside the g-code providers, however in the end I decided to make it a new provider as the format is not "yet" a defacto standard (like standard g-code format is), plus the g-code thumbnail provider only gets a stream so I would need to identify the type from the data instead of just using the filename (as that is not available without refactoring the provider)
shifting to draft so it doesn't accidently get merged
@pedrolamas synced with our team here. We can proceed but would be amazing if we could get Prusa to give the thumbs up here just so we can have a true end to end approval with them.
Hi @josefprusa, sorry to rehash this but can I get you to ok this directly here so it gets on the record with Microsoft? Thanks! 🙂
... (ask) Prusa if they are ok from a licensing perspective with you using the spec to write a code contribution to PowerToys, an MIT licensed project? This would be allowing them then to make the call and it then also wouldn't be a surprise to them.
Same thing as we discussed on DMs, I partially ported part of the bgcode definition to C# so we can read the thumbnail data from the files and show them in Windows File Explorer, all we need is your confirmation here on the PR that you are ok with this.
@pedrolamas possible to resolve the conflicts so we can get this in?
@crutkas all conflicts resolved!
@crutkas I've fixed all conflicts and made some changes as recommended by copilot, so I think it should be all good to go!
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Commenter does not have sufficient privileges for PR 38667 in repo microsoft/PowerToys
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
@check-spelling-bot Report
:red_circle: Please review
See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.
| :x: Errors and Warnings | Count |
|---|---|
| :warning: binary-file | 3 |
| :x: forbidden-pattern | 1 |
See :x: Event descriptions for more information.
These words are not needed and should be removed
fffSome files were automatically ignored :see_no_evil:
These sample patterns would exclude them:
^src/modules/powerrename/PowerRenameUITest/testItems/
You should consider adding them to:
.github/actions/spell-check/excludes.txt
File matching is via Perl regular expressions.
To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.
To update file exclusions and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:pedrolamas/PowerToys.git repository
on the pedrolamas/bgcode-thumbnail-provider branch (:information_source: how do I use this?):
curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/16184745002/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Forbidden patterns :no_good: (1)
In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.
These forbidden patterns matched content:
Should be a
\san (?=(?:[b-df-gj-npqtv-xz]|h(?!our|tml|ttp)|r(?!c\b)|s(?!sh|vg))[a-z])
If the flagged items are :exploding_head: false positives
If items relate to a ...
-
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txtfile matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^refers to the file's path from the root of the repository, so^README\.md$would exclude README.md (on whichever branch you're using). -
well-formed pattern.
If you can write a pattern that would match it, try adding it to the
patterns.txtfile.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
/azp run
Azure Pipelines successfully started running 1 pipeline(s).