MCPcopy Create free account
hub / github.com/MITK/MITK / SupportsUndo

Method SupportsUndo

Modules/PythonSegmentation/src/mitknnInteractiveTool.cpp:1397–1420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1395}
1396
1397bool 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
1422bool mitk::nnInteractiveTool::IsRemoteConnectionError(const std::string& message) const
1423{

Callers 1

ApplyCapabilityGatingMethod · 0.80

Calls 5

IsSessionRunningMethod · 0.95
GetVariableAsBoolMethod · 0.80
GetPythonContextMethod · 0.45
ExecuteMethod · 0.45
GetDescriptionMethod · 0.45

Tested by

no test coverage detected