| 1395 | } |
| 1396 | |
| 1397 | bool mitk::nnInteractiveTool::SupportsUndo() const |
| 1398 | { |
| 1399 | if (!this->IsSessionRunning()) |
| 1400 | return false; |
| 1401 | |
| 1402 | try |
| 1403 | { |
| 1404 | auto pythonContext = m_Impl->GetPythonContext(); |
| 1405 | |
| 1406 | // supports_undo is a plain attribute on both local and remote sessions |
| 1407 | // (the remote one mirrors it from the server's capabilities), so this is a |
| 1408 | // local attribute read: no network call and no remote guard needed. |
| 1409 | pythonContext->Execute("nni_supports_undo = bool(getattr(session, 'supports_undo', False))\n"); |
| 1410 | const auto supported = pythonContext->GetVariableAsBool("nni_supports_undo").value_or(false); |
| 1411 | pythonContext->Execute("del nni_supports_undo\n"); |
| 1412 | |
| 1413 | return supported; |
| 1414 | } |
| 1415 | catch (const Exception& e) |
| 1416 | { |
| 1417 | MITK_WARN << "nnInteractive: could not read undo support: " << e.GetDescription(); |
| 1418 | return false; |
| 1419 | } |
| 1420 | } |
| 1421 | |
| 1422 | bool mitk::nnInteractiveTool::IsRemoteConnectionError(const std::string& message) const |
| 1423 | { |
no test coverage detected