Skip to content

Layouts: pick a publication sheet's style from the New Layout menu - #874

Merged
deniial00 merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:feat/publication-style-menu
Oct 25, 2026
Merged

deniial00 merged 1 commit into
opengeos:mainfrom
elpidioassinaturas:feat/publication-style-menu

Conversation

@elpidioassinaturas

@elpidioassinaturas elpidioassinaturas commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Home › New Layout › Publication Layout made every sheet in the classic style. The other five styles from #742 were reachable only through the "style" parameter of layout.publication, so in the app they couldn't be picked at all. The five are banner, panel, editorial, modular and poster.

Each sheet in the menu (A4, A3 or A2, portrait or landscape) now opens a list of the six styles, classic first:

  • A style picked: the sheet is made in it, titled with the map's name as before.
  • Hover text: each style says what it looks like. For example, Panel says "The map at the left; the title, locator, legend, sources and reference in a panel at the right."
  • Figures: journal and thesis figures leave the style to their caption, so they are still made at once, with no submenu.

Choices in this PR

  • A submenu per sheet, not a style setting elsewhere. A sheet is still made from the menu with one click, and the six styles sit where the sheet is chosen. A remembered style or a dialog would add state for a one-off choice.
  • The style's default accent. The menu gives no accent, so each style uses its own: a deep brown, green or blue, as the command does by default. "accent" in layout.publication still picks another, and the user guide says so.
  • One list, checked from both sides.
    • PUBLICATION_STYLES in engine::cmd::layout names the styles, as PUBLICATION_PROFILES names the profiles.
    • An engine test runs layout.publication with each one.
    • The menu's names are tl! literals (publication_style), as the profiles' are, and a test checks them word for word against the engine's.
    • A style added to the engine without a literal still shows, under its English name.
  • The menu's run moved into publication_layout, shared by sheets and figures, unchanged: the title, the warnings notified, and the switch to the Publish tab.

Testing

  • a_publication_sheet_is_made_in_the_style_picked (kittest) goes through the real menu.
    • A sheet: it opens New Layout › Publication Layout › A4 portrait sheet and clicks Panel. A layout is added with the panel's box, titled with the map's name, the Publish tab is shown, and the menu closes.
    • A figure: Journal figure, 1 column is still made at once, with no title.
  • every_publication_style_is_named_by_a_literal (ui-egui) and every_publication_style_in_the_menu_is_taken (engine).
  • cargo xtask ci passes locally: fmt, clippy and 2,174 tests, none failing.

The new strings are in English only; i18n/*.tsv is left for the release translation.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Choose from six visual styles when creating a publication sheet: classic, banner, panel, editorial, modular, or poster. Figures continue to be created without a sheet style.
    • New sheets use the map name as their title, and layout warnings or errors are reported during creation.
  • Documentation
    • Updated the getting-started guide and layout guide with details about publication sheet styles and how to select them.

Home › New Layout › Publication Layout made every sheet in the classic style: the
other five (banner, panel, editorial, modular, poster) were reached only through
layout.publication's "style". Each sheet now opens a list of the six styles, each
saying on hover what it looks like; figures, which leave the style to their caption,
are still made at once.

- PUBLICATION_STYLES in the engine lists the styles by name, the default first; a
  test checks that layout.publication takes each.
- The menu's names are tl! literals, checked word for word against the engine's.
- A kittest test picks A4 portrait › Panel and a journal figure through the menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 20ef4123-d66a-47e7-8f32-d3bfa4ca57e4
Commits

Reviewing files that changed from the base of the PR and between 2aaa0f0 and 7e8ebd9.

Files selected for processing: 5
  • crates/engine/src/cmd/layout.rs
  • crates/engine/src/tests.rs
  • crates/ui-egui/src/ribbon.rs
  • docs/getting-started.md
  • docs/user-guide/layouts.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

The engine now exposes six publication styles. The ribbon offers those styles when creating sheet layouts and passes the selection to layout.publication. The changes also add tests and update the getting-started guide and user guide.

Changes: Publication sheet styles

Layer / File(s) Summary
Style options and validation
crates/engine/src/cmd/layout.rs, crates/engine/src/tests.rs
A public constant lists six style codes and display names. A test checks that each style is accepted and returned by layout.publication.
Sheet style selection and creation
crates/ui-egui/src/ribbon.rs, docs/getting-started.md, docs/user-guide/layouts.md
Sheet profiles now offer a submenu of six styles. The creation helper passes the selected style and map name to layout.publication, reports warnings or errors, and selects the Publish tab on success. UI tests and documentation cover the choices.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant RibbonMenu
  participant publication_layout
  participant layout_publication
  participant PublishTab
  RibbonMenu->>publication_layout: selected sheet profile and style
  publication_layout->>layout_publication: profile, style, and map title
  layout_publication-->>publication_layout: result and warnings
  publication_layout->>PublishTab: select on success
Loading

Possibly related issues

  • opengeos/RustGIS#682 — The changes add selectable styles to publication sheet creation, which is part of the requested publication layout workflow.
  • opengeos/RustGIS#748 — The changes add publication-sheet style choices and tests for creating styled sheets.

Possibly related PRs

  • opengeos/RustGIS#742 — This PR adds a public list and UI choices for the style IDs that the related PR added to layout.publication.

Suggested reviewers: giswqs

Merge Risk: Minimal · up to 7e8eb

The style-selection change is mergeable after normal checks; no actionable issue remains from this review.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. (3 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: selecting a publication sheet style from the New Layout menu.
Description check Passed The description includes a detailed Summary and Testing section that match the pull request objectives. The Related issue section is missing, but this is non-critical because no issue reference is pro…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes a detailed Summary and Testing section that match the pull request objectives. The Related issue section is missing, but this is non-critical because no issue reference is provided in the context.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. (3 skipped: 2 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit selects a sheet with care
Six styles appear in the menu there
The title joins the chosen page
Warnings and errors take the stage
Then Publish waits, a tidy hare!

Comment @coderabbitai help to get the list of available commands.

let (name, about) = publication_style(style).unwrap_or_else(|| (tl!(*name), ""));
if ui.button(name).on_hover_text(about).clicked() {
publication_layout(app, profile, Some(style));
ui.close();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small concerns (low confidence):

  1. ui.close() is called inside the nested submenu's ui. Depending on the egui version, it may close only the innermost submenu and leave the outer New Layout menu open. The old code closed from the outer menu's ui. The new test only checks that "Banner" (a submenu item) has gone, so it wouldn't catch this. Consider also asserting that "Publication Layout" is gone, and check how close behaves with nested menus.
  2. When publication_style returns None, about is "", and on_hover_text("") may show an empty tooltip. Consider applying the hover text only when about is non-empty.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR adds a style submenu for each publication sheet in the New Layout menu. It also moves the layout.publication call into a helper, publication_layout. I found no correctness, security or performance problems. I read the diff only. I did not build the code or run the tests.

Bugs

  • Low confidence: ui.close() now runs inside the nested submenu's ui (crates/ui-egui/src/ribbon.rs:1079). Depending on the egui version, it may close only the submenu and leave the outer New Layout menu open. The new test checks only that "Banner" is gone, so it wouldn't catch this. I posted this as an inline comment.

Security

  • None found.

Performance

  • None found.

Quality

  • Low confidence: when publication_style returns None, the fallback hover text is "". That may show an empty tooltip. This is covered in the same inline comment.
  • every_publication_style_in_the_menu_is_taken and every_publication_style_is_named_by_a_literal keep the engine's style list and the UI's tl! names in sync. This is a good guard.

AGENTS.md

  • Interface text uses tl!, and the new code has no unwrap outside tests. The new unwrap and panic! calls appear only in tests, which the rules allow.
  • The change doesn't add dependencies or assets, and it keeps the layering. It updates the docs.

Change size

Compared: the whole PR against main (merge base 2aaa0f0 to PR head 7e8ebd9)

Metric Value
Files changed 5 (0 added, 5 modified, 0 removed, 0 renamed)
Size before 1.31 MB (1,377,792 B)
Size after 1.32 MB (1,383,285 B)
Total size change +5.4 KB (+5,493 B)
File Before After Change
crates/ui-egui/src/ribbon.rs 205.8 KB 210.2 KB +4.4 KB
crates/engine/src/tests.rs 958.7 KB 959.1 KB +450 B
crates/engine/src/cmd/layout.rs 156.4 KB 156.7 KB +347 B
docs/user-guide/layouts.md 20.1 KB 20.3 KB +161 B
docs/getting-started.md 4.4 KB 4.4 KB +23 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-874/
Web app https://preview.rustgis.app/pr-874/app/
Commit 7e8ebd9

GitHub Pages takes a minute or two to publish a new commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants