diff --git a/src/Python/PythonEmbed.cpp b/src/Python/PythonEmbed.cpp index 5a949f5db..933948556 100644 --- a/src/Python/PythonEmbed.cpp +++ b/src/Python/PythonEmbed.cpp @@ -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 diff --git a/src/Resources/application.qrc b/src/Resources/application.qrc index 12890a7e2..9d9885661 100644 --- a/src/Resources/application.qrc +++ b/src/Resources/application.qrc @@ -178,5 +178,6 @@ images/services/velohero.png images/services/polarflow.png images/services/sporttracks.png + python/library.py diff --git a/src/Resources/python/library.py b/src/Resources/python/library.py new file mode 100644 index 000000000..e02a2d19d --- /dev/null +++ b/src/Resources/python/library.py @@ -0,0 +1,14 @@ +# +# Python class library loaded when the interpreter +# is installed by PythonEmbed + +def __GCactivity(): + rd={} + for x in range(0,GC.seriesLast()): + if (GC.seriesPresent(x)): + rd[GC.seriesName(x)] = GC.series(x) + return rd + +# add to main GC entrypoint +GC.activity=__GCactivity + diff --git a/src/src.pro b/src/src.pro index e3becf7de..79e762ab4 100644 --- a/src/src.pro +++ b/src/src.pro @@ -922,5 +922,6 @@ DEFERRES += Core/RouteWindow.h Core/RouteWindow.cpp Core/RouteItem.h Core/RouteI ###==================== OTHER_FILES += Resources/web/Rider.js Resources/web/ride.js Resources/web/jquery-1.6.4.min.js \ - Resources/web/MapWindow.html Resources/web/StreetViewWindow.html Resources/web/Window.css + Resources/web/MapWindow.html Resources/web/StreetViewWindow.html Resources/web/Window.css \ + Resources/python/library.py Python/SIP/goldencheetah.sip