diff --git a/docs/backlog.md b/docs/backlog.md index bf1d6c4..3564ff7 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -1,9 +1,10 @@ # Backlog — 0.3.0 and later Recorded after hands-on testing of 0.2.6.1 in September 2026. **None of -this is in 0.2.6.2**, which is limited to picture printing, the -Presentations memory failure and the settings lockdown. Each item says -what was observed, so whoever picks it up starts from the evidence. +this is in 0.2.6.2 or 0.2.6.3**: 0.2.6.2 is limited to picture printing, +the Presentations memory failure and the settings lockdown, and 0.2.6.3 +to the black-and-white preview and Print image. Each item says what was +observed, so whoever picks it up starts from the evidence. ## Wonder Ink @@ -23,6 +24,15 @@ what was observed, so whoever picks it up starts from the evidence. - **Readable worksheet names.** Tabs show the downloaded file's name, which for many worksheets is a long generated prefix. Strip it, or take the name from the PDF's own title. +- **Print image and CSS background pictures** (from 0.2.6.3). The engine's + hit test does not call a CSS background a picture, so right-click there + offers only Print page. Only worth doing if Sunday's testing finds + Wonder Ink's site draws artwork that way; the lab has no account to + tell. See wonder-ink.md, *Print image*. +- **The clipboard after Print image** (from 0.2.6.3). It is put back, but + owned by Wonder Ink afterwards, so text copied elsewhere before is gone + once Wonder Ink closes — there is no clipboard manager in the session. + Measured, and judged smaller than leaving the picture there. - **A speaker on the tab that is playing sound** (`QWebEnginePage.recentlyAudible`). - **Linked lesson text opens an intermediate popup** instead of following the link, where Chrome follows it directly. Investigate: probably a diff --git a/docs/manual/50-wonderink.md b/docs/manual/50-wonderink.md index 61e6a0c..8232ccd 100644 --- a/docs/manual/50-wonderink.md +++ b/docs/manual/50-wonderink.md @@ -32,18 +32,28 @@ The size applies to every tab and is remembered next time. ## Printing Press **Ctrl** and **P**, click **Print** at the top right, or right-click -and choose **Print…**. You will see the pages exactly as they will print. +and choose **Print page…**. You will see the pages exactly as they will +print. * Choose **Only some pages** to print, for example, `2` or `1-3`. * Set **Copies** for the number of children. -* Choose **Black and white** to save color ink. +* Choose **Black and white** to save color ink. The preview turns grey, + so you see what will come out; choose **Color** to go back. -**Printing a picture.** When the tab is a picture on its own, the -preview also shows **Picture**: choose its **Size** (for example 50%), -click one of the nine **Position** squares to put it in a corner or the -middle, and choose **Paper** upright or sideways. The preview changes as -you choose, and shows exactly what will print. **Fill the whole page** -makes it cover the paper but cuts off the edges. +**Printing a picture from the lesson.** Right-click the picture and +choose **Print image…**. Only that picture prints, not the page around +it. This works for pictures you cannot open by themselves. + +In the preview for a picture, also under **Picture**: choose its +**Size** (for example 50%), click one of the nine **Position** squares to +put it in a corner or the middle, and choose **Paper** upright or +sideways. The preview changes as you choose, and shows exactly what will +print. **Fill the whole page** makes it cover the paper but cuts off the +edges. A picture that is open in a tab by itself prints the same way. + +If Wonder Ink says a picture *could not be taken from the page*, it had +not finished loading: close the preview and try again, or choose **Print +page…** to print the whole page instead. Click **Print**. Wonder Ink says when the printer has it and goes back to the lesson. **Cancel** prints nothing. diff --git a/docs/screenshots/README.md b/docs/screenshots/README.md index 16663f7..3e8afa4 100644 --- a/docs/screenshots/README.md +++ b/docs/screenshots/README.md @@ -149,6 +149,17 @@ nothing else about the room's locks moves. | `notif-13pt`, `notif-15pt` | the two font sizes that were weighed for it | | `pc-typed-layer` | the card gone: the lab's keyboard tool closes it, which is why typing is still a bench test | +## Wonder Ink printing + +Under the lab's real Plasma session, driven with the pointer. See +[wonder-ink.md](../wonder-ink.md), *Printing*. + +| | | +| --- | --- | +| `pic-preview-default`, `pic-preview-half-topleft` | a picture in a tab of its own, laid out on Letter: as large as fits, then 50% top left (0.2.6.2) | +| `print-image-menu` | right-click on a picture inside a lesson: **Print image…** and **Print page…**; on the words there is only Print page (0.2.6.3) | +| `print-image-bw-half-topleft` | Print image on a signed-in picture, 50% top left, Black and white — the preview grey, as the job CUPS kept was (0.2.6.3) | + ## Failures, kept | | | diff --git a/docs/screenshots/print-image-bw-half-topleft.png b/docs/screenshots/print-image-bw-half-topleft.png new file mode 100644 index 0000000..8e04e1c Binary files /dev/null and b/docs/screenshots/print-image-bw-half-topleft.png differ diff --git a/docs/screenshots/print-image-menu.png b/docs/screenshots/print-image-menu.png new file mode 100644 index 0000000..041c68e Binary files /dev/null and b/docs/screenshots/print-image-menu.png differ diff --git a/docs/testing.md b/docs/testing.md index e7a845d..f2e3ec1 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -575,14 +575,14 @@ ifupdown stanza is already gone. **Do not run `--adopt` on it.** still reports `yes` - [ ] The laptop still reconnects after a reboot -## Wonder Ink — 0.2.6.1 and 0.2.6.2, before either goes to stable +## Wonder Ink — 0.2.6.1 to 0.2.6.3, before any goes to stable Everything below was done in the lab except what a lab cannot do: paper, a classroom's own graphics, a real keyboard, its network and its screen. Those are these checks. Stable stays on 0.2.2 until they pass. Before starting, on each machine: `dpkg-query -W ekklesia-classroom` -must say `0.2.6.1`. The desktops only get it once stable is moved, so on +must say `0.2.6.3`, which carries everything 0.2.6.1 and 0.2.6.2 did. The desktops only get it once stable is moved, so on a desktop install it by hand for the test: ``` @@ -600,14 +600,14 @@ after testing, either promote or reinstall 0.2.2 the same way. - [ ] Open Wonder Ink, sign in, open a lesson with a worksheet - [ ] Click the worksheet; it opens as a tab named after the file, with a document icon -- [ ] Ctrl+P (or right-click → Print…): the preview shows the worksheet's +- [ ] Ctrl+P (or right-click → Print page…): the preview shows the worksheet's own pages, page count right, ‹ › turn them - [ ] Printer shows **Elmer**, preselected - [ ] Print → a notification "Sent to the printer — … — Elmer", Wonder Ink stays open on the lesson - [ ] **The worksheet comes out of Elmer**, every page, right size, in colour -- [ ] Pages `2`, Copies `2`, Black and white → exactly two grey copies of - page 2 come out +- [ ] Pages `2`, Copies `2`, Black and white → the preview turns grey, + and exactly two grey copies of page 2 come out - [ ] Print a normal lesson page the same way; it comes out, Letter - [ ] Open the preview and press Cancel → nothing prints - [ ] Print three times in a row → three printouts, no crash @@ -627,6 +627,43 @@ after testing, either promote or reinstall 0.2.2 the same way. - [ ] A worksheet PDF still prints with no Picture section - [ ] The print dialog says **Color**, not Colour +### Black and white, and Print image (0.2.6.3) + +The lab measured all of this on the files CUPS kept, and under the real +Plasma session for the clipboard. What it cannot show is Wonder Ink's own +site (no account), real paper, and a classroom's own keyboard and mouse. + +- [ ] A lesson page with colour on it: Ctrl+P, then **Black and white** → + the preview says *Preparing black and white…* for a moment, then the + page is **grey**. **Color** → colour again. Back and forth three + times: it is instant after the first, and stays on the same page +- [ ] Print it in black and white: **the paper matches the grey preview** +- [ ] The same with a worksheet PDF (a few pages), in black and white +- [ ] Choose Black and white, then Color, then Print → it comes out **in + colour** +- [ ] In a lesson, **right-click on a picture** (not the words): the menu + has **Print image…** and **Print page…**. Right-click on the words: + only **Print page…** +- [ ] **Print image…** on a picture you cannot open in a tab by itself: + the preview shows *that picture* on white, with the **Picture** + section — not the lesson page +- [ ] Size **50%**, the **top-left** square, Black and white → the preview + shows a grey picture in the top-left quarter. Print it: **the paper + matches the preview** +- [ ] Print image on a picture with a transparent background (a clipart + animal, a logo) → white around it on paper, not black +- [ ] Print image, then **Cancel** → nothing prints +- [ ] Copy some words in the browser, then use Print image in Wonder + Ink, then paste in the browser → the words paste, not the picture +- [ ] If any picture says *could not be taken from the page*: note which + lesson and which picture. Right-click the same picture again once + the page has finished loading. If it still says so, that picture is + drawn in a way the engine does not treat as a picture — tell us + where it is +- [ ] If right-clicking an obvious picture offers **only** Print page, the + site draws it as a background. Note which lesson — it is the one + case Print image cannot reach + ### Size and zoom - [ ] A lesson in Wonder Ink is the same size as the same page in the @@ -695,4 +732,4 @@ classroom-wonderink --diagnose says `false`) If anything here fails, leave the desktops on stable 0.2.2 and fix it in -0.2.6.2 on canary. +the next maintenance release on canary. diff --git a/docs/wonder-ink.md b/docs/wonder-ink.md index 61fcbe6..f808b57 100644 --- a/docs/wonder-ink.md +++ b/docs/wonder-ink.md @@ -71,7 +71,8 @@ wrong a teacher is standing in front of a class. The right-click menu is built rather than filtered, so a future Qt cannot grow view-source or save-page back into it without somebody noticing in the code: back, forward, reload, open in a new tab when there is a link, -cut/copy/paste in a text field, print. +cut/copy/paste in a text field, print image when there is a picture under +the pointer, print page. Keys: Ctrl+W closes a tab, Alt+Left and Alt+Right navigate, Ctrl+P prints, Ctrl+Tab switches. Ctrl+T, Ctrl+N and Ctrl+L are deliberately unbound. @@ -232,8 +233,9 @@ One dialog, for lessons and worksheets alike: * **Pages** — all, or some: `2`, `1-3`, `1, 3, 5-6`, checked against the document with the reason given if wrong; * **Copies** — 1 to 50; -* **Colour** — colour or black and white, only where the printer's driver - has a grey mode, and asked for in that driver's own terms; +* **Color** — colour or black and white, only where the printer's driver + has a grey mode, and asked for in that driver's own terms. Since 0.2.6.3 + the preview turns grey too (below); * **Cancel** sends nothing; **Print** returns to the lesson once CUPS has the job, and a notification says where it went. A refused job keeps the preview open with CUPS's reason. @@ -280,6 +282,140 @@ background is left off, measured. Temporary PDFs live in the teacher's `$XDG_RUNTIME_DIR` and are removed when the preview closes. +### Black and white is shown as it prints (0.2.6.3) + +Printing through Elmer found that **Black and white** came out grey on +paper while the preview stayed in colour. 0.2.6.2 only told the driver: +the preview was the colour PDF, CUPS was given the colour PDF, and +`ColorModel=Grayscale` turned it grey inside Elmer's filters. + +So black and white is now made before the preview, not after it. When it +is chosen, the preview makes a grey copy of the document with +Ghostscript, shows that copy, and Print hands CUPS that same file — still +with `ColorModel=Grayscale`, so Elmer's generic PCL 6 driver prints it +with `pxlmono` as before rather than as a colour job that happens to be +grey. Choosing **Color** shows and prints the colour document again. + +Measured before building it (Ghostscript 10.05.1, in the lab): + +| | | +| --- | --- | +| a lesson page, a picture page, a leader guide, a fillable form | grey and only grey; same pages, page sizes and words; text still text; a filled-in form field and a drawn mark kept, in grey | +| against what Elmer would have printed | Ghostscript's grey rendering of the colour original and of the grey copy give the **same greys**: within 1 level in 255 on every filled area and picture. Small text can land a fraction of a pixel over — on a real lesson page, 12 of 32,754 8×8 blocks, all on one line of body text, in pairs of opposite sign. Elmer's driver *is* Ghostscript. (poppler's own grey differs on 7% of a coloured page, which is why the copy is not made with poppler) | +| how long | 0.05 s for a worksheet, 0.2 s for a text lesson page, 1.3 s for a full-page photograph, 2 s for 42 pages — and **4.4 s** for one lesson page with eleven full-size pictures, under the real Plasma session. `-dUseFastColor` saves 40% and changes the greys, so it is not used | +| a PDF Ghostscript cannot read | exits 1 and **still leaves a file behind** | + +From those: + +* the copy is made in the background, the preview says *Preparing black + and white…* and Print waits for it — four seconds is long enough to + look like a frozen window. It has a minute before it is given up on, + not the 20 s a page render has: a lesson of photographs on a slower + laptop is slow, not stuck. Cancel stops it at once; +* it is made once per document and kept, and each drawn page is kept, so + turning Color and Black and white back and forth is instant after the + first time, and stays on the page the teacher was looking at; +* a conversion is judged by its exit status and its page count, never by + whether a file appeared. If it fails the preview says so and offers + Color. It **never prints the colour file in its place**: the teacher + asked for black and white; +* pages are never turned (pdfwrite otherwise rotates a page to match its + text), and annotations are drawn into the page as they print, so no + later filter can draw them again in colour; +* a printer whose driver has no grey mode is not offered black and white, + and choosing one returns the preview to colour. + +`tools/lab/wonderink-print-check` shows a colourful lesson in colour, +turns it to black and white and back five times on page 2, and prints +page 2 twice: every grey preview is grey pixel for pixel, every colour +one is not, the grey copy is made once, and the job CUPS kept is +**byte-for-byte the file the preview showed**, grey on every page, sent +with `ColorModel=Grayscale` through `pxlmono`. The same for a worksheet, +a 50% top-left picture, a return to Color (which prints in colour through +`pxlcolor`), and Cancel. + +### Print image: a picture from inside a lesson (0.2.6.3) + +Right-clicking a picture in a lesson and choosing Print printed the whole +page around it. Some of Wonder Ink's pictures cannot be opened on their +own through the site at all, so a teacher had no way to give that +picture the picture layout 0.2.6.2 introduced. + +The right-click menu now says what it will print. It asks the engine's +own hit test what is under the pointer: + +| Under the pointer | Measured `mediaType` | The menu offers | +| --- | --- | --- | +| a picture (``, also inside a link, a frame, from `blob:` or `data:`) | Image | **Print image…** and **Print page…** | +| a `` | Canvas | **Print image…** and **Print page…** | +| words, empty space, a CSS background picture | None | **Print page…** | + +Print page is always there. Ctrl+P and the Print button print the page, +as before. + +**How the picture is taken** was measured before anything was built, on +a lab site with each kind of picture a lesson might have, a real +right-click on each, and the site logging every request: + +| | signed-in picture | hotlink-protected | one-time address | `blob:` / `data:` | another site's | canvas | WebP | +| --- | --- | --- | --- | --- | --- | --- | --- | +| engine's "download image" | ✓ | ✓ | **404** — fetched again | ✓ | ✓ | **nothing** | a file Qt cannot read | +| `page.download(url)` | ✓ | **403** — no Referer | **404** | – | ✓ | – | the same | +| `fetch()` from the page | ✓ | ✓ | ✓ | – | **refused** (CORS) | – | the same | +| draw it on a canvas | ✓ | ✓ | ✓ | ✓ | **refused** (tainted) | – | ✓ | +| **engine's "copy image"** | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | + +Only the engine's own **copy image** hands over the picture in every +case, and it is what Wonder Ink uses. It is the bitmap the page has +already decoded — full size, transparency kept, any format Chromium +reads (Qt itself cannot read WebP here) — and **it fetches nothing**: the +site saw no request at all. So a picture behind the teacher's sign-in +needs no sign-in again, and a picture the site hands out once is still +there. 0.01 to 0.05 s in the lab. + +It goes through the clipboard, which is the teacher's. So what is on it +is kept first and put back as soon as the picture arrives — whenever it +arrives, even after Cancel. Measured under the real Plasma session +(KWin, Wayland) with another program owning the clipboard: saved in +0.002 s, the picture in 0.016 s, and that other program then pasted its +own text again. + +The picture then goes into exactly the 0.2.6.2 picture preview — drawn on +white, capped at 300 dpi across Letter, Size, Position, Paper, Fill the +whole page, Color — named *Picture from* the lesson's title. + +**When it cannot be taken.** A picture that never loaded is still a +picture to the hit test, and the engine then copies nothing. After three +seconds the preview says *This picture could not be taken from the page* +and that nothing was printed, with Print off. It does **not** fall back +to printing the page; Print page is one right-click away and says what +it does. + +What it cannot do, and says nothing about because it cannot know: + +* **a CSS background picture** is not a picture to the engine's hit + test — Chrome's own menu has no "Save image" for one either. The menu + offers only Print page. If Wonder Ink's site draws its artwork this + way, that is the next thing to look at; nothing in the lab says it does; +* **a video** frame is not offered; +* **the teacher's clipboard is put back into Wonder Ink.** Under Wayland + with no clipboard manager — this session has none — the clipboard + belongs to whichever program last set it. After a Print image that is + Wonder Ink, so text copied in another program before it can still be + pasted while Wonder Ink is open, and is gone once Wonder Ink closes. + Measured in the lab session. Leaving the picture there instead would + lose it at once. + +`tools/lab/wonderink-print-check` runs a signed-in lesson site +(`tools/lab/wonderink-lesson-site.py`: session cookie, one-time +addresses, a second origin) and right-clicks for real: the words (Print +page only, and the page prints), a JPEG, a PNG, a transparent PNG, a +one-time picture, another site's, a `blob:`, a WebP, a canvas, a picture +inside a link, a JPEG at 50% top left in black and white, a picture that +never loaded, and Cancel. Each is judged on the job CUPS kept: where and +how large, no ink elsewhere, the corner mark there — and **no request to +the site** while it printed, and the teacher's clipboard theirs again. + `tools/lab/wonderink-print-check` runs all of this against the installed command in the lab, and judges every scenario by what CUPS actually received. `tests/test-classroom-printing.sh` covers the CUPS side at every