forked from 1b-agent/opencadstudio-upstream
feat(automation): entity, block, publishing and REST operations from the fork
The operations docs/automation/API-SPEC.md (PR #1383) describes, brought over from huaninstratech/OpenCADStudio so the specification no longer runs ahead of the code: - entity CRUD: entities_create, entities_delete, entities_transform, entities_copy_to, and `where` filters on query - blocks and export: block_define, block_delete, a normalised wblock - publishing: layout_create, page_setup_set, plot (per_page included) - metadata: sysvar, xdata_set / xdata_get, file_identity - collections: group_create, selection_set_save / load - control plane: batch, events, view_focus, close - the REST transport: `--http <port>`, the /api/v1 routes and their OpenAPI 3 description - person-in-the-loop picks: user_select and getpoint, hosted by the GUI over the same REST routes, with on-screen pending signals Taken from the fork's commits b7a7ed80, 69396b42, 64f1cf6a, c3aafc8e, bb5a7bfa, 52317a5c, 50d293ba, b90e194f, 517c6397, 53a5c4c9, a49ac045, 37de5a46, a78b1822, 6d9aed2a, 33f522da, 5b5cafe2, 02a7e78d, 94df40dc, fd5bc14d, 485fac61 and 2c5fc994. Left out on purpose: 37de5a46 also removed the donation surface (the Patreon fetch, the donation prompt, the Start-page supporters rail, the DONATE command and its locale strings) and replaced the About dialog's call to action; that is the fork's own product decision and stays out. The fork's version bump and its unrelated IFC/BIM work are not part of this. Adapted while porting: the REST server and the GUI bridge are desktop-only and a template start is refused in the web build, so the wasm target still compiles; the two plot tests read the PDF through the shared stream helper, because exported streams are Flate-compressed; the benches set the new crosshair field; comments and docs describe each operation in its own terms rather than by another product's API names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
531ba44faa
commit
279a87418e
37 files changed
+8795
-82
No files matched your search
@@ -112,6 +112,26 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.pending_close = Some(crate::app::PendingClose::Tab(idx));
|
||||
return self.open_unsaved_dialog_window();
|
||||
}
|
||||
// Pending client interactive requests pinned to this drawing
|
||||
// can never be answered once the tab is gone — cancel them.
|
||||
let closing_tab_id = self.tabs.get(idx).map(|t| t.id);
|
||||
let pinned = self
|
||||
.control
|
||||
.get_point
|
||||
.as_ref()
|
||||
.map(|s| s.document_id)
|
||||
.filter(|&id| Some(id) == closing_tab_id)
|
||||
.or_else(|| {
|
||||
self.control
|
||||
.user_select
|
||||
.as_ref()
|
||||
.map(|s| s.document_id)
|
||||
.filter(|&id| Some(id) == closing_tab_id)
|
||||
});
|
||||
if pinned.is_some() {
|
||||
self.resolve_get_point(None);
|
||||
self.resolve_user_select(false);
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let tab_id = self.tabs.get(idx).map(|t| t.id);
|
||||
// This tab is closing for good — drop its autosave recovery copy.
|
||||
@@ -860,6 +880,13 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
if let Some(cmd) = self.command_line.submit() {
|
||||
return self.dispatch_command_or_suggest(&cmd);
|
||||
}
|
||||
// Empty Enter with a pending client user_select request is the
|
||||
// person's answer: hand the picked set back to the caller
|
||||
// before the repeat-last-command shortcut can fire.
|
||||
if self.control.user_select.is_some() {
|
||||
self.resolve_user_select(true);
|
||||
return Task::none();
|
||||
}
|
||||
// Empty Enter / Space with no active command repeats the
|
||||
// last dispatched command — same shortcut `CommandFinalize`
|
||||
// already implements, mirrored here so the trailing-space
|
||||
@@ -1009,6 +1036,12 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
if self.tabs[i].active_cmd.is_some() {
|
||||
self.feed_command(crate::command::StepInput::Enter)
|
||||
} else if self.control.user_select.is_some() {
|
||||
// Enter with no command active answers a pending client
|
||||
// user_select request — same contract as the command-line
|
||||
// empty-submit path above.
|
||||
self.resolve_user_select(true);
|
||||
Task::none()
|
||||
} else if let Some(cmd) = self.tabs[i].last_cmd.clone() {
|
||||
self.dispatch_command(&cmd)
|
||||
} else {
|
||||
@@ -1017,6 +1050,17 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
}
|
||||
|
||||
pub(super) fn on_command_escape(&mut self) -> Task<Message> {
|
||||
// Escape answers a pending client getpoint request first: no point.
|
||||
if self.control.get_point.is_some() {
|
||||
self.resolve_get_point(None);
|
||||
return Task::none();
|
||||
}
|
||||
// Escape answers a pending client user_select request before anything
|
||||
// else — the person on the screen is who the request is waiting for.
|
||||
if self.control.user_select.is_some() {
|
||||
self.resolve_user_select(false);
|
||||
return Task::none();
|
||||
}
|
||||
if self.ribbon.escape_extension() {
|
||||
return Task::none();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user