-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,191 additions
and
1,159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs) | ||
{ | ||
Q_UNUSED(pSelf) | ||
|
||
// Close a simulation | ||
|
||
if (PyTuple_Size(pArgs) > 0) { | ||
#include "pythonbegin.h" | ||
PythonQtInstanceWrapper *wrappedSimulation = PythonQtSupport::getInstanceWrapper(PyTuple_GET_ITEM(pArgs, 0)); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) | ||
#include "pythonend.h" | ||
|
||
if (wrappedSimulation != nullptr) { | ||
#ifdef GUI_SUPPORT | ||
// Close the simulation by closing its file, raising an exception if | ||
// we were unable to do so | ||
|
||
auto simulation = static_cast<SimulationSupport::Simulation *>(wrappedSimulation->_objPointerCopy); | ||
|
||
if (!Core::centralWidget()->closeFile(simulation->fileName())) { | ||
PyErr_SetString(PyExc_IOError, qPrintable(QObject::tr("unable to close the simulation"))); | ||
|
||
return nullptr; | ||
} | ||
#else | ||
// Close the simulation by asking our file and simulation managers | ||
// to umanage it | ||
|
||
auto simulation = static_cast<SimulationSupport::Simulation *>(wrappedSimulation->_objPointerCopy); | ||
QString fileName = simulation->fileName(); | ||
|
||
Core::FileManager::instance()->unmanage(fileName); | ||
SimulationManager::instance()->unmanage(fileName); | ||
#endif | ||
} | ||
} | ||
|
||
#include "pythonbegin.h" | ||
Py_RETURN_NONE; | ||
#include "pythonend.h" | ||
} |
Oops, something went wrong.