void PythonEditorWidget::run() { if (unsavedChanges_ && scriptFileName_.size() != 0) // save if needed save(); runAction_->setDisabled(true); util::OnScopeExit reenable([&]() { runAction_->setEnabled(true); }); PyInviwo::getPtr()->addObserver(this); if (!appendLog_) { clearOutput(); } app_->getInteractionStateManager().beginInteraction(); Clock c; c.start(); bool ok = script_.run(); c.tick(); if (ok) { LogInfo("Python Script Executed successfully"); } LogInfo("Execution time: " << c.getElapsedMiliseconds() << " ms"); app_->getInteractionStateManager().endInteraction(); PyInviwo::getPtr()->removeObserver(this); }
void PythonEditorWidget::run() { if (unsavedChanges_ && scriptFileName_.size() != 0) // save if needed save(); PythonExecutionOutputObservable::getPtr()->addObserver(this); clearOutput(); Clock c; c.start(); bool ok = script_.run(); c.tick(); if (ok) { LogInfo("Python Script Executed succesfully"); } LogInfo("Execution time: " << c.getElapsedMiliseconds() << " ms"); PythonExecutionOutputObservable::getPtr()->removeObserver(this); }