Status messages are kept for the session in a Messages window (Help menu, or click the status chip), newest first, with Copy all.
This commit is contained in:
1 parent
4c30d944f5
commit
aee47fca00
13 files changed
+271
-5
No files matched your search
@@ -687,6 +687,15 @@
|
||||
"joint.from_bodies_hint": "Každé vybrané těleso se přesune do vlastní nové komponenty a zůstane na místě.",
|
||||
"joint.one_body": "Oba výběry jsou na {body}. Druhý vyberte na jiném dílu.",
|
||||
"joint.one_component": "Tyto díly jsou tělesy jedné komponenty: {bodies}. Kloub pohybuje jednou komponentou vůči druhé, takže každý díl potřebuje vlastní komponentu.",
|
||||
"messages.ago_h": "před {n} h",
|
||||
"messages.ago_min": "před {n} min",
|
||||
"messages.ago_s": "před {n} s",
|
||||
"messages.chip_hint": "Klikněte pro všechny zprávy této relace",
|
||||
"messages.clear": "Vymazat",
|
||||
"messages.copy_all": "Kopírovat vše",
|
||||
"messages.menu": "Zprávy…",
|
||||
"messages.none": "Zatím žádné zprávy.",
|
||||
"messages.title": "Zprávy",
|
||||
"nav.touchpad.help": "Podržením Shift a pohybem ukazatele posouváte; podržením Alt/Option a pohybem otáčíte. Tlačítko myši není potřeba. Svislé posouvání přibližuje.",
|
||||
"nav.touchpad.label": "Touchpad",
|
||||
"nav.touchpad.orbit": "Otáčení (podržte Alt/Option a pohybujte; bez tlačítka myši)",
|
||||
|
||||
@@ -719,6 +719,15 @@
|
||||
"joint.from_bodies_hint": "Each picked body moves into a new component of its own and stays where it is.",
|
||||
"joint.one_body": "Both picks are on {body}. Pick the second one on another part.",
|
||||
"joint.one_component": "These parts are bodies of one component: {bodies}. A joint moves one component against another, so each part needs a component of its own.",
|
||||
"messages.ago_h": "{n} h ago",
|
||||
"messages.ago_min": "{n} min ago",
|
||||
"messages.ago_s": "{n} s ago",
|
||||
"messages.chip_hint": "Click for all messages of this session",
|
||||
"messages.clear": "Clear",
|
||||
"messages.copy_all": "Copy all",
|
||||
"messages.menu": "Messages…",
|
||||
"messages.none": "No messages yet.",
|
||||
"messages.title": "Messages",
|
||||
"motion.checked_to": "Checked to step {step} only: the check ran out of its work budget",
|
||||
"motion.collision": "{a} · {b}: steps {steps}",
|
||||
"motion.duration_hint": "seconds (empty: per step)",
|
||||
|
||||
@@ -704,6 +704,15 @@
|
||||
"joint.from_bodies_hint": "Ogni corpo selezionato viene spostato in un nuovo componente distinto, mantenendo la sua posizione.",
|
||||
"joint.one_body": "Entrambe le selezioni sono su {body}. Seleziona il secondo elemento su un'altra parte.",
|
||||
"joint.one_component": "Queste parti sono corpi di un unico componente: {bodies}. Un giunto muove un componente rispetto a un altro, quindi ogni parte richiede un componente distinto.",
|
||||
"messages.ago_h": "{n} h fa",
|
||||
"messages.ago_min": "{n} min fa",
|
||||
"messages.ago_s": "{n} s fa",
|
||||
"messages.chip_hint": "Fai clic per tutti i messaggi di questa sessione",
|
||||
"messages.clear": "Cancella",
|
||||
"messages.copy_all": "Copia tutto",
|
||||
"messages.menu": "Messaggi…",
|
||||
"messages.none": "Ancora nessun messaggio.",
|
||||
"messages.title": "Messaggi",
|
||||
"motion.checked_to": "Controllato solo fino al passo {step}: il controllo ha esaurito il limite di calcolo",
|
||||
"motion.collision": "{a} · {b}: passi {steps}",
|
||||
"motion.duration_hint": "secondi (vuoto: per passo)",
|
||||
|
||||
@@ -719,6 +719,15 @@
|
||||
"joint.from_bodies_hint": "選択した各ボディを、位置はそのままで専用の新しいコンポーネントに移動します。",
|
||||
"joint.one_body": "両方の選択が {body} 上にあります。2 つ目は別の部品で選択してください。",
|
||||
"joint.one_component": "これらの部品は 1 つのコンポーネントのボディです: {bodies}。ジョイントはコンポーネント同士を動かすため、部品ごとに専用のコンポーネントが必要です。",
|
||||
"messages.ago_h": "{n} 時間前",
|
||||
"messages.ago_min": "{n} 分前",
|
||||
"messages.ago_s": "{n} 秒前",
|
||||
"messages.chip_hint": "クリックするとこのセッションのすべてのメッセージを表示します",
|
||||
"messages.clear": "クリア",
|
||||
"messages.copy_all": "すべてコピー",
|
||||
"messages.menu": "メッセージ…",
|
||||
"messages.none": "まだメッセージはありません。",
|
||||
"messages.title": "メッセージ",
|
||||
"motion.checked_to": "ステップ {step} までしか確認していません: 確認の計算量の上限に達しました",
|
||||
"motion.collision": "{a} · {b}: ステップ {steps}",
|
||||
"motion.duration_hint": "秒 (空欄: ステップごと)",
|
||||
|
||||
@@ -719,6 +719,15 @@
|
||||
"joint.from_bodies_hint": "每个所选实体移入各自的新组件,位置保持不变。",
|
||||
"joint.one_body": "两次选择都在 {body} 上。请在另一个零件上选择第二个。",
|
||||
"joint.one_component": "这些零件是同一组件的实体:{bodies}。接头使一个组件相对另一个组件运动,因此每个零件都需要自己的组件。",
|
||||
"messages.ago_h": "{n} 小时前",
|
||||
"messages.ago_min": "{n} 分钟前",
|
||||
"messages.ago_s": "{n} 秒前",
|
||||
"messages.chip_hint": "点击查看本次会话的所有消息",
|
||||
"messages.clear": "清除",
|
||||
"messages.copy_all": "全部复制",
|
||||
"messages.menu": "消息…",
|
||||
"messages.none": "暂无消息。",
|
||||
"messages.title": "消息",
|
||||
"motion.checked_to": "仅检查到第 {step} 步:检查已用完其工作量上限",
|
||||
"motion.collision": "{a} · {b}:第 {steps} 步",
|
||||
"motion.duration_hint": "秒(留空:按步)",
|
||||
|
||||
@@ -284,6 +284,7 @@ fn dispatch(app: &mut SolveApp, ctx: &egui::Context, method: &str, p: &Value) ->
|
||||
}
|
||||
"engine.commands" => wrap(app.session.execute("engine.commands", &json!({})).map_err(|e| e.to_string())),
|
||||
"document.inspect" => wrap(app.session.execute("document.inspect", p).map_err(|e| e.to_string())),
|
||||
"ui.messages" => ok(crate::messages::control(app, p)),
|
||||
"ui.inspect" => ok(json!({
|
||||
"ui": serde_json::to_value(&app.ui).unwrap_or_default(),
|
||||
"visibility": app.session.visibility,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! The Help menu (the ? button on the application bar): Documentation (the online book), About
|
||||
//! SolidCraft (version, commit, build date, licences, attributions, fonts), the keyboard shortcuts
|
||||
//! (read only), and Report an Issue, which opens a local editable report draft.
|
||||
//! (read only), Messages (every status message of the run, #2763), and Report an Issue, which
|
||||
//! opens a local editable report draft.
|
||||
|
||||
use egui::{RichText, vec2};
|
||||
|
||||
@@ -43,7 +44,7 @@ pub fn diagnostics(app: &SolveApp) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
/// Run a Help menu item: `docs`, `about`, `shortcuts`, `report`, `crashes`.
|
||||
/// Run a Help menu item: `docs`, `about`, `shortcuts`, `messages`, `report`, `crashes`.
|
||||
pub fn run(app: &mut SolveApp, ctx: &egui::Context, item: &str) {
|
||||
app.help.menu = false;
|
||||
match item {
|
||||
@@ -54,6 +55,7 @@ pub fn run(app: &mut SolveApp, ctx: &egui::Context, item: &str) {
|
||||
app.keymap.read_only = true;
|
||||
}
|
||||
"crashes" => crate::crash_ui::open(app),
|
||||
"messages" => app.messages.open = true,
|
||||
"report" => {
|
||||
let dialog = app.dialog.clone();
|
||||
let error = dialog.as_ref().and_then(|d| d.error.clone()).or_else(|| app.preview.error.clone());
|
||||
@@ -74,6 +76,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context, anchor: egui::Pos2) {
|
||||
("docs", "Documentation"),
|
||||
("about", "About SolidCraft"),
|
||||
("shortcuts", "Keyboard Shortcuts"),
|
||||
("messages", "Messages…"),
|
||||
("report", "Report an Issue…"),
|
||||
("crashes", "Crash Reports…"),
|
||||
] {
|
||||
@@ -95,6 +98,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context, anchor: egui::Pos2) {
|
||||
}
|
||||
about(app, ctx);
|
||||
crate::crash_ui::show(app, ctx);
|
||||
crate::messages::show(app, ctx);
|
||||
}
|
||||
|
||||
fn about(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
|
||||
@@ -75,6 +75,7 @@ mod material_card_review;
|
||||
mod measurement_ui_tests;
|
||||
#[cfg(test)]
|
||||
mod menu_tests;
|
||||
pub mod messages;
|
||||
#[cfg(test)]
|
||||
mod pattern_arrow_tests;
|
||||
#[cfg(test)]
|
||||
@@ -326,6 +327,8 @@ pub struct SolveApp {
|
||||
pub keymap: keymap::Keymap,
|
||||
/// The Help menu and the About window.
|
||||
pub help: help::HelpState,
|
||||
/// Every status message of this run, for the Messages window ([`messages`], #2763).
|
||||
pub messages: messages::Messages,
|
||||
/// An editable local issue draft and optional captured app frame.
|
||||
pub issue_report: issue_report::ReportState,
|
||||
/// The Crash Reports window.
|
||||
@@ -452,6 +455,7 @@ impl SolveApp {
|
||||
sbox: shortcut_box::ShortcutBox::default(),
|
||||
keymap: keymap::Keymap::default(),
|
||||
help: help::HelpState::default(),
|
||||
messages: messages::Messages::default(),
|
||||
issue_report: issue_report::ReportState::default(),
|
||||
crashes: crash_ui::CrashUi::default(),
|
||||
updater: update::Updater::default(),
|
||||
@@ -1015,7 +1019,9 @@ impl SolveApp {
|
||||
}
|
||||
|
||||
pub fn set_status(&mut self, s: impl Into<String>, error: bool) {
|
||||
self.status = Some((s.into(), now_ms(), error));
|
||||
let (text, at) = (s.into(), now_ms());
|
||||
self.messages.push(&text, error, at);
|
||||
self.status = Some((text, at, error));
|
||||
}
|
||||
|
||||
pub fn open_path(&mut self, path: &str) {
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
//! Messages (#2763): every status message of this run, kept so it can be read and copied after
|
||||
//! the status chip has faded. Help › Messages… and a click on the chip open the window; the
|
||||
//! control channel reads them as `ui.messages`.
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use egui::{RichText, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::SolveApp;
|
||||
use crate::i18n::{format, tr};
|
||||
use crate::theme::Tokens;
|
||||
|
||||
/// Messages kept (the oldest go first).
|
||||
pub const KEEP: usize = 200;
|
||||
/// The longest message kept, in characters (a longer one is cut, saying so).
|
||||
const MAX_CHARS: usize = 4000;
|
||||
|
||||
/// One status message.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Message {
|
||||
pub text: String,
|
||||
pub error: bool,
|
||||
/// When it last came (ms since the Unix epoch).
|
||||
pub at: f64,
|
||||
/// How many times in a row it came.
|
||||
pub count: u32,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Messages {
|
||||
/// Oldest first.
|
||||
list: VecDeque<Message>,
|
||||
/// The window is open.
|
||||
pub open: bool,
|
||||
}
|
||||
|
||||
impl Messages {
|
||||
/// Keep a message: the same one again in a row counts up instead.
|
||||
pub fn push(&mut self, text: &str, error: bool, at: f64) {
|
||||
if let Some(last) = self.list.back_mut()
|
||||
&& last.text == text
|
||||
&& last.error == error
|
||||
{
|
||||
last.count = last.count.saturating_add(1);
|
||||
last.at = at;
|
||||
return;
|
||||
}
|
||||
let text =
|
||||
if text.chars().count() > MAX_CHARS { format!("{}…", text.chars().take(MAX_CHARS).collect::<String>()) } else { text.to_string() };
|
||||
self.list.push_back(Message { text, error, at, count: 1 });
|
||||
while self.list.len() > KEEP {
|
||||
self.list.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
/// Oldest first.
|
||||
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &Message> + ExactSizeIterator {
|
||||
self.list.iter()
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
self.list.clear();
|
||||
}
|
||||
|
||||
/// The messages as text, oldest first, one per line: how long ago, `error:` for errors, the
|
||||
/// text and the repeat count.
|
||||
pub fn as_text(&self, now: f64) -> String {
|
||||
self.list.iter().map(|m| format!("{}\t{}", ago(now, m.at), line(m))).collect::<Vec<_>>().join("\n")
|
||||
}
|
||||
}
|
||||
|
||||
/// A message as one line: `error:` for errors, and `(×n)` when it came more than once.
|
||||
fn line(m: &Message) -> String {
|
||||
let repeats = if m.count > 1 { format!(" (×{})", m.count) } else { String::new() };
|
||||
format!("{}{}{repeats}", if m.error { "error: " } else { "" }, m.text)
|
||||
}
|
||||
|
||||
/// How long ago `at` was, at `now` (both ms): seconds, minutes or hours.
|
||||
fn ago(now: f64, at: f64) -> String {
|
||||
let s = ((now - at) / 1000.0).max(0.0).floor();
|
||||
let (id, n) = if s < 60.0 {
|
||||
("messages.ago_s", s)
|
||||
} else if s < 3600.0 {
|
||||
("messages.ago_min", (s / 60.0).floor())
|
||||
} else {
|
||||
("messages.ago_h", (s / 3600.0).floor())
|
||||
};
|
||||
format(id, &[("n", &format!("{n:.0}"))])
|
||||
}
|
||||
|
||||
/// `ui.messages`: `clear?: true` empties the list, `open?: bool` shows or hides the window; the
|
||||
/// reply lists them, oldest first (`text`, `error`, `at` in ms since the epoch, `count`).
|
||||
pub fn control(app: &mut SolveApp, p: &Value) -> Value {
|
||||
if p.get("clear").and_then(Value::as_bool) == Some(true) {
|
||||
app.messages.clear();
|
||||
}
|
||||
if let Some(open) = p.get("open").and_then(Value::as_bool) {
|
||||
app.messages.open = open;
|
||||
}
|
||||
let list: Vec<Value> = app.messages.iter().map(|m| json!({"text": m.text, "error": m.error, "at": m.at, "count": m.count})).collect();
|
||||
json!({ "messages": list, "open": app.messages.open })
|
||||
}
|
||||
|
||||
/// The Messages window.
|
||||
pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
if !app.messages.open {
|
||||
return;
|
||||
}
|
||||
let t = Tokens::get();
|
||||
let now = crate::now_ms();
|
||||
let mut open = true;
|
||||
crate::frame::window(ctx, tr("messages.title"), crate::frame::Width::Normal)
|
||||
.id(egui::Id::new("sc_messages"))
|
||||
.open(&mut open)
|
||||
.default_size(vec2(460.0, 360.0))
|
||||
.show(ctx, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
let copy = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.copy_all")));
|
||||
crate::scenario::publish_handle("messages:copy", copy.rect.center());
|
||||
if copy.clicked() {
|
||||
ctx.copy_text(app.messages.as_text(now));
|
||||
}
|
||||
let clear = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.clear")));
|
||||
crate::scenario::publish_handle("messages:clear", clear.rect.center());
|
||||
if clear.clicked() {
|
||||
app.messages.clear();
|
||||
}
|
||||
});
|
||||
ui.separator();
|
||||
if app.messages.iter().len() == 0 {
|
||||
ui.label(RichText::new(tr("messages.none")).color(t.text_dim));
|
||||
return;
|
||||
}
|
||||
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
|
||||
for m in app.messages.iter().rev() {
|
||||
ui.horizontal_top(|ui| {
|
||||
ui.add_sized(vec2(70.0, 14.0), egui::Label::new(RichText::new(ago(now, m.at)).small().color(t.text_dim)));
|
||||
let text = RichText::new(line(m)).color(if m.error { t.error } else { t.text });
|
||||
ui.add(egui::Label::new(text).wrap().selectable(true));
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
if !open {
|
||||
app.messages.open = false;
|
||||
}
|
||||
// The ages tick on while it is open.
|
||||
ctx.request_repaint_after(std::time::Duration::from_secs(1));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{KEEP, Messages};
|
||||
|
||||
#[test]
|
||||
fn repeats_count_up_and_the_oldest_go_past_the_limit() {
|
||||
let mut m = Messages::default();
|
||||
m.push("Box done", false, 1000.0);
|
||||
m.push("Box done", false, 2000.0);
|
||||
m.push("`face` is required", true, 3000.0);
|
||||
let got: Vec<(&str, bool, u32)> = m.iter().map(|x| (x.text.as_str(), x.error, x.count)).collect();
|
||||
assert_eq!(got, [("Box done", false, 2), ("`face` is required", true, 1)]);
|
||||
assert_eq!(m.as_text(63_000.0), "1 min ago\tBox done (×2)\n1 min ago\terror: `face` is required");
|
||||
for i in 0..KEEP + 5 {
|
||||
m.push(&format!("message {i}"), false, 0.0);
|
||||
}
|
||||
assert_eq!(m.iter().len(), KEEP);
|
||||
assert_eq!(m.iter().next().map(|x| x.text.as_str()), Some("message 5"), "the oldest went first");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_very_long_message_is_cut() {
|
||||
let mut m = Messages::default();
|
||||
m.push(&"x".repeat(10_000), true, 0.0);
|
||||
assert_eq!(m.iter().next().map(|x| x.text.chars().count()), Some(4001));
|
||||
}
|
||||
|
||||
/// Status messages land in the list, a click on the chip and Help › Messages… open the window,
|
||||
/// and `ui.messages` reads, opens and clears it.
|
||||
#[test]
|
||||
fn status_messages_are_kept_and_the_window_opens() {
|
||||
use serde_json::json;
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.app.set_status("STEP export needs a solid body", true);
|
||||
h.app.set_status("Box done", false);
|
||||
h.frames(2);
|
||||
let chip = crate::scenario::handle_at("status:chip").expect("the chip is drawn");
|
||||
h.call("ui.click", json!({"x": chip.x, "y": chip.y}));
|
||||
h.frames(2);
|
||||
assert!(h.app.messages.open, "a click on the chip opens the messages");
|
||||
assert!(crate::scenario::handle_at("messages:copy").is_some());
|
||||
let out = h.call("ui.messages", json!({}));
|
||||
let texts: Vec<&str> = out["result"]["messages"].as_array().into_iter().flatten().filter_map(|m| m["text"].as_str()).collect();
|
||||
assert_eq!(texts, ["STEP export needs a solid body", "Box done"], "{out}");
|
||||
assert_eq!(out["result"]["messages"][0]["error"], true);
|
||||
let out = h.call("ui.messages", json!({"clear": true, "open": false}));
|
||||
assert_eq!((out["result"]["messages"].as_array().map(Vec::len), out["result"]["open"].as_bool()), (Some(0), Some(false)));
|
||||
crate::help::run(&mut h.app, &h.ctx.clone(), "messages");
|
||||
assert!(h.app.messages.open, "Help › Messages… opens it too");
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ pub fn open(app: &mut SolveApp, at: Pos2) -> bool {
|
||||
fn open_with(app: &mut SolveApp, proj: &Proj, at: Pos2) -> bool {
|
||||
let (rows, total) = rows_capped(app, proj, at);
|
||||
if rows.is_empty() {
|
||||
app.status = Some(("Nothing to select here".into(), crate::now_ms(), false));
|
||||
app.set_status("Nothing to select here", false);
|
||||
return false;
|
||||
}
|
||||
close(app);
|
||||
@@ -488,7 +488,7 @@ pub fn cycle_click(app: &mut SolveApp, proj: &Proj, at: Pos2) -> bool {
|
||||
let next = rows.iter().position(|r| crate::selection::same_item(&r.sel, &c.chosen)).map_or(0, |k| (k + 1) % rows.len());
|
||||
let Some(row) = rows.get(next).cloned() else { return false };
|
||||
apply(app, &row, false);
|
||||
app.status = Some((format!("{} ({} of {})", row.label, next + 1, rows.len()), crate::now_ms(), false));
|
||||
app.set_status(format!("{} ({} of {})", row.label, next + 1, rows.len()), false);
|
||||
remember(app, c.at, Some(row.sel));
|
||||
true
|
||||
}
|
||||
|
||||
@@ -2831,6 +2831,11 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let r = Rect::from_min_size(pos, galley.size() + vec2(16.0, 8.0));
|
||||
painter.rect_filled(r, 4.0, t.overlay);
|
||||
painter.galley(pos + vec2(8.0, 4.0), galley, t.text);
|
||||
// A click opens every message of the run, to read and copy (#2763).
|
||||
crate::scenario::publish_handle("status:chip", r.center());
|
||||
if ui.interact(r, egui::Id::new("sc_status_chip"), Sense::click()).on_hover_text(crate::i18n::tr("messages.chip_hint")).clicked() {
|
||||
app.messages.open = true;
|
||||
}
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_millis(500));
|
||||
} else {
|
||||
app.status = None;
|
||||
|
||||
@@ -63,6 +63,7 @@ Preferences (File › Preferences) hold the theme, the units of new designs, the
|
||||
visual style and autosave. Graphics › Colour vision gives the colours that carry a meaning (sketch
|
||||
states, axes, bends, analyses, icons) values for a weak red, green or blue sense: Protan, Deutan or
|
||||
Tritan. In a mode, the faces Draft and Accessibility Analysis mark as failing are striped too.
|
||||
Command messages and errors show for a few seconds in the status chip at the bottom left of the view. Click the chip, or choose Help › **Messages…**, for every message of the session: newest first, errors in red, each line selectable, with **Copy all** for a bug report.
|
||||
Help › Keyboard Shortcuts lists every key, and File › Keyboard
|
||||
Shortcuts changes them.
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.
|
||||
| `ui.screenshot` | `path?` | PNG of the window (needs a presented frame: a minimised or fully covered window answers at once with `hidden: true` and an error; use `ui.render`) |
|
||||
| `ui.render` | `path`, `width?`, `height?`, `grid?`, `axes?` | Render of the model with the current camera (no window needed), drawn on the app's GPU device with the viewport's pipelines (the reply's `renderer`: `gpu`, or `gpu-software` on a software adapter), in the window's theme (light or dark; `solidcraft-cli snapshot` keeps the light colours); cut by the section the viewport shows (`inspect.section`, an open Section Analysis dialog's preview, a sketch's Slice), with the cut face capped. The ground grid and the origin's axes are drawn as the window shows them (`ui.set` `showGrid` and `showOrigin`, `hiddenOrigin`); `grid` and `axes` (booleans) say otherwise for this render |
|
||||
| `ui.confirm` | `accept?`: bool | answers the Delete confirmation (shown when a delete takes other features with it or makes some fail); without `accept`, what it lists |
|
||||
| `ui.messages` | `clear?`: `true` (empty the list), `open?`: bool (show or hide the Messages window) | every status message of this run, oldest first (the last 200; a message repeated in a row is one entry with a `count`): `messages` `[{text, error, at, count}]` (`at` in ms since the Unix epoch), and whether the window is `open` (#2763) |
|
||||
| `ui.documents` | `action?`: `new`, `switch`, `close`, `quit`; `index?`; `force?` (close without asking); `answer?`: `save`, `dont_save`, `cancel` (answers "save changes?") | the open designs (tabs): names, unsaved flags, the active one, a pending "save changes?" prompt, whether a quit is asking |
|
||||
| `ui.file` | `path`; `insert?`: bool | starts an interactive background Open or Insert; poll `ui.inspect.file_busy` for completion; the window stays responsive |
|
||||
| `ui.home` | `open?`: bool; `sample?`: index | the start page: show or hide it, open a built-in sample (once built); returns `open` and the recent designs |
|
||||
|
||||
Reference in new issue
Block a user