1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[PR #951] [CLOSED] feat: plugin system with OctoPrint converter and PrettyGCode viewer #1144

Closed
opened 2026-05-07 00:16:16 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/951
Author: @Soopahfly
Created: 4/12/2026
Status: Closed

Base: mainHead: main


📝 Commits (1)

  • 7e6f116 feat: add plugin system with OctoPrint converter and PrettyGCode viewer

📊 Changes

40 files changed (+17571 additions, -10 deletions)

View changed files

📝 .gitignore (+6 -0)
backend/app/api/routes/plugins.py (+365 -0)
📝 backend/app/core/config.py (+2 -0)
📝 backend/app/core/database.py (+1 -0)
📝 backend/app/main.py (+51 -9)
backend/app/models/plugin.py (+22 -0)
backend/app/plugins/__init__.py (+0 -0)
backend/app/plugins/base.py (+208 -0)
backend/app/plugins/loader.py (+166 -0)
backend/app/plugins/octoprint_converter.py (+520 -0)
backend/app/plugins/registry.py (+164 -0)
📝 docker-compose.yml (+4 -0)
📝 frontend/src/App.tsx (+2 -0)
📝 frontend/src/api/client.ts (+73 -0)
📝 frontend/src/components/Layout.tsx (+2 -1)
frontend/src/components/PluginsSettings.tsx (+548 -0)
📝 frontend/src/i18n/locales/en.ts (+53 -0)
frontend/src/pages/PluginsPage.tsx (+9 -0)
plugins/.gitkeep (+0 -0)
plugins/example_plugin/__init__.py (+87 -0)

...and 20 more files

📄 Description

Summary

  • Adds a first-class plugin system to Bambuddy — install, enable/disable, and configure plugins without touching the source code
  • Includes an AST-based OctoPrint plugin converter so existing OctoPrint plugins can be uploaded as a .zip and auto-converted
  • Ships a bundled PrettyGCode plugin: a full 3D GCode visualizer with layer sync and nozzle animation driven by Bambu MQTT data

What's included

Backend (backend/app/plugins/)

  • Plugin loader — scans data/plugins/ on startup, auto-discovers packages, registers to DB, loads enabled plugins
  • MixinsStartupPlugin, ShutdownPlugin, EventHandlerPlugin, SettingsPlugin, AssetPlugin, SimpleApiPlugin
  • Plugin API (/api/v1/plugins) — list, upload/install, enable/disable, get/update settings, static asset serving, SimpleApiPlugin command dispatch
  • OctoPrint converter — AST-based; detects OctoPrint plugins by import octoprint / __plugin_pythoncompat__ / class inheritance; maps supported mixins 1:1 and stubs unsupported ones with clear notes
  • Events wired into on_print_start, on_print_complete, and archive creation
  • docker-compose.yml — mounts ./plugins into the container so plugins survive image rebuilds

Frontend

  • Plugins sidebar itemPackage icon, /plugins route, sits alongside Settings
  • Plugin cards — name/version/author/description, Loaded/Restart/Disabled badges, enable toggle, settings editor, "Open Viewer" link for plugins with a static/index.html
  • Upload modal — drag-drop .zip, detects type, previews converted code and mixin support before installing

PrettyGCode plugin (plugins/prettygcode/)

Converted from OctoPrint-PrettyGCode.

Viewer at /api/v1/plugins/prettygcode/assets/index.html:

  • Full Three.js 3D GCode visualisation
  • Layer highlight synced to layer_num from Bambu MQTT (via byte-offset map built from the GCode file)
  • Nozzle model animation using synthetic Send: commands derived from per-layer GCode (Bambu printers don't expose serial echo, so we synthesize it from the parsed file)
  • File picker from Bambuddy's file library; auto-loads currently printing file
  • Printer selector with model-based bed size (X1/X1C/P1S/P1P 256³, A1 300³, A1 Mini 180³)
  • All dependencies bundled locally (Three.js r-build, dat.gui, camera-controls, jQuery, OBJLoader, LineMaterial/Line2)

Test plan

  • Start Bambuddy — confirm plugin loader runs without errors in logs
  • Navigate to Plugins in sidebar — confirm PrettyGCode card appears as Loaded
  • Click Open Viewer — confirm 3D viewer loads at the asset URL
  • Load a .gcode file from the file picker — confirm model renders
  • Start a print — confirm layer highlight advances and nozzle animates
  • Upload an OctoPrint plugin .zip — confirm type detection, mixin preview, and install flow
  • Enable/disable a plugin and confirm restart-required badge appears
  • Edit plugin settings and confirm they persist after save

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/951 **Author:** [@Soopahfly](https://github.com/Soopahfly) **Created:** 4/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`7e6f116`](https://github.com/maziggy/bambuddy/commit/7e6f116b928032daa289924ee63251faee9a65f5) feat: add plugin system with OctoPrint converter and PrettyGCode viewer ### 📊 Changes **40 files changed** (+17571 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+6 -0) ➕ `backend/app/api/routes/plugins.py` (+365 -0) 📝 `backend/app/core/config.py` (+2 -0) 📝 `backend/app/core/database.py` (+1 -0) 📝 `backend/app/main.py` (+51 -9) ➕ `backend/app/models/plugin.py` (+22 -0) ➕ `backend/app/plugins/__init__.py` (+0 -0) ➕ `backend/app/plugins/base.py` (+208 -0) ➕ `backend/app/plugins/loader.py` (+166 -0) ➕ `backend/app/plugins/octoprint_converter.py` (+520 -0) ➕ `backend/app/plugins/registry.py` (+164 -0) 📝 `docker-compose.yml` (+4 -0) 📝 `frontend/src/App.tsx` (+2 -0) 📝 `frontend/src/api/client.ts` (+73 -0) 📝 `frontend/src/components/Layout.tsx` (+2 -1) ➕ `frontend/src/components/PluginsSettings.tsx` (+548 -0) 📝 `frontend/src/i18n/locales/en.ts` (+53 -0) ➕ `frontend/src/pages/PluginsPage.tsx` (+9 -0) ➕ `plugins/.gitkeep` (+0 -0) ➕ `plugins/example_plugin/__init__.py` (+87 -0) _...and 20 more files_ </details> ### 📄 Description ## Summary - Adds a first-class plugin system to Bambuddy — install, enable/disable, and configure plugins without touching the source code - Includes an AST-based OctoPrint plugin converter so existing OctoPrint plugins can be uploaded as a .zip and auto-converted - Ships a bundled PrettyGCode plugin: a full 3D GCode visualizer with layer sync and nozzle animation driven by Bambu MQTT data ## What's included ### Backend (`backend/app/plugins/`) - **Plugin loader** — scans `data/plugins/` on startup, auto-discovers packages, registers to DB, loads enabled plugins - **Mixins** — `StartupPlugin`, `ShutdownPlugin`, `EventHandlerPlugin`, `SettingsPlugin`, `AssetPlugin`, `SimpleApiPlugin` - **Plugin API** (`/api/v1/plugins`) — list, upload/install, enable/disable, get/update settings, static asset serving, SimpleApiPlugin command dispatch - **OctoPrint converter** — AST-based; detects OctoPrint plugins by `import octoprint` / `__plugin_pythoncompat__` / class inheritance; maps supported mixins 1:1 and stubs unsupported ones with clear notes - **Events** wired into `on_print_start`, `on_print_complete`, and archive creation - **`docker-compose.yml`** — mounts `./plugins` into the container so plugins survive image rebuilds ### Frontend - **Plugins sidebar item** — `Package` icon, `/plugins` route, sits alongside Settings - **Plugin cards** — name/version/author/description, Loaded/Restart/Disabled badges, enable toggle, settings editor, "Open Viewer" link for plugins with a `static/index.html` - **Upload modal** — drag-drop .zip, detects type, previews converted code and mixin support before installing ### PrettyGCode plugin (`plugins/prettygcode/`) Converted from [OctoPrint-PrettyGCode](https://github.com/Soopahfly/OctoPrint-PrettyGCode). Viewer at `/api/v1/plugins/prettygcode/assets/index.html`: - Full Three.js 3D GCode visualisation - Layer highlight synced to `layer_num` from Bambu MQTT (via byte-offset map built from the GCode file) - Nozzle model animation using synthetic `Send:` commands derived from per-layer GCode (Bambu printers don't expose serial echo, so we synthesize it from the parsed file) - File picker from Bambuddy's file library; auto-loads currently printing file - Printer selector with model-based bed size (X1/X1C/P1S/P1P 256³, A1 300³, A1 Mini 180³) - All dependencies bundled locally (Three.js r-build, dat.gui, camera-controls, jQuery, OBJLoader, LineMaterial/Line2) ## Test plan - [ ] Start Bambuddy — confirm plugin loader runs without errors in logs - [ ] Navigate to **Plugins** in sidebar — confirm PrettyGCode card appears as Loaded - [ ] Click **Open Viewer** — confirm 3D viewer loads at the asset URL - [ ] Load a `.gcode` file from the file picker — confirm model renders - [ ] Start a print — confirm layer highlight advances and nozzle animates - [ ] Upload an OctoPrint plugin .zip — confirm type detection, mixin preview, and install flow - [ ] Enable/disable a plugin and confirm restart-required badge appears - [ ] Edit plugin settings and confirm they persist after save 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:16:16 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy-maziggy-1#1144
No description provided.