From 616d107065845588b1589b4a2b107de04de643c1 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 10 Dec 2024 15:54:17 +0100 Subject: [PATCH 1/2] Add doc for migrating from wgpu.gui --- README.md | 2 ++ rendercanvas/from_wgpu_canvas.md | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 rendercanvas/from_wgpu_canvas.md diff --git a/README.md b/README.md index c8fbef2..934192c 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ See how the two windows above look the same? That's the idea; they also look the same to the code that renders to them. Yet, the GUI systems are very different (Qt vs glfw in this case). Now that's a powerful abstraction! +Coming from `wgpu.gui`? Check [from_wgpu_canvas.md](from_wgpu_canvas.md). + ## Purpose diff --git a/rendercanvas/from_wgpu_canvas.md b/rendercanvas/from_wgpu_canvas.md new file mode 100644 index 0000000..c8efb1f --- /dev/null +++ b/rendercanvas/from_wgpu_canvas.md @@ -0,0 +1,48 @@ +# Migrating from wgpu.gui.WgpuCanvas + +This project was spun out of wgpu-py, and has evolved to meet our requirements for update-propagation and more. +This document lists all the changes w.r.t. the last version of the canvas in wgpu-py. + +## Changes + +*Let me know if I missed any!* + +* `WgpuCanvas` -> `RenderCanvas`. +* `run` -> `loop.run()`. +* `call_later` -> `loop.call_later`. +* `canvas.is_closed()` -> `canvas.get_closed()`. +* The `canvas.get_context()` must be called with an arg: `canvas.get_context("wgpu")`. + + +## Improvements + +* Overall cleaner code, more tests, better docs. +* Support for contexts other than wgpu. +* Bitmap rendering via builtin`canvas.get_context("bitmap")`. +* Handling of sigint (ctrl+c). +* Support for Trio. +* Support for async event handlers. +* Support for running async functions via `loop.add_task()`. +* Simpler Qt lib selection with `from rendercanvas.pyside6 import RenderCanvas`. +* Generic scheduling system with modes "ondemand", "continious", "fastest". + + +## By example + +In wgpu-py: +```py +from wgpu.gui.auto import WgpuCanvas, run + +... + +run() +``` + +In rendercanvas: +```py +from rendercanvas.auto import RenderCanvas, loop + +... + +loop.run() +``` From f2ed31b36129f26bcfdd0f3b566661fea910f743 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Tue, 10 Dec 2024 15:55:24 +0100 Subject: [PATCH 2/2] move (put in wrong place) --- rendercanvas/from_wgpu_canvas.md => from_wgpu_canvas.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rendercanvas/from_wgpu_canvas.md => from_wgpu_canvas.md (100%) diff --git a/rendercanvas/from_wgpu_canvas.md b/from_wgpu_canvas.md similarity index 100% rename from rendercanvas/from_wgpu_canvas.md rename to from_wgpu_canvas.md