Repository navigation
feat(preview): show embedded G-code thumbnails - #1864
Conversation
Read PNG, JPEG, and QOI slicer thumbnails from text G-code comments and binary bgcode blocks, and show the largest one in the preview pane and as a file icon.
Apply rustfmt and the Clippy fixes from the local check, and reword the preview note so the spell checker does not split "PNGs".
# Conflicts: # data/locales/de.json # data/locales/en.json # data/locales/es.json # data/locales/fr.json # data/locales/it.json # data/locales/ja.json # data/locales/ko.json # data/locales/pt-BR.json # data/locales/ru.json # data/locales/vi.json # data/locales/zh-CN.json # data/locales/zh-TW.json
G-code joined the model formats, so remote .gcode files hit the local-only model route: Quick Preview refused them and the provider reported that remote models are not supported, although main previewed them as text. Treat remote G-code as an ordinary text file.
Remove the argument and from_argument constant checks and a no-op write from the G-code reader tests, and tighten the header-limit doc comment.
Review and cleanupMerged Review against the description and #1863. Every claim checks out. Text Fixes pushed
Tests removed
Validation
Follow-ups outside this PR
CI: all checks green on |

Description
Show the embedded slicer thumbnail from
.gcode,.gco, and binary.bgcodefiles in the preview pane and as the file icon. Text files carry PNG, JPEG, or QOI images as base64 comments (thumbnail,thumbnail_PNG,thumbnail_JPG,thumbnail_QOI). Binary.bgcodestores the same images in thumbnail blocks. Quick Preview uses the largest image that decodes. A text file with no usable thumbnail keeps the ordinary text preview. A binary file with none reports that it has no usable embedded thumbnail. The toolpath is not drawn, and the STL model-thumbnails setting does not gate these icons.Visual evidence
N/A. Screenshots are not attached with this submission. In the preview pane, a G-code file with an embedded thumbnail shows that image and no camera controls. A text G-code file with no thumbnail shows the file text. A binary
.bgcodefile with no thumbnail shows “This G-code file has no usable embedded thumbnail”. In icon view, the same files show the thumbnail whenever Show thumbnails is on.How to test
.gcodeor.gcofile whose header has a; thumbnail beginblock (orthumbnail_PNG,thumbnail_JPG, orthumbnail_QOI), and a binary.bgcodefile with a thumbnail block.Expected result: The preview pane and file icon show the largest decodable embedded thumbnail. Files without one keep the existing text preview, or the specific missing-thumbnail message when the file is binary. No toolpath is rendered.
Related issue
Closes #1863