mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 03:11:47 +00:00
Add support for runtime error status in plugins
Distinguish a loaded plugin whose capability errored (RuntimeError, warn-styled, stays checked) from a load-time Error. Status now derives via resolve_plugin_status(); enum ordinal keeps dialog sort priority. Unloading clears stale errors.
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Slic3r
|
||||
// IMPORTANT: ordinal order is the Plugins dialog Status sort priority.
|
||||
Activated,
|
||||
Error,
|
||||
RuntimeError,
|
||||
Inactive,
|
||||
Loading
|
||||
};
|
||||
@@ -21,11 +22,28 @@ namespace Slic3r
|
||||
{
|
||||
case PluginStatus::Activated: return "Activated";
|
||||
case PluginStatus::Error: return "Error";
|
||||
case PluginStatus::RuntimeError: return "RuntimeError";
|
||||
case PluginStatus::Inactive: return "Inactive";
|
||||
case PluginStatus::Loading: return "Loading";
|
||||
}
|
||||
|
||||
return "Inactive";
|
||||
}
|
||||
|
||||
// why: a plugin whose module is live but whose catalog carries an error is a
|
||||
// RUNTIME fault (e.g. a capability rejected at register time) - it stays
|
||||
// loaded/checked and is only flagged, distinct from a load-time Error where
|
||||
// the module never came up. Loading wins over both so an in-flight reload
|
||||
// never flashes an error.
|
||||
inline PluginStatus resolve_plugin_status(bool loading, bool has_error, bool is_loaded)
|
||||
{
|
||||
if (loading)
|
||||
return PluginStatus::Loading;
|
||||
if (has_error)
|
||||
return is_loaded ? PluginStatus::RuntimeError : PluginStatus::Error;
|
||||
if (is_loaded)
|
||||
return PluginStatus::Activated;
|
||||
return PluginStatus::Inactive;
|
||||
}
|
||||
}
|
||||
} // namespace Slic3r::GUI
|
||||
|
||||
Reference in New Issue
Block a user