Python GC.activity()

.. very basic API as we develop out, it just returns a dict
   for now. Need to expand to enable returning a list if
   compare mode is active (like R).

.. implemented in a new source file Resources/python/library.py
   which is loaded directly after the interpreter is loaded at
   startup.

.. also updated src.pro to add library.py and goldencheetah.sip
   to OTHER_FILES so they can be edited easily in QtCreator.
This commit is contained in:
Mark Liversedge
2017-12-09 19:52:59 +00:00
parent 76eaecab5a
commit 385b56ee47
4 changed files with 25 additions and 1 deletions

View File

@@ -87,6 +87,14 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
PyRun_SimpleString(stdOutErr.c_str()); //invoke code to redirect
// now load the library
QFile lib(":python/library.py");
if (lib.open(QFile::ReadOnly)) {
QString libstring=lib.readAll();
lib.close();
PyRun_SimpleString(libstring.toLatin1().constData());
}
// setup trapping of output
PyObject *pModule = PyImport_AddModule("__main__"); //create main module