Skip to content

Commit 23a3a9c

Browse files
committed
Looping over state example
1 parent 5f2ddd6 commit 23a3a9c

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
m1 = scirun_add_module("CreateLatVol")
2+
m2 = scirun_add_module("SetFieldDataToConstantValue")
3+
m3 = scirun_add_module("WriteField")
4+
5+
scirun_connect_modules(m1, 0, m2, 0)
6+
scirun_connect_modules(m2, 0, m3, 0)
7+
8+
for i in range(10):
9+
scirun_set_module_state(m2, "Value", i)
10+
scirun_set_module_state(m3, "Filename", "field%d.fld" % i)
11+
scirun_execute_all()
12+
13+
#scirun_force_quit() #crashes right now
14+
scirun_quit()
15+
scirun_execute_all()

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ void SCIRunMainWindow::closeEvent(QCloseEvent* event)
718718

719719
bool SCIRunMainWindow::okToContinue()
720720
{
721-
if (isWindowModified() && !Application::Instance().parameters()->isRegressionMode() && !quitAfterExecute_)
721+
if (isWindowModified() && !Application::Instance().parameters()->isRegressionMode() && !quitAfterExecute_ && !runningPythonScript_)
722722
{
723723
int r = QMessageBox::warning(this, tr("SCIRun 5"), tr("The document has been modified.\n" "Do you want to save your changes?"),
724724
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
@@ -988,6 +988,7 @@ void SCIRunMainWindow::setupPythonConsole()
988988
void SCIRunMainWindow::runPythonScript(const QString& scriptFileName)
989989
{
990990
#ifdef BUILD_WITH_PYTHON
991+
runningPythonScript_ = true;
991992
GuiLogger::Instance().logInfo("RUNNING PYTHON SCRIPT: " + scriptFileName);
992993
SCIRun::Core::PythonInterpreter::Instance().run_string("import SCIRunPythonAPI; from SCIRunPythonAPI import *");
993994
SCIRun::Core::PythonInterpreter::Instance().run_file(scriptFileName.toStdString());

src/Interface/Application/SCIRunMainWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public Q_SLOTS:
146146
boost::shared_ptr<class GuiActionProvenanceConverter> commandConverter_;
147147
boost::shared_ptr<class DefaultNotePositionGetter> defaultNotePositionGetter_;
148148
bool quitAfterExecute_;
149+
bool runningPythonScript_ = false;
149150

150151
Q_SIGNALS:
151152
void moduleItemDoubleClicked();

0 commit comments

Comments
 (0)