forked from 1b-agent/opencadstudio-upstream
Fix V2/V3 messaging ABI-break
This commit is contained in:
1 parent
29c41a4041
commit
883e703b02
7 files changed
+179
-38
No files matched your search
@@ -313,6 +313,28 @@ impl OpenCADStudio {
|
||||
crate::plugin::external::with_manager(|mgr| {
|
||||
mgr.drain_requests(&mut host, &mut |_| {});
|
||||
});
|
||||
crate::plugin::external::with_manager(|mgr| {
|
||||
for line in mgr.drain_io() {
|
||||
// Skip internal runner/plugin/REPL trace noise when
|
||||
// verbose logging is enabled; real plugin stdout/stderr
|
||||
// and non-trace runner errors still pass through.
|
||||
if line.text.starts_with("[runner]")
|
||||
|| line.text.starts_with("[plugin] ")
|
||||
|| line.text.starts_with("[python-repl]")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let prefixed = format!("[{} {}] {}", line.plugin_id, line.source, line.text);
|
||||
match line.source {
|
||||
ocs_plugin_api::process::IoStream::Stderr => {
|
||||
self.command_line.push_error(&prefixed);
|
||||
}
|
||||
_ => {
|
||||
self.command_line.push_output(&prefixed);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ pub(crate) fn try_dispatch(app: &mut OpenCADStudio, tab: usize, cmd: &str) -> bo
|
||||
manager.dispatch(&mut host, cmd, |id| disabled.contains(id))
|
||||
})
|
||||
};
|
||||
|
||||
for id in result.dead_plugins {
|
||||
app.push_plugin_error(&format!("Plugin '{id}' process died; skipping dispatch"));
|
||||
}
|
||||
|
||||
@@ -218,8 +218,7 @@ fn external_card<'a>(
|
||||
disabled: bool,
|
||||
selected: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let failed_old_api =
|
||||
load_error.is_some() && p.api_version != ocs_plugin_api::API_VERSION;
|
||||
let failed_old_api = load_error.is_some() && !p.api_compatible();
|
||||
let (status, kind) = if loaded && disabled {
|
||||
(t!("Disabled"), StatusKind::Muted)
|
||||
} else if loaded {
|
||||
@@ -369,7 +368,9 @@ fn install_controls<'a>(
|
||||
.into()
|
||||
};
|
||||
let action = match selected_api {
|
||||
Some(api_version) if api_version == ocs_plugin_api::API_VERSION => {
|
||||
Some(api_version)
|
||||
if ocs_plugin_api::manifest::host_accepts_plugin_version(api_version) =>
|
||||
{
|
||||
pill_button(
|
||||
t!("Install"),
|
||||
Message::PluginInstall(repo_s.clone()),
|
||||
@@ -845,7 +846,9 @@ pub fn view_window<'a>(
|
||||
let compatible_tags = releases
|
||||
.iter()
|
||||
.filter(|release| {
|
||||
release.api_version == ocs_plugin_api::API_VERSION
|
||||
ocs_plugin_api::manifest::host_accepts_plugin_version(
|
||||
release.api_version,
|
||||
)
|
||||
})
|
||||
.map(|release| release.tag.clone())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Reference in new issue
Block a user