Compare commits

..
Author SHA1 Message Date
Martin BallandClaude Opus 5.5 e5484c3e04 fix(dialogs): Custom Properties footer, Recipient List headers, Special Characters shortcuts (part of #7982)
- Custom Properties: with no properties the list's own empty text is measured
  shorter than it is drawn, so the dialog was a row short and its footer was
  drawn over the Value box and the hint. The empty text is now a plain line.
- Recipient List: the columns shared the dialog's width, so six field names
  were cut to "First N", "Addre"; each column now takes a fixed share of control
  heights and the grid scrolls.
- Special Characters: the Shortcut key column took a third of the list and cut
  "Ctrl+Shift+..."; it now takes a fixed width.
Insert Chart type names, Page Setup margins, File Home/New names, the zoom label
and the Paragraph preview are craft widgets and need their own fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
2026-11-28 04:09:15 +00:00
Martin BallandClaude Opus 5.5 9fceecfafe fix(dialogs): draw previews at a sample size, not the icon side (part of #7977)
A Picture takes the icon side as its height unless given an extent, so the
Enclose, Define Bullet, Define List and Manage Styles previews shrank to
icons. Give them PictureSize::Sample(Large) (the style preview its device-pixel
size). Borders, Page Borders, Shading and Columns draw their previews inside
craft widgets (EdgePicker, the Columns dialog), so they need a craft-libs fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
2026-11-28 04:09:15 +00:00
Martin BallandClaude Opus 5.5 7f424faa32 fix(dialogs): draw captions for bare fields and radio groups (part of #7976)
A text box, number box, drop-down or radio group names itself for assistive
technology but draws no caption, so dialogs showed bare controls. Add
host::labelled (caption beside) and host::captioned (caption above), both over
craft's Field, which names the control by the same label, and use them where a
dialog drew a bare control: Envelopes, Labels, Table Properties, Custom
Properties, Index, Merge To, Insert Merge Field, Find Recipient, Rule If/Skip
If, Paste Special, Page Numbers, Line Numbers, Sort, Table Formula, Drop Cap,
Define List, Define Bullet, Enclose, Recipient List and the Borders/Shading
colour rows. The shared number helpers (count/length/percent/named field) label
every dialog that uses them (Hyphenation, Page Setup size, Insert Table...).

Partial: the Bookmark Sort by group is left to the Bookmark fix. Cross-reference and
Language lists get a plain caption line (a Field would rename the list), and the
Borders/Shading colour rows get plain text beside them (a Field would drop the
spoken colour). A group inside a titled section uses radios_in_section, and a box
after a same-named radio uses count_box, so no caption is drawn twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
2026-11-28 04:09:15 +00:00
25 changed files with 351 additions and 338 deletions
-1
View File
@@ -74,6 +74,5 @@ WordCraft is a Rust word processor targeting Microsoft Word parity, for macOS, W
- Attribution: `ATTRIBUTION.md`, a row per asset file, checked by `cargo xtask assets`. Icons are our own SVG set in `crates/ui-egui/icons/` (draw new icons there); sample content is in `crates/engine/src/sample.rs` and `cmd/design.rs`.
- Fonts and language data come from other repositories as optional build inputs: craft-fonts through `CRAFT_FONTS_DIR`, and craft-i18n's `language-data/` through `CRAFT_I18N_DIR` (pinned by `craft-i18n.rev`; CI checks it out). Without craft-i18n the app builds with fallback spelling and no pattern hyphenation, so proofing tests need it. Proprietary font requests use installed fonts or the open substitutes in `crates/fonts/src/word.rs`. Layout tests use the fixed fonts in `assets/fonts/` ([docs/testing.md](docs/testing.md)).
- Run: `cargo run --release -p wordcraft -- --sample --control 7981` starts the app with a sample document and the control channel. It takes JSON lines on `127.0.0.1:7981`: authenticate once per connection with the token from `~/.config/wordcraft/control-key.local-7981` (macOS: `~/Library/Application Support/WordCraft/`), `{"id":1,"method":"auth","params":{"token":"…"}}`, then send requests without a token; methods are in `crates/ui-egui/src/control.rs`, docs in `docs/control-protocol.md` (Token). Headless screenshots: `cargo run --release -p wordcraft-ui-egui --example ui_shot -- script.jsonl`. CLI: `wordcraft-cli convert|run|commands|parity`. MCP: `wordcraft-cli mcp --automation-read-root DIR --automation-write-root DIR` (both required; `--connect` is refused until the app confines its control channel, #3695), see `docs/mcp.md`.
- Headless column ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): `cargo xtask parity` marks a catalog feature `headless: yes` only when its command is in the engine registry that `wordcraft-cli` and the MCP server load (never a `ui.*` id). A missing feature takes its `no`/`partial` value and `reach:` (`window`, `os` or `engine-gap`) from `HEADLESS` in `crates/engine/src/catalog.rs`, or reads `unknown`. When a command lands, delete its mark; `headless_marks_are_current` fails on a stale one.
- Notes and progress: `plan/` is an optional gitignored notebook. Committed: `ROADMAP.md` (progress log), `docs/gaps.md`, `docs/roadmap.md`, `docs/target-app-parity.md`, `docs/architecture.md` and the parity checklists.
- Contributor credits: `docs/contributors.md`.
-11
View File
@@ -889,17 +889,6 @@ fn parity_markdown(p: &Value) -> String {
for t in p["tabs"].as_array().cloned().unwrap_or_default() {
s += &format!("| {} | {} | {} |\n", t["tab"].as_str().unwrap_or(""), t["live"], t["total"]);
}
let h = &p["headless"];
s += &format!(
"\n**Headless ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): {} yes, {} no (window {}, os {}, engine-gap {}), {} partial, {} unknown.** A feature is `headless: yes` when its command is in the engine registry that `wordcraft-cli` and the MCP server load, so every live feature above is `yes`; the missing ones carry the hand mark from `HEADLESS` in `crates/engine/src/catalog.rs`, or `unknown`.\n",
h["yes"],
h["no"]["window"].as_u64().unwrap_or(0) + h["no"]["os"].as_u64().unwrap_or(0) + h["no"]["engine-gap"].as_u64().unwrap_or(0),
h["no"]["window"],
h["no"]["os"],
h["no"]["engine-gap"],
h["partial"],
h["unknown"]
);
s += "\n## Missing\n\n";
for t in p["tabs"].as_array().cloned().unwrap_or_default() {
let m = t["missing"].as_array().cloned().unwrap_or_default();
+1 -137
View File
@@ -532,98 +532,6 @@ Tools|Templates|Templates and Add-ins|tools.templates
Tools|Views|Full Screen View|view.fullScreenView
";
/// RFC-0052 hand marks for catalog features with no engine command: `id|headless|reach|why`.
///
/// `headless` is `no` or `partial`, `reach` is `window` (needs a desktop window, dialog or
/// pointer), `os` (needs an OS or online service the engine doesn't wrap) or `engine-gap` (could
/// be an engine command, isn't one yet). `yes` is never written here: a feature is `yes` only when
/// its id is in the engine registry that `wordcraft-cli` and the MCP server load, and a mark on such
/// an id is stale (`headless_errors`). A missing feature with no mark is `unknown`.
pub const HEADLESS: &str = "\
tools.dictate|no|os|speech recognition service
insert.onlinePicture|no|os|online image search service
insert.model3d|no|engine-gap|3-D model files could be inserted by a command
insert.screenshot|no|os|screen capture of other windows
addins.get|no|os|add-in store service
insert.video|no|os|online video service
insert.inkEquation|no|window|drawn with a pen or pointer
draw.inkToMath|no|os|handwriting recognition service
review.translate|no|os|online translation service
review.blockAuthors|no|os|co-authoring service
view.readLayout|no|window|Read Mode window layout
";
/// One feature's RFC-0052 `headless:` value and, for `no`/`partial`, its `reach:` and reason.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Headless {
pub value: &'static str,
pub reach: Option<&'static str>,
pub why: &'static str,
}
const REACHES: [&str; 3] = ["window", "os", "engine-gap"];
/// Parsed `HEADLESS`-format marks: (id, value, reach, why). A malformed line is an error.
pub fn headless_marks(src: &'static str) -> Result<Vec<(&'static str, Headless)>, String> {
let mut out = Vec::new();
for line in src.lines().filter(|l| !l.trim().is_empty()) {
let f: Vec<&'static str> = line.splitn(4, '|').collect();
let [id, value, reach, why] = f[..] else {
return Err(format!("headless mark `{line}`: want `id|headless|reach|why`"));
};
if !matches!(value, "no" | "partial") {
return Err(format!("headless mark `{id}`: `{value}` is not `no` or `partial` (`yes` comes from the registry)"));
}
if !REACHES.contains(&reach) {
return Err(format!("headless mark `{id}`: reach `{reach}` is not window, os or engine-gap"));
}
if out.iter().any(|(m, _)| *m == id) {
return Err(format!("headless mark `{id}` is written twice"));
}
out.push((id, Headless { value, reach: Some(reach), why }));
}
Ok(out)
}
/// The `headless:` value of a catalog feature: `yes` when the engine registry has its id, else its
/// hand mark, else `unknown`.
pub fn headless_of(id: &str, live: bool, marks: &[(&'static str, Headless)]) -> Headless {
if live {
return Headless { value: "yes", reach: None, why: "" };
}
marks.iter().find(|(m, _)| *m == id).map(|(_, h)| *h).unwrap_or(Headless { value: "unknown", reach: None, why: "" })
}
/// Problems with the marks against the catalog and the registry's ids: unknown ids, and marks on
/// ids the engine registry has (they would hide a `yes`).
pub fn headless_errors(src: &'static str, catalog: &[(&str, &str, &str, &str)], live: impl Fn(&str) -> bool) -> Vec<String> {
let marks = match headless_marks(src) {
Ok(m) => m,
Err(e) => return vec![e],
};
let mut errs = Vec::new();
for (id, _) in &marks {
if !catalog.iter().any(|e| e.3 == *id) {
errs.push(format!("headless mark `{id}` is not a catalog id"));
} else if live(id) {
errs.push(format!("headless mark `{id}` is stale: the engine registry has it, so it is `yes`"));
}
}
errs
}
/// Headless counts in the RFC-0052 summary shape.
fn headless_summary(values: &[Headless]) -> Value {
let count = |v: &str| values.iter().filter(|h| h.value == v).count();
let no = |r: &str| values.iter().filter(|h| h.value == "no" && h.reach == Some(r)).count();
json!({
"yes": count("yes"),
"no": {"window": no("window"), "os": no("os"), "engine-gap": no("engine-gap")},
"partial": count("partial"),
"unknown": count("unknown"),
})
}
/// Catalog entries: (tab, group, feature, id).
pub fn entries() -> Vec<(&'static str, &'static str, &'static str, &'static str)> {
CATALOG
@@ -638,13 +546,9 @@ pub fn entries() -> Vec<(&'static str, &'static str, &'static str, &'static str)
/// Parity summary: per tab and overall, with the missing features.
pub fn parity(reg: &Registry) -> Value {
let e = entries();
let marks = headless_marks(HEADLESS).unwrap_or_default();
let mut values = Vec::with_capacity(e.len());
let mut tabs: Vec<(&str, usize, usize, Vec<String>)> = Vec::new();
for (tab, group, label, id) in &e {
let have = reg.get(id).is_some();
let h = headless_of(id, have, &marks);
values.push(h);
let t = match tabs.iter_mut().find(|t| t.0 == *tab) {
Some(t) => t,
None => {
@@ -660,8 +564,7 @@ pub fn parity(reg: &Registry) -> Value {
if have {
t.1 += 1;
} else {
let reach = h.reach.map(|r| format!(", reach: {r} ({})", h.why)).unwrap_or_default();
t.3.push(format!("{group} › {label} (`{id}`): headless: {}{reach}", h.value));
t.3.push(format!("{group} › {label} (`{id}`)"));
}
}
let live = tabs.iter().map(|t| t.1).sum::<usize>();
@@ -670,7 +573,6 @@ pub fn parity(reg: &Registry) -> Value {
"live": live,
"total": total,
"percent": if total == 0 { 0.0 } else { (live as f64 * 1000.0 / total as f64).round() / 10.0 },
"headless": headless_summary(&values),
"tabs": tabs.iter().map(|t| json!({"tab": t.0, "live": t.1, "total": t.2, "missing": t.3})).collect::<Vec<_>>(),
})
}
@@ -695,44 +597,6 @@ mod tests {
assert!(pct >= 90.4, "parity {pct}%");
}
#[test]
fn headless_marks_are_current() {
let reg = crate::cmd::registry();
let errs = headless_errors(HEADLESS, &entries(), |id| reg.get(id).is_some());
assert!(errs.is_empty(), "{errs:?}");
}
#[test]
fn headless_yes_comes_only_from_the_registry() {
let marks = headless_marks("a.b|no|window|pointer\n").unwrap();
assert_eq!(headless_of("a.b", true, &marks).value, "yes", "a live id is yes whatever the mark says");
assert_eq!(headless_of("a.b", false, &marks).reach, Some("window"));
assert_eq!(headless_of("c.d", false, &marks).value, "unknown");
assert!(headless_marks("a.b|yes|window|x\n").is_err(), "a hand-written yes is refused");
assert!(headless_marks("a.b|no|desk|x\n").is_err(), "reach must be window, os or engine-gap");
assert!(headless_marks("a.b|no\n").is_err());
assert!(headless_marks("a.b|no|os|x\na.b|partial|os|y\n").is_err(), "one mark per id");
}
#[test]
fn headless_errors_flag_stale_and_unknown_marks() {
let cat = [("T", "G", "F", "a.b"), ("T", "G", "H", "c.d")];
let errs = headless_errors("a.b|no|os|x\nz.z|no|os|y\n", &cat, |id| id == "a.b");
assert!(errs.iter().any(|e| e.contains("`a.b` is stale")), "{errs:?}");
assert!(errs.iter().any(|e| e.contains("`z.z` is not a catalog id")), "{errs:?}");
assert!(headless_errors("bad\n", &cat, |_| false).len() == 1);
}
#[test]
fn parity_counts_every_feature_once_in_the_headless_summary() {
let p = parity(&crate::cmd::registry());
let h = &p["headless"];
let n = |v: &Value| v.as_u64().unwrap_or(0);
let no = n(&h["no"]["window"]) + n(&h["no"]["os"]) + n(&h["no"]["engine-gap"]);
assert_eq!(n(&h["yes"]) + no + n(&h["partial"]) + n(&h["unknown"]), n(&p["total"]));
assert_eq!(n(&h["yes"]), n(&p["live"]), "every live feature is an engine command here");
}
#[test]
fn read_mode_view_menu_is_catalogued() {
let e = entries();
+11 -11
View File
@@ -6,10 +6,9 @@ use craft::ui::buttons::Button;
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, clicked};
use craft::ui::dialog::DialogId;
use craft::ui::display::{Picture, Text};
use craft::ui::form::FieldGroup;
use craft::ui::display::{Picture, PictureSize, Text};
use craft::ui::layout_components::Row;
use craft::ui::list::ThumbAspect;
use craft::ui::list::{ThumbAspect, ThumbSize};
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::primitives::{ContentPainterCx, TextureCache};
use craft::ui::runtime::env::Label;
@@ -20,7 +19,7 @@ use wordcraft_doc::props::Align;
use super::dialogs_insert::symbol::SymbolRequest;
use super::font::FontRequest;
use super::host::{Asks, ChildAnswer, WordForm, open_form};
use super::host::{Asks, ChildAnswer, WordForm, captioned, open_form};
use crate::WordApp;
/// The alignments the dialog offers: `para.defineBullet`'s `align` and their names.
@@ -183,6 +182,7 @@ impl DefineBulletForm {
}
},
)
.extent(PictureSize::Sample(ThumbSize::Large))
}
}
@@ -210,8 +210,8 @@ impl WordForm for DefineBulletForm {
});
let entries: Vec<Entry<String>> = ALIGNMENTS.iter().map(|(k, n)| Entry::new((*k).to_string(), Label::from(tl!(n)))).collect();
let current = if self.align.is_empty() { "left".to_string() } else { self.align.clone() };
FieldGroup::new(Label::from(tl!("Alignment:"))).show(ui, |ui, _| {
let group = RadioGroup::new(Label::from(tl!("Alignment:")), Bind::given(current.clone())).show(ui, |ui, _| {
let group = captioned(ui, Label::from(tl!("Alignment:")), |name, ui| {
RadioGroup::new(name, Bind::given(current.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
for e in &entries {
if let (Some(id), label) = (e.value(), e.label()) {
@@ -219,12 +219,12 @@ impl WordForm for DefineBulletForm {
}
}
});
});
if let Some(a) = group.output.value().cloned() {
self.align = a;
}
})
});
FieldGroup::new(Label::from(tl!("Preview"))).show(ui, |ui, _| {
if let Some(a) = group.and_then(|g| g.output.value().cloned()) {
self.align = a;
}
captioned(ui, Label::from(tl!("Preview")), |_, ui| {
self.preview().show(ui);
});
self.ch.chars().count() == 1
@@ -4,10 +4,11 @@ use craft::text::ui::columns::{ColumnsApply, TextColumns, TextColumnsDialog};
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel};
use craft::ui::dialog::DialogId;
use craft::ui::form::{Field, FieldGroup};
use craft::ui::form::Field;
use craft::ui::layout_components::Stack;
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::runtime::env::Label;
use craft::ui::sections::GroupBox;
use craft::ui::text::NumberField;
use egui::Ui;
use serde::{Deserialize, Serialize};
@@ -15,7 +16,7 @@ use serde_json::{Map, Value, json};
use super::{settled, word};
use crate::WordApp;
use crate::dialogs::host::{Asks, DialogHooks, Keyed, Settle, WordForm, open_with};
use crate::dialogs::host::{Asks, DialogHooks, Keyed, Settle, WordForm, captioned, open_with};
use crate::options::lengths;
use crate::widgets::font_box::{CatalogRef, font_picker};
@@ -104,14 +105,16 @@ impl WordForm for DropCapForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let enabled = self.position != "none";
Stack::new().show(ui, |ui, _| {
RadioGroup::new(word("Position"), Bind::bound(&mut self.position)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in [("none", "None"), ("dropped", "Dropped"), ("margin", "In margin")].into_iter().enumerate() {
cx.labelled(ui, at, word(l), SideLabel::new().layout(FieldLayout::After), Radio::new(v.to_string()));
}
});
captioned(ui, word("Position"), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.position)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in [("none", "None"), ("dropped", "Dropped"), ("margin", "In margin")].into_iter().enumerate() {
cx.labelled(ui, at, word(l), SideLabel::new().layout(FieldLayout::After), Radio::new(v.to_string()));
}
});
})
});
FieldGroup::new(word("Options")).show(ui, |ui, _| {
GroupBox::new(word("Options"), None).show(ui, |ui, _| {
if let Some(catalog) = self.catalog.get() {
Field::new(word("Font:")).show(ui, |ui, _| {
font_picker(word("Font:"), Bind::bound(&mut self.font), catalog, Bind::bound(&mut self.settings), &[], None)
@@ -546,7 +546,7 @@ fn special_table(ui: &mut Ui, form: &mut SymbolForm) -> bool {
let columns = vec![
ColumnSpec::new(glyph.clone(), Label::Empty, ColumnWidth::fill(0.5)),
ColumnSpec::new(name.clone(), word("Special Characters"), ColumnWidth::fill(2.0)),
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::fill(1.0)),
ColumnSpec::new(keys.clone(), word("Shortcut key:"), ColumnWidth::Controls(5.5)),
];
let positions: Vec<usize> = (0..SPECIAL.len()).collect();
let source = keyed(&positions, |at: &usize| *at);
+31 -12
View File
@@ -15,7 +15,7 @@ use egui::Ui;
use serde_json::Value;
use crate::WordApp;
use crate::dialogs::host::{DialogHooks, open_form, open_form_with};
use crate::dialogs::host::{DialogHooks, labelled, open_form, open_form_with};
mod page;
pub(crate) mod print;
@@ -92,11 +92,23 @@ pub(crate) fn points() -> LengthUnits {
LengthUnits::new(UnitKind::Points, UnitKind::Points, 96.0)
}
/// A whole-number field over `value` within `range`; true when the user changed it.
/// A whole-number field over `value` within `range`, with its caption; true when the user changed it.
pub(crate) fn count_field(ui: &mut Ui, label: &str, value: &mut u32, range: RangeInclusive<u32>, enabled: bool) -> bool {
labelled(ui, label.to_string(), |name, ui| count_box(ui, name, value, range.clone(), enabled)).unwrap_or(false)
}
/// `count_field` with no caption, named `label` for assistive technology: for a box that follows a radio carrying the
/// same words ("Start at:").
pub(crate) fn count_box(
ui: &mut Ui,
label: impl Into<craft::ui::runtime::env::Label>,
value: &mut u32,
range: RangeInclusive<u32>,
enabled: bool,
) -> bool {
let was = f64::from(*value);
let mut shown = Some(was);
NumberField::new(label.to_string(), Bind::bound(&mut shown)).range(f64::from(*range.start())..=f64::from(*range.end())).enabled(enabled).show(ui);
NumberField::new(label, Bind::bound(&mut shown)).range(f64::from(*range.start())..=f64::from(*range.end())).enabled(enabled).show(ui);
match shown {
Some(n) if n != was => {
*value = (n.round().max(0.0) as u32).clamp(*range.start(), *range.end());
@@ -116,8 +128,10 @@ pub(crate) fn length_field(ui: &mut Ui, label: &str, value: &mut f32, lengths: L
let was = f64::from(*value);
// The form takes the field's edit events, not a write into a copy that lives one pass: an edit that commits as the
// dialog files its OK (Enter, or a click on OK) reaches the form in the pass that files it.
let out = NumberField::length(label.to_string(), Bind::given(Some(was)), lengths).range(range).enabled(enabled).show(ui);
match edited(&out.edit.events) {
let out = labelled(ui, label.to_string(), |name, ui| {
NumberField::length(name, Bind::given(Some(was)), lengths).range(range.clone()).enabled(enabled).show(ui)
});
match out.as_ref().and_then(|out| edited(&out.edit.events)) {
Some(n) if n != was => {
*value = n as f32;
true
@@ -129,8 +143,8 @@ pub(crate) fn length_field(ui: &mut Ui, label: &str, value: &mut f32, lengths: L
/// A percentage field over `value`; true when the user changed it.
pub(crate) fn percent_field(ui: &mut Ui, label: &str, value: &mut f32, range: RangeInclusive<f64>) -> bool {
let was = f64::from(*value);
let out = NumberField::new(label.to_string(), Bind::given(Some(was))).range(range).unit("%").show(ui);
match edited(&out.edit.events) {
let out = labelled(ui, label.to_string(), |name, ui| NumberField::new(name, Bind::given(Some(was))).range(range.clone()).unit("%").show(ui));
match out.as_ref().and_then(|out| edited(&out.edit.events)) {
Some(n) if n != was => {
*value = n as f32;
true
@@ -151,11 +165,16 @@ pub(crate) fn named_field<K: NumberName + 'static>(
enabled: bool,
) {
let presets = vec![Entry::new(NumberPick::Choice(name.0.id()), name.1.to_string()).checked(matches!(*value, NamedOr::Named(_)))];
let mut field = NumberField::named(label.to_string(), Bind::bound(value)).range(range).presets(&presets).enabled(enabled);
if let Some(lengths) = lengths {
field = field.lengths(lengths);
}
field.show(ui);
labelled(ui, label.to_string(), |name, ui| {
{
let field = NumberField::named(name, Bind::bound(&mut *value)).range(range.clone()).presets(&presets).enabled(enabled);
match lengths {
Some(lengths) => field.lengths(lengths),
None => field,
}
}
.show(ui)
});
}
/// The number a named field holds, 0 while it holds its name.
@@ -14,7 +14,7 @@ use serde_json::{Value, json};
use wordcraft_engine::cmd::objects::fit_size;
use super::{DialogId, WordApp, length_field, percent_field, points};
use crate::dialogs::host::{Asks, FormHost, WordForm};
use crate::dialogs::host::{Asks, FormHost, WordForm, captioned, labelled};
// ---------------------------------------------------------------------------------------------
// Size
@@ -300,14 +300,22 @@ impl WordForm for PageNumbersForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let formats: Vec<Entry<String>> =
crate::dialogs_notes::FORMATS.iter().map(|(v, l)| Entry::new((*v).to_string(), tl!(l).to_string())).collect();
Select::new(tl!("Number format").to_string(), Bind::bound(&mut self.format), &formats).show(ui);
RadioGroup::new(tl!("Page numbering").to_string(), Bind::bound(&mut self.cont)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
cx.labelled(ui, 0, Label::from(tl!("Continue from previous section")), SideLabel::new().layout(FieldLayout::After), Radio::new(true));
cx.labelled(ui, 1, Label::from(tl!("Start at:")), SideLabel::new().layout(FieldLayout::After), Radio::new(false));
});
labelled(ui, tl!("Number format").to_string(), |name, ui| Select::new(name, Bind::bound(&mut self.format), &formats).show(ui));
captioned(ui, tl!("Page numbering").to_string(), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.cont)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
cx.labelled(
ui,
0,
Label::from(tl!("Continue from previous section")),
SideLabel::new().layout(FieldLayout::After),
Radio::new(true),
);
cx.labelled(ui, 1, Label::from(tl!("Start at:")), SideLabel::new().layout(FieldLayout::After), Radio::new(false));
});
})
});
super::count_field(ui, tl!("Start at:"), &mut self.start, 0..=100_000, !self.cont);
super::count_box(ui, tl!("Start at:"), &mut self.start, 0..=100_000, !self.cont);
true
}
@@ -12,7 +12,7 @@ use wordcraft_engine::cmd::mailings::{ENVELOPE_SIZES, LABEL_PRODUCTS};
use wordcraft_geom::Region;
use crate::WordApp;
use crate::dialogs::host::{Asks, WordForm, open_form};
use crate::dialogs::host::{Asks, WordForm, labelled, open_form};
// ---------------------------------------------------------------------------------------------
// Envelopes
@@ -72,10 +72,12 @@ impl WordForm for EnvelopeForm {
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let sizes: Vec<Entry<usize>> =
ENVELOPE_SIZES.iter().enumerate().map(|(i, (n, w, h))| Entry::new(i, envelope_label(n, *w, *h, &self.region))).collect();
TextField::new(tl!("Delivery address:"), Bind::bound(&mut self.delivery)).lines(4).show(ui);
labelled(ui, tl!("Delivery address:"), |name, ui| TextField::new(name, Bind::bound(&mut self.delivery)).lines(4).show(ui));
Checkbox::new(Bind::bound(&mut self.omit_return)).label(tl!("Omit")).show(ui);
TextField::new(tl!("Return address:"), Bind::bound(&mut self.ret)).lines(3).enabled(!self.omit_return).show(ui);
Select::new(tl!("Envelope size:"), Bind::bound(&mut self.size), &sizes).show(ui);
labelled(ui, tl!("Return address:"), |name, ui| {
TextField::new(name, Bind::bound(&mut self.ret)).lines(3).enabled(!self.omit_return).show(ui)
});
labelled(ui, tl!("Envelope size:"), |name, ui| Select::new(name, Bind::bound(&mut self.size), &sizes).show(ui));
self.ready()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -202,9 +204,9 @@ impl WordForm for LabelsForm {
Checkbox::new(Bind::bound(&mut self.recipients)).label(tl!("One label per recipient")).show(ui);
}
let per_recipient = self.has_recipients && self.recipients && !self.single;
TextField::new(tl!("Address:"), Bind::bound(&mut self.text)).lines(4).enabled(!per_recipient).show(ui);
labelled(ui, tl!("Address:"), |name, ui| TextField::new(name, Bind::bound(&mut self.text)).lines(4).enabled(!per_recipient).show(ui));
let products: Vec<Entry<usize>> = (0..LABEL_PRODUCTS.len()).map(|i| Entry::new(i, product_label(i, &self.region))).collect();
Select::new(tl!("Label:"), Bind::bound(&mut self.product), &products).show(ui);
labelled(ui, tl!("Label:"), |name, ui| Select::new(name, Bind::bound(&mut self.product), &products).show(ui));
let (rows, cols) = LABEL_PRODUCTS.get(self.product).map_or((1, 1), |p| (p.rows, p.cols));
let mut single = self.single;
let (mut row, mut col) = (self.row, self.col);
@@ -216,21 +218,17 @@ impl WordForm for LabelsForm {
Radio::new(1u8).label(tl!("Single label")).show(ui);
});
single = mode == 1;
if let Some(Some(v)) = NumberField::new(tl!("Row:"), Bind::given(Some(row as f64)))
.range(1.0..=rows.max(1) as f64)
.enabled(single_on)
.show(ui)
.value()
.copied()
if let Some(Some(v)) = labelled(ui, tl!("Row:"), |name, ui| {
NumberField::new(name, Bind::given(Some(row as f64))).range(1.0..=rows.max(1) as f64).enabled(single_on).show(ui)
})
.and_then(|out| out.value().copied())
{
row = v as usize;
}
if let Some(Some(v)) = NumberField::new(tl!("Column:"), Bind::given(Some(col as f64)))
.range(1.0..=cols.max(1) as f64)
.enabled(single_on)
.show(ui)
.value()
.copied()
if let Some(Some(v)) = labelled(ui, tl!("Column:"), |name, ui| {
NumberField::new(name, Bind::given(Some(col as f64))).range(1.0..=cols.max(1) as f64).enabled(single_on).show(ui)
})
.and_then(|out| out.value().copied())
{
col = v as usize;
}
@@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::{WordApp, count_field, named_field, number_or_zero, points};
use crate::dialogs::host::{Asks, WordForm};
use crate::dialogs::host::{Asks, WordForm, labelled};
/// The field's one name: a width that shares the text width out.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -96,7 +96,7 @@ impl WordForm for FormulaForm {
});
let functions: Vec<Entry<String>> = FORMULA_FUNCTIONS.iter().map(|n| Entry::new((*n).to_string(), (*n).to_string())).collect();
let mut picked = String::new();
Select::new(tl!("Paste function:").to_string(), Bind::bound(&mut picked), &functions).show(ui);
labelled(ui, tl!("Paste function:").to_string(), |name, ui| Select::new(name, Bind::bound(&mut picked), &functions).show(ui));
if !picked.is_empty() {
self.paste(&picked);
}
@@ -18,7 +18,7 @@ use serde_json::{Value, json};
use wordcraft_doc::section::LineNumberRestart;
use super::{WordApp, count_field, length_field, named_field, number_or_zero, points};
use crate::dialogs::host::{Asks, Filed, WordForm};
use crate::dialogs::host::{Asks, Filed, WordForm, captioned};
/// The field's one name: no limit on consecutive hyphens.
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -105,12 +105,14 @@ impl WordForm for LineNumbersForm {
length_field(ui, tl!("From text:"), &mut self.distance, lengths, 0.0..=22.0 * 72.0, on && !self.auto_distance);
count_field(ui, tl!("Count by:"), &mut self.count_by, 1..=100, on);
let opts = [("restartPage", tl!("Restart Each Page")), ("restartSection", tl!("Restart Each Section")), ("continuous", tl!("Continuous"))];
RadioGroup::new(tl!("Numbering:").to_string(), Bind::bound(&mut self.restart)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in opts.iter().enumerate() {
cx.labelled(ui, at, Label::from(*l), SideLabel::new().layout(FieldLayout::After), Radio::new((*v).to_string()));
}
});
captioned(ui, tl!("Numbering:").to_string(), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.restart)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, (v, l)) in opts.iter().enumerate() {
cx.labelled(ui, at, Label::from(*l), SideLabel::new().layout(FieldLayout::After), Radio::new((*v).to_string()));
}
});
})
});
true
}
@@ -444,6 +446,8 @@ impl WordForm for LanguageForm {
let which: Vec<usize> = (0..list.len()).collect();
let source = keyed(which.as_slice(), |i: &usize| *i);
let selection = at.map_or_else(|| Selection::new(Vec::new(), None, None), Selection::single);
// A plain caption, not a `Field`: the list keeps its own accessible name (#7976).
Text::new(Label::from(heading.to_string())).show(ui);
let shown = List::<usize>::new(Label::from(heading.to_string()))
.select(SelectMode::Single)
.selection(Bind::given(selection))
+11 -15
View File
@@ -22,7 +22,7 @@ use serde_json::{Value, json};
use wordcraft_doc::section::NumFormat;
use wordcraft_engine::cmd::lists::{LEVELS, caret_list, level_json, levels_of};
use super::dialogs_para::{color_row, pick, radios, srgba, word};
use super::dialogs_para::{color_row, pick, radios, radios_in_section, srgba, word};
use super::host::{Asks, ChildAnswer, WordForm, open_form};
use crate::WordApp;
use crate::colors::{AutoFace, ColorFieldEmpty, Palette};
@@ -282,7 +282,7 @@ impl ListForm {
Stack::new().show(ui, |ui, _| {
Text::new(word(tl!("Preview"))).show(ui);
Picture::painter(word(tl!("Preview")), ThumbAspect::new(5, 3), preview(rows.clone(), level))
.extent(PictureSize::Thumb(ThumbSize::Large))
.extent(PictureSize::Sample(ThumbSize::Large))
.show(ui);
});
});
@@ -599,7 +599,7 @@ fn choose(ui: &mut Ui, salt: &'static str, label: Label, options: &[(&str, &str)
/// A radio group over `options` setting `value`.
fn choose_radio(ui: &mut Ui, label: Label, options: &[(&str, &str)], value: &mut String) {
let current = index_of(options, value).unwrap_or(0);
if let Some((v, _)) = radios(ui, label, &labels(options), current).and_then(|at| options.get(at)) {
if let Some((v, _)) = radios_in_section(ui, label, &labels(options), current).and_then(|at| options.get(at)) {
*value = v.to_string();
}
}
@@ -829,6 +829,12 @@ mod tests {
assert_eq!(h.state_mut().run("list.define", json!({})).unwrap(), json!({"pending": "defineList"}));
h.run_steps(2);
// The sheet fills the Preview image's rect, which is larger than the 80 × 48 icon-side thumbnail it once
// shrank to (#7977).
let preview = egui_kittest::kittest::Queryable::get_by_role_and_label(&h, egui::accesskit::Role::Image, "Preview").rect();
assert!(preview.width() > 80.0 && preview.height() > 48.0, "{theme}: the preview is {preview:?}");
let is_sheet = |r: egui::Rect| (r.width() - preview.width()).abs() <= 2.0 && (r.height() - preview.height()).abs() <= 2.0;
let mut shapes = Vec::new();
collect_shapes(&h.output().shapes, &mut shapes);
@@ -836,11 +842,7 @@ mod tests {
let white_rects: Vec<_> = shapes
.iter()
.filter_map(|s| match s {
egui::Shape::Rect(r)
if r.fill == egui::Color32::WHITE && (r.rect.width() - 80.0).abs() <= 5.0 && (r.rect.height() - 48.0).abs() <= 5.0 =>
{
Some(r)
}
egui::Shape::Rect(r) if r.fill == egui::Color32::WHITE && is_sheet(r.rect) => Some(r),
_ => None,
})
.collect();
@@ -850,13 +852,7 @@ mod tests {
let stroke_rects: Vec<_> = shapes
.iter()
.filter_map(|s| match s {
egui::Shape::Rect(r)
if r.stroke.color == egui::Color32::from_gray(160)
&& (r.rect.width() - 80.0).abs() <= 5.0
&& (r.rect.height() - 48.0).abs() <= 5.0 =>
{
Some(r)
}
egui::Shape::Rect(r) if r.stroke.color == egui::Color32::from_gray(160) && is_sheet(r.rect) => Some(r),
_ => None,
})
.collect();
+32 -5
View File
@@ -14,6 +14,7 @@ use craft::theme::Srgba;
use craft::ui::choice::{Checkbox, Radio, RadioGroup};
use craft::ui::contract::{Bind, CollectionEvent, Entry, FieldLayout, Props as _, Show as _, ShowCollection as _, ShowContainer as _, SideLabel};
use craft::ui::dialog::DialogId;
use craft::ui::display::Text;
use craft::ui::form::Field;
use craft::ui::layout_components::{Row, Stack};
use craft::ui::patterns::form_dialogs::FormCx;
@@ -25,7 +26,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{Map, Value, json};
use wordcraft_doc::props::{Border, BorderStyle, Borders, Rgb, TabAlign, TabLeader, TabStop};
use super::host::{Asks, ChildAnswer, DialogHooks, Keyed, Settle, WordForm, open_form, open_with};
use super::host::{Asks, ChildAnswer, DialogHooks, Keyed, Settle, WordForm, captioned, open_form, open_with};
use crate::WordApp;
use crate::colors::{AutoFace, ColorFieldEmpty, Palette, color_field};
use crate::options::unit_kind;
@@ -60,6 +61,23 @@ pub(super) fn color_row(
}
}
/// `color_row` with `label` drawn beside it as plain text. Not a `Field`: its label scope would rename the split button
/// "Color:" and drop the colour it speaks ("Color: Automatic").
fn captioned_color_row(
ui: &mut Ui,
key: &'static str,
label: Label,
value: &mut String,
empty: &ColorFieldEmpty,
palette: &Palette,
asks: &mut Vec<Asks>,
) {
Row::new().show(ui, |ui, _| {
Text::new(label.clone()).show(ui);
color_row(ui, key, &label, value, empty, palette, asks);
});
}
/// A drop-down over `labels` under `label`, showing entry `current` (empty while it is `None`). The index of the entry
/// picked in this pass.
pub(super) fn pick(ui: &mut Ui, salt: &'static str, label: Label, labels: &[Label], current: Option<usize>, enabled: bool) -> Option<usize> {
@@ -72,9 +90,18 @@ pub(super) fn pick(ui: &mut Ui, salt: &'static str, label: Label, labels: &[Labe
.flatten()
}
/// A radio group over `labels` under `label`, entry `current` chosen. The index chosen in this pass, when it is
/// another one.
/// A radio group over `labels` under a caption `label`, entry `current` chosen. The index chosen in this pass, when it
/// is another one.
pub(super) fn radios(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
captioned(ui, label.clone(), |_, ui| radio_set(ui, label.clone(), labels, current)).flatten()
}
/// `radios` with no caption: for a group inside a section that already carries its title.
pub(super) fn radios_in_section(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
radio_set(ui, label, labels, current)
}
fn radio_set(ui: &mut Ui, label: Label, labels: &[Label], current: usize) -> Option<usize> {
let mut at = current;
RadioGroup::new(label, Bind::bound(&mut at)).show(ui, |ui, cx| {
for (i, text) in labels.iter().enumerate() {
@@ -481,7 +508,7 @@ fn lines(ui: &mut Ui, key: &'static str, l: &mut LineForm, area: SampleArea, fil
l.style = *style;
}
let automatic = ColorFieldEmpty::Automatic { label: word(tl!("Automatic")), value: "", face: AutoFace::One(srgba(Rgb(0, 0, 0))) };
color_row(ui, key, &word(tl!("Color:")), &mut l.color, &automatic, palette, asks);
captioned_color_row(ui, key, word(tl!("Color:")), &mut l.color, &automatic, palette, asks);
let names: Vec<Label> = WIDTHS.iter().map(|w| word(crate::i18n::fmt(tl!("{n} pt"), &[("n", &w.to_string())]))).collect();
let current = WIDTHS.iter().position(|w| *w == l.width);
if let Some(width) = pick(ui, "width", word(tl!("Width:")), &names, current, true).and_then(|at| WIDTHS.get(at)) {
@@ -540,7 +567,7 @@ impl WordForm for BordersForm {
Self::apply_to(ui, &mut self.whole_doc, word(tl!("This section")), word(tl!("Whole document")));
}
_ => {
color_row(ui, "fill", &word(tl!("Fill")), &mut self.fill, &ColorFieldEmpty::NoColor, &palette, asks);
captioned_color_row(ui, "fill", word(tl!("Fill")), &mut self.fill, &ColorFieldEmpty::NoColor, &palette, asks);
// The same sample as the Borders tab shows, without the lines and not editable.
let mut none = BorderEdges::default();
let area = if self.fill_to_text { SampleArea::Text } else { SampleArea::Paragraph };
@@ -1,6 +1,7 @@
use craft::behavior::{Mixed, Selection, keyed};
use craft::ui::contract::{Bind, Entry, SelectMode, Show as _, ShowCollection as _, ShowContainer as _};
use craft::ui::dialog::DialogId;
use craft::ui::display::Text;
use craft::ui::form::Field;
use craft::ui::list::{List, ListRow};
use craft::ui::patterns::form_dialogs::FormCx;
@@ -156,6 +157,7 @@ impl WordForm for CrossRefForm {
let source = keyed(&which, |i: &usize| *i);
let mut selection = self.selected.map_or_else(|| Selection::new(Vec::new(), None, None), Selection::single);
let targets = &self.targets;
Text::new(Label::from(tl!("For which item:").to_string())).show(ui);
let _ = List::new(Label::from(tl!("For which item:").to_string()))
.max_rows(8)
.select(SelectMode::Single)
@@ -20,7 +20,7 @@ use wordcraft_engine::cmd::references::FieldCode;
use super::sample::{LEADERS, leader_char, sample_card};
use crate::WordApp;
use crate::dialogs::host::{Asks, Filed, WordForm, open_form};
use crate::dialogs::host::{Asks, Filed, WordForm, captioned, labelled, open_form};
/// The tab leaders as drop-down entries (value, translated label).
pub(super) fn leaders() -> Vec<Entry<String>> {
@@ -104,18 +104,21 @@ impl WordForm for IndexForm {
fn body(&mut self, ui: &mut Ui, _cx: &mut FormCx<'_, '_>, asks: &mut Vec<Asks>) -> bool {
sample_card(tl!("Preview"), self.sample_lines(), self.right_align, leader_char(&self.leader)).show(ui);
let kind = RadioGroup::new(Label::from(tl!("Type:").to_string()), Bind::given(self.kind.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
Radio::new("indented".to_string()).label(Label::from(tl!("Indented").to_string())).show(ui);
Radio::new("runIn".to_string()).label(Label::from(tl!("Run-in").to_string())).show(ui);
});
let kind = captioned(ui, Label::from(tl!("Type:").to_string()), |name, ui| {
RadioGroup::new(name, Bind::given(self.kind.clone())).show(ui, |ui, _| {
Row::new().show(ui, |ui, _| {
Radio::new("indented".to_string()).label(Label::from(tl!("Indented").to_string())).show(ui);
Radio::new("runIn".to_string()).label(Label::from(tl!("Run-in").to_string())).show(ui);
});
})
});
if let Some(kind) = kind.output.value().cloned() {
if let Some(kind) = kind.and_then(|kind| kind.output.value().cloned()) {
self.kind = kind;
}
let columns =
NumberField::new(Label::from(tl!("Columns:").to_string()), Bind::given(Some(f64::from(self.columns)))).range(1.0..=4.0).show(ui);
if let Some(Some(n)) = columns.edit.value().cloned() {
let columns = labelled(ui, Label::from(tl!("Columns:").to_string()), |name, ui| {
NumberField::new(name, Bind::given(Some(f64::from(self.columns)))).range(1.0..=4.0).show(ui)
});
if let Some(Some(n)) = columns.and_then(|out| out.edit.value().cloned()) {
self.columns = n.round().clamp(1.0, 4.0) as u32;
}
Checkbox::new(Bind::bound(&mut self.right_align)).label(Label::from(tl!("Page numbers at the right margin").to_string())).show(ui);
+17 -14
View File
@@ -4,10 +4,10 @@
use craft::ui::choice::{Radio, RadioGroup};
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
use craft::ui::dialog::DialogId;
use craft::ui::display::Picture;
use craft::ui::display::{Picture, PictureSize};
use craft::ui::form::{Field, FieldGroup};
use craft::ui::layout_components::{Row, Stack};
use craft::ui::list::ThumbAspect;
use craft::ui::list::{ThumbAspect, ThumbSize};
use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::primitives::{ContentPainterCx, HAlign, PaintShape, StrokeColor, StrokeWidth, TextRun};
use craft::ui::runtime::env::Label;
@@ -17,7 +17,7 @@ use egui::{CornerRadius, Rect, Ui, pos2, vec2};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::host::{Asks, WordForm, open_form};
use super::host::{Asks, WordForm, captioned, open_form};
use crate::WordApp;
const PREVIEW_W: f32 = 110.0;
@@ -81,24 +81,27 @@ impl EncloseForm {
d.text(line, &TextRun::new(text.as_str()).role(role).align(HAlign::Center));
});
})
.extent(PictureSize::Sample(ThumbSize::Large))
}
}
/// A radio group over `value` whose options are `(id, label)`.
fn radios(ui: &mut Ui, name: &'static str, value: &mut String, options: &[(&'static str, &'static str)], enabled: bool, horizontal: bool) {
let group = RadioGroup::new(Label::from(name), Bind::given(value.clone())).enabled(enabled).show(ui, |ui, _| {
let items = |ui: &mut Ui| {
for (id, label) in options {
Radio::new((*id).to_string()).label(Label::from(tl!(*label))).enabled(enabled).show(ui);
let group = captioned(ui, Label::from(name), |name, ui| {
RadioGroup::new(name, Bind::given(value.clone())).enabled(enabled).show(ui, |ui, _| {
let items = |ui: &mut Ui| {
for (id, label) in options {
Radio::new((*id).to_string()).label(Label::from(tl!(*label))).enabled(enabled).show(ui);
}
};
if horizontal {
Row::new().show(ui, |ui, _| items(ui));
} else {
Stack::new().show(ui, |ui, _| items(ui));
}
};
if horizontal {
Row::new().show(ui, |ui, _| items(ui));
} else {
Stack::new().show(ui, |ui, _| items(ui));
}
})
});
if let Some(v) = group.output.value().cloned() {
if let Some(v) = group.and_then(|g| g.output.value().cloned()) {
*value = v;
}
}
+36 -28
View File
@@ -19,7 +19,7 @@ use craft::ui::sections::Section;
use craft::ui::style::TypeRole;
use craft::ui::text::{NumberField, TextField};
use super::host::{Asks, WordForm, open_form};
use super::host::{Asks, WordForm, captioned, labelled, open_form};
/// Opens the form dialog `name` when it is one of this file's: Table Properties (only with a table selection) or Custom
/// Properties.
@@ -49,14 +49,16 @@ fn flag(ui: &mut Ui, id: &'static str, label: String, value: &mut bool, enabled:
/// A radio group choosing one of `options` (key, label) into `value`.
fn choose(ui: &mut Ui, id: &'static str, label: String, value: &mut String, options: &[(&str, String)]) {
let chosen = RadioGroup::new(Label::from(label), Bind::given(value.clone())).id_salt(id).show(ui, |ui, _| {
Stack::new().show(ui, |ui, _| {
for (key, text) in options {
Radio::new((*key).to_string()).label(Label::from(text.clone())).show(ui);
}
});
let chosen = captioned(ui, Label::from(label), |name, ui| {
RadioGroup::new(name, Bind::given(value.clone())).id_salt(id).show(ui, |ui, _| {
Stack::new().show(ui, |ui, _| {
for (key, text) in options {
Radio::new((*key).to_string()).label(Label::from(text.clone())).show(ui);
}
});
})
});
if let Some(next) = chosen.output.value().cloned() {
if let Some(next) = chosen.and_then(|c| c.output.value().cloned()) {
*value = next;
}
}
@@ -240,14 +242,21 @@ impl WordForm for CustomPropertiesForm {
let rows: Vec<String> = self.props.iter().map(|p| format!("{} = {}", p.name, p.value)).collect();
let positions: Vec<usize> = (0..rows.len()).collect();
let mut selection = if self.selected < rows.len() { Selection::single(self.selected) } else { Selection::default() };
List::new(Label::from(tl!("Properties").to_string()))
.id_salt("props")
.max_rows(6)
.select(SelectMode::Single)
.allow_empty(true)
.empty(Label::from(tl!("This document has no custom properties.").to_string()))
.selection(Bind::bound(&mut selection))
.show_items(ui, &keyed(&positions, |at| *at), &mut |at, _| ListRow::new(rows.get(*at).cloned().unwrap_or_default()));
if rows.is_empty() {
// lean: craft's `List` measures its `.empty()` text shorter than it draws it, so the dialog is a row short and
// its footer is drawn over the last row (#7982). Show the text ourselves; drop this once craft-libs fixes
// `List`. The same latent overlap may hit the other `.empty()` users: bookmarks.rs:112/268, macros.rs:71,
// dialogs_refs/cross_ref.rs:165, dialogs_refs/sources.rs:311 and dialogs_review.rs:423.
Text::new(Label::from(tl!("This document has no custom properties.").to_string())).shade(Shade::Muted).show(ui);
} else {
List::new(Label::from(tl!("Properties").to_string()))
.id_salt("props")
.max_rows(6)
.select(SelectMode::Single)
.allow_empty(true)
.selection(Bind::bound(&mut selection))
.show_items(ui, &keyed(&positions, |at| *at), &mut |at, _| ListRow::new(rows.get(*at).cloned().unwrap_or_default()));
}
if let Some(at) = selection.items.first().copied()
&& at != self.selected
{
@@ -265,15 +274,16 @@ impl WordForm for CustomPropertiesForm {
self.delete();
}
});
let typed = TextField::new(Label::from(tl!("Name:").to_string()), Bind::given(self.name.clone()))
.id_salt("name")
.limit(wordcraft_engine::cmd::file::MAX_CUSTOM_NAME)
.show(ui);
if let Some(text) = typed.value().cloned() {
let typed = labelled(ui, Label::from(tl!("Name:").to_string()), |name, ui| {
TextField::new(name, Bind::given(self.name.clone())).id_salt("name").limit(wordcraft_engine::cmd::file::MAX_CUSTOM_NAME).show(ui)
});
if let Some(text) = typed.and_then(|out| out.value().cloned()) {
self.name = text;
}
let typed = TextField::new(Label::from(tl!("Value:").to_string()), Bind::given(self.value.clone())).id_salt("value").show(ui);
if let Some(text) = typed.value().cloned() {
let typed = labelled(ui, Label::from(tl!("Value:").to_string()), |name, ui| {
TextField::new(name, Bind::given(self.value.clone())).id_salt("value").show(ui)
});
if let Some(text) = typed.and_then(|out| out.value().cloned()) {
self.value = text;
}
if !self.message.is_empty() {
@@ -444,11 +454,9 @@ fn mixed_check(ui: &mut Ui, id: &'static str, label: String, key: &str, value: &
/// A length field over points, shown in the interface unit of `units`, within `lo..=hi` points.
fn length(ui: &mut Ui, id: &'static str, label: String, value: &mut f32, (lo, hi): (f32, f32), units: LengthUnits, enabled: bool) {
let mut points = Some(f64::from(*value));
NumberField::length(Label::from(label), Bind::bound(&mut points), units)
.id_salt(id)
.range(f64::from(lo)..=f64::from(hi))
.enabled(enabled)
.show(ui);
labelled(ui, Label::from(label), |name, ui| {
NumberField::length(name, Bind::bound(&mut points), units).id_salt(id).range(f64::from(lo)..=f64::from(hi)).enabled(enabled).show(ui)
});
if let Some(next) = points {
*value = next as f32;
}
+19 -1
View File
@@ -7,8 +7,9 @@
//! answer is inferred from side effects.
use craft::color_ui::ui::{ColorPickerDialog, ColorPickerTab};
use craft::ui::contract::Bind;
use craft::ui::contract::{Bind, FieldLayout, ShowContainer as _};
use craft::ui::dialog::{ChildDialog, DialogId, DialogResult, DialogStack, HeldAnswer, HeldOk, StackDialog, dialog_id};
use craft::ui::form::Field;
use craft::ui::patterns::form_dialogs::{AboutTab, FormButtons, FormCx, FormDialog, HostedAbout};
use craft::ui::runtime::env::Label;
use craft::ui::sections::FooterButton;
@@ -417,6 +418,23 @@ impl<F: WordForm> StackDialog for FormHost<F> {
}
}
/// `show` (given `label` to name its control, and the field's `Ui`) with `label` drawn beside the control. A text box,
/// number box or drop-down names itself but draws no caption, so every bare one in a dialog goes through here
/// (#7976). `None` when the field is not shown this pass.
pub(crate) fn labelled<R>(ui: &mut Ui, label: impl Into<Label>, show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
field(ui, FieldLayout::Beside, label.into(), show)
}
/// `labelled`, with the caption above the control: for a radio group or a preview, which has no box for a side label
/// to sit against (#7976).
pub(crate) fn captioned<R>(ui: &mut Ui, label: impl Into<Label>, show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
field(ui, FieldLayout::Above, label.into(), show)
}
fn field<R>(ui: &mut Ui, layout: FieldLayout, label: Label, mut show: impl FnMut(Label, &mut Ui) -> R) -> Option<R> {
Field::new(label.clone()).layout(layout).show(ui, |ui, _| show(label.clone(), ui)).inner
}
/// Opens `form` as a dialog, over `parent` when there is one.
pub(crate) fn open_form<F: WordForm>(app: &mut WordApp, parent: Option<DialogId>, form: F) -> DialogId {
let id = open_node(app, parent, FormHost::new(form, parent));
+10 -5
View File
@@ -22,7 +22,7 @@ use serde::Serialize;
use serde_json::{Value, json};
use wordcraft_engine::cmd::mailings::{FilterOp, FilterRule, SortKey};
use super::host::{DialogHooks, Settle, open_with};
use super::host::{DialogHooks, Settle, labelled, open_with};
use crate::WordApp;
/// The address parts Match Fields lists, with their keys in `mailings.matchFields`' `address`.
@@ -376,7 +376,7 @@ fn recipient_body(ui: &mut egui::Ui, d: &mut RecipientDraft, editing: &mut bool,
filter.only_merged = false;
}
Checkbox::new(Bind::bound(&mut filter.only_merged)).label(tl!("Show only records that will be merged")).enabled(order.is_some()).show(ui);
TextField::search(tl!("Find in list"), Bind::bound(&mut filter.find)).show(ui);
labelled(ui, tl!("Find in list:"), |name, ui| TextField::search(name, Bind::bound(&mut filter.find)).show(ui));
// The rows the grid shows, by real index: edits and removes go to the right record.
let fresh = visible_recipients(rows, order.as_deref(), &filter.find, filter.only_merged);
// A press that ends a cell's edit (one on the row's Remove part) completes its click on release, a pass later: the
@@ -394,7 +394,7 @@ fn recipient_body(ui: &mut egui::Ui, d: &mut RecipientDraft, editing: &mut bool,
let columns = fields
.iter()
.enumerate()
.map(|(j, f)| ColumnSpec::new(ColumnKey::index(j as u32), f.clone(), ColumnWidth::fill(1.0)).removable(tl!("Remove field"), can_remove))
.map(|(j, f)| ColumnSpec::new(ColumnKey::index(j as u32), f.clone(), ColumnWidth::Controls(6.0)).removable(tl!("Remove field"), can_remove))
.collect();
// The dialog body scrolls, and a collection owns its own scroll: the grid shows this many records and scrolls
// the rest itself.
@@ -530,11 +530,16 @@ fn filter_section(ui: &mut egui::Ui, fields: &[String], filter: &mut RecipientFi
let directions = [Entry::new(false, tl!("Ascending")), Entry::new(true, tl!("Descending"))];
for (i, (field, desc)) in filter.sort.iter_mut().enumerate() {
let label = tl!(if i == 0 { "Sort by" } else { "Then by" });
if let Some(f) = Select::new(label, Bind::given(field.clone()), &keys).id_salt(("sort", i)).show(ui).value().cloned() {
if let Some(f) = labelled(ui, label, |name, ui| Select::new(name, Bind::given(field.clone()), &keys).id_salt(("sort", i)).show(ui))
.and_then(|out| out.value().cloned())
{
*field = f;
}
let has_field = !field.is_empty();
if let Some(d) = Select::new(tl!("Order"), Bind::given(*desc), &directions).id_salt(("dir", i)).enabled(has_field).show(ui).value().copied() {
if let Some(d) =
labelled(ui, tl!("Order"), |name, ui| Select::new(name, Bind::given(*desc), &directions).id_salt(("dir", i)).enabled(has_field).show(ui))
.and_then(|out| out.value().copied())
{
*desc = d;
}
}
+16 -12
View File
@@ -15,7 +15,7 @@ use craft::ui::text::{NumberField, TextField};
use serde::{Deserialize, Serialize};
use serde_json::{Value, json};
use super::host::{Asks, DialogHooks, FormHost, Settle, WordForm, open_form, open_form_with, open_with};
use super::host::{Asks, DialogHooks, FormHost, Settle, WordForm, captioned, labelled, open_form, open_form_with, open_with};
use super::mailings::ADDRESS_PARTS;
use crate::WordApp;
@@ -115,7 +115,7 @@ impl WordForm for InsertMergeFieldForm {
} else if let (Some(name), _) = pick_name(ui, tl!("Fields:"), &self.fields, &self.field) {
self.field = name;
}
TextField::new(tl!("Field:"), Bind::bound(&mut self.field)).show(ui);
labelled(ui, tl!("Field:"), |name, ui| TextField::new(name, Bind::bound(&mut self.field)).show(ui));
!self.field.trim().is_empty()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -209,7 +209,7 @@ impl WordForm for FindRecipientForm {
Some(tl!("Find").into())
}
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
TextField::new(tl!("Find:"), Bind::bound(&mut self.text)).show(ui);
labelled(ui, tl!("Find:"), |name, ui| TextField::new(name, Bind::bound(&mut self.text)).show(ui));
!self.text.trim().is_empty()
}
fn commands(&self) -> Vec<(String, Value)> {
@@ -261,10 +261,12 @@ impl WordForm for MergeRecordsForm {
}
fn body(&mut self, ui: &mut egui::Ui, _cx: &mut FormCx<'_, '_>, _asks: &mut Vec<Asks>) -> bool {
let mut choice = self.choice;
RadioGroup::new(tl!("Records"), Bind::bound(&mut choice)).show(ui, |ui, _| {
Radio::new(0u8).label(tl!("All")).show(ui);
Radio::new(1u8).label(tl!("Current record")).show(ui);
Radio::new(2u8).label(tl!("From:")).show(ui);
captioned(ui, tl!("Records"), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut choice)).show(ui, |ui, _| {
Radio::new(0u8).label(tl!("All")).show(ui);
Radio::new(1u8).label(tl!("Current record")).show(ui);
Radio::new(2u8).label(tl!("From:")).show(ui);
})
});
self.choice = choice;
// Typing a number picks the range.
@@ -344,17 +346,19 @@ impl WordForm for MergeRuleForm {
}))
.show(ui);
if self.fields.is_empty() {
TextField::new(tl!("Field:"), Bind::bound(&mut self.field)).show(ui);
labelled(ui, tl!("Field:"), |name, ui| TextField::new(name, Bind::bound(&mut self.field)).show(ui));
} else {
let entries: Vec<Entry<String>> = self.fields.iter().map(|f| Entry::new(f.clone(), Label::from(f.clone()))).collect();
if let Some(f) = Select::new(tl!("Field:"), Bind::given(self.field.clone()), &entries).show(ui).value().cloned() {
if let Some(f) = labelled(ui, tl!("Field:"), |name, ui| Select::new(name, Bind::given(self.field.clone()), &entries).show(ui))
.and_then(|out| out.value().cloned())
{
self.field = f;
}
}
TextField::new(tl!("Equals:"), Bind::bound(&mut self.value)).show(ui);
labelled(ui, tl!("Equals:"), |name, ui| TextField::new(name, Bind::bound(&mut self.value)).show(ui));
if !skip {
TextField::new(tl!("Then insert:"), Bind::bound(&mut self.then)).show(ui);
TextField::new(tl!("Otherwise insert:"), Bind::bound(&mut self.els)).show(ui);
labelled(ui, tl!("Then insert:"), |name, ui| TextField::new(name, Bind::bound(&mut self.then)).show(ui));
labelled(ui, tl!("Otherwise insert:"), |name, ui| TextField::new(name, Bind::bound(&mut self.els)).show(ui));
}
self.params().is_some()
}
+10 -8
View File
@@ -8,7 +8,7 @@ use craft::ui::patterns::form_dialogs::FormCx;
use craft::ui::runtime::env::Label;
use serde::{Deserialize, Serialize};
use super::host::{Asks, WordForm, open_form};
use super::host::{Asks, WordForm, captioned, open_form};
use super::{Value, WordApp};
use egui::Ui;
use serde_json::json;
@@ -69,13 +69,15 @@ impl WordForm for PasteSpecialForm {
return true;
}
let formats = self.formats.clone();
RadioGroup::new(Label::from(tl!("Paste as:")), Bind::bound(&mut self.choice)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, f) in formats.iter().enumerate() {
let label = wordcraft_engine::cmd::paste::FORMATS.iter().find(|(id, _)| id == f).map(|(_, l)| *l).unwrap_or(f.as_str());
cx.labelled(ui, at, Label::from(tl!(label).to_owned()), SideLabel::new().layout(FieldLayout::After), Radio::new(at));
}
});
captioned(ui, Label::from(tl!("Paste as:")), |name, ui| {
RadioGroup::new(name, Bind::bound(&mut self.choice)).show(ui, |ui, _| {
Stack::new().show(ui, |ui, cx| {
for (at, f) in formats.iter().enumerate() {
let label = wordcraft_engine::cmd::paste::FORMATS.iter().find(|(id, _)| id == f).map(|(_, l)| *l).unwrap_or(f.as_str());
cx.labelled(ui, at, Label::from(tl!(label).to_owned()), SideLabel::new().layout(FieldLayout::After), Radio::new(at));
}
});
})
});
if let Some(f) = formats.get(self.choice) {
Text::new(Label::from(tl!("Result"))).show(ui);
+2 -2
View File
@@ -8,7 +8,7 @@ use craft::ui::contract::{
Bind, CollectionEvent, ColumnSpec, Entry, Props as _, SelectMode, Show as _, ShowCollection as _, ShowContainer as _, TooltipSpec, clicked,
};
use craft::ui::dialog::{Dialog, DialogId, DialogResult, DialogStack, StackDialog, dialog_id};
use craft::ui::display::{Picture, Shade, Text};
use craft::ui::display::{Picture, PictureSize, Shade, Text};
use craft::ui::form::Field;
use craft::ui::list::{List, ListRow};
use craft::ui::pickers::Select;
@@ -183,7 +183,7 @@ impl ManageStylesDialog {
if let Some((key, image)) = &self.preview {
let image = image.clone();
let make = move || image.clone();
Picture::new(label(tl!("Preview")), self.made, &make).revision(key.styles).show(ui);
Picture::new(label(tl!("Preview")), self.made, &make).revision(key.styles).extent(PictureSize::DevicePixels).show(ui);
}
Text::new(label(describe(&cur))).shade(Shade::Muted).show(ui);
let style = self.selected.clone();
+69
View File
@@ -2283,3 +2283,72 @@ fn modal_dialog_with_open_popup_does_not_shake_on_inside_click_but_shakes_on_out
let key2 = chrome::nudge_id(&h.ctx, id2);
assert!(h.ctx.data(|d| d.get_temp::<f64>(key2)).is_none(), "reopened dialog starts still");
}
/// #7976: a text box, number box, drop-down or radio group has an accessible name but draws no caption of its own;
/// the dialog must draw one beside or above it, or the field reads as a bare box.
#[test]
fn bare_fields_and_groups_draw_their_captions() {
use egui::accesskit::Role;
for (dialog, captions) in
[("envelopes", &["Delivery address", "Return address", "Envelope size"][..]), ("dropCap", &["Position", "Lines to drop"][..])]
{
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
for caption in captions {
let drawn = h.query_all(egui_kittest::kittest::By::new().role(Role::Label).label_contains(caption)).count();
assert!(drawn > 0, "{dialog} draws no caption \"{caption}\"");
}
}
}
/// #7976: a caption is drawn once. A group inside a titled section, or a box after a radio that says the same
/// words, must not repeat them as a second caption.
#[test]
fn captions_are_not_drawn_twice() {
use egui::accesskit::Role;
for (dialog, caption) in
[("trackChangesOptions", "Balloons"), ("trackChangesOptions", "Comments"), ("pageNumbers", "Start at"), ("tableSort", "My list has")]
{
let mut app = app_with("Lanterns");
if dialog == "tableSort" {
app.run("insert.table", json!({"rows": 3, "cols": 3})).unwrap();
}
let mut h = app_harness(app);
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
let drawn = h.query_all(egui_kittest::kittest::By::new().role(Role::Label).label_contains(caption)).count();
assert!(drawn <= 1, "{dialog} draws \"{caption}\" {drawn} times");
}
}
/// #7977: a preview picture is drawn at a sample size, not at the icon side it takes by default.
#[test]
fn dialog_previews_are_drawn_larger_than_a_control() {
use egui::accesskit::Role;
for dialog in ["enclose", "defineBullet"] {
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": dialog})).unwrap();
h.run_steps(6);
let preview = h.get_by_role_and_label(Role::Image, "Preview").rect();
let button = h.get_by_role_and_label(Role::Button, "Cancel").rect();
assert!(
preview.height() > 2.0 * button.height(),
"{dialog}: the preview is {}pt high beside a {}pt button",
preview.height(),
button.height()
);
}
}
/// #7982: Custom Properties' hint wraps inside the dialog instead of running under the Cancel button.
#[test]
fn custom_properties_hint_does_not_run_under_the_buttons() {
use egui::accesskit::Role;
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": "customProperties"})).unwrap();
h.run_steps(6);
let hint = h.get_by_label_contains("Text properties only").rect();
let cancel = h.get_by_role_and_label(Role::Button, "Cancel").rect();
let value = h.get_by_role_and_label(Role::TextInput, "Value:").rect();
assert!(!hint.intersects(cancel) && !value.intersects(cancel), "the hint {hint:?} or Value {value:?} overlaps Cancel {cancel:?}");
}
+12 -14
View File
@@ -32,37 +32,35 @@ Generated by `cargo xtask parity` (`wordcraft-cli parity --markdown`): the word-
| Editing | 41 | 41 |
| Tools | 7 | 7 |
**Headless ([RFC-0052](https://github.com/storytold/craft-contrib/blob/main/rfcs/0052-headless-reach.md)): 510 yes, 12 no (window 3, os 8, engine-gap 1), 0 partial, 0 unknown.** A feature is `headless: yes` when its command is in the engine registry that `wordcraft-cli` and the MCP server load, so every live feature above is `yes`; the missing ones carry the hand mark from `HEADLESS` in `crates/engine/src/catalog.rs`, or `unknown`.
## Missing
### Home
- Voice › Dictate (`tools.dictate`): headless: no, reach: os (speech recognition service)
- Voice › Dictate (`tools.dictate`)
### Insert
- Illustrations › Online Pictures (`insert.onlinePicture`): headless: no, reach: os (online image search service)
- Illustrations › 3D Models (`insert.model3d`): headless: no, reach: engine-gap (3-D model files could be inserted by a command)
- Illustrations › Screenshot (`insert.screenshot`): headless: no, reach: os (screen capture of other windows)
- Add-ins › Get Add-ins (`addins.get`): headless: no, reach: os (add-in store service)
- Media › Online Video (`insert.video`): headless: no, reach: os (online video service)
- Symbols › Ink Equation (`insert.inkEquation`): headless: no, reach: window (drawn with a pen or pointer)
- Illustrations › Online Pictures (`insert.onlinePicture`)
- Illustrations › 3D Models (`insert.model3d`)
- Illustrations › Screenshot (`insert.screenshot`)
- Add-ins › Get Add-ins (`addins.get`)
- Media › Online Video (`insert.video`)
- Symbols › Ink Equation (`insert.inkEquation`)
### Draw
- Convert › Ink to Math (`draw.inkToMath`): headless: no, reach: os (handwriting recognition service)
- Convert › Ink to Math (`draw.inkToMath`)
### Review
- Language › Translate (`review.translate`): headless: no, reach: os (online translation service)
- Protect › Block Authors (`review.blockAuthors`): headless: no, reach: os (co-authoring service)
- Language › Translate (`review.translate`)
- Protect › Block Authors (`review.blockAuthors`)
### Read Mode
- View › Layout (`view.readLayout`): headless: no, reach: window (Read Mode window layout)
- View › Layout (`view.readLayout`)
### Equation
- Tools › Ink Equation (`insert.inkEquation`): headless: no, reach: window (drawn with a pen or pointer)
- Tools › Ink Equation (`insert.inkEquation`)
+1 -7
View File
@@ -11,7 +11,7 @@ sonar.python.coverage.reportPaths=python-coverage.xml
# S4790 (weak hash): SHA-1 is a start-key and "SHA1/1K" checksum algorithm that ODF package
# encryption (ODF 1.3 Part 2 §4.16) names, and older office suites wrote it. It is needed to open
# those files, not chosen for new security: WordCraft writes a SHA-256 start key and checksum.
sonar.issue.ignore.multicriteria=odt_sha1,validate_py_paths
sonar.issue.ignore.multicriteria=odt_sha1
sonar.issue.ignore.multicriteria.odt_sha1.ruleKey=rust:S4790
sonar.issue.ignore.multicriteria.odt_sha1.resourceKey=crates/formats/src/odt/crypt.rs
@@ -22,9 +22,3 @@ sonar.issue.ignore.multicriteria.odt_sha1.resourceKey=crates/formats/src/odt/cry
# os_window, control-key). process_identity.rs is Windows-only (the taskbar AUMID) and cannot run
# on the Linux runner either.
sonar.coverage.exclusions=packaging/**,apps/wordcraft/src/main.rs,apps/wordcraft-cli/src/main.rs,apps/wordcraft/src/process_identity.rs
# S8707 (path traversal): the crates/validate *.py scripts are developer tools run by hand to
# regenerate checked-in files; reading and writing the paths given on their command line is
# their purpose, and nothing passes them untrusted input.
sonar.issue.ignore.multicriteria.validate_py_paths.ruleKey=pythonsecurity:S8707
sonar.issue.ignore.multicriteria.validate_py_paths.resourceKey=crates/validate/**/*.py