mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 08:59:55 +00:00
Python GC.athlete()
Basic proof of concept for CPP binding using SIP but with our own type conversion (to avoid overhead of SIP lib/deploy). Its far from perfect but will serve as a starting point. .. needed to fixup type conversion in goldencheetah.sip to convert returning QString as PyUnicode .. needed to fixup passing context when multi-threaded .. needed to fixup Bindings.h/cpp to offer new API
This commit is contained in:
@@ -103,7 +103,7 @@ PythonEmbed::PythonEmbed(const bool verbose, const bool interactive) : verbose(v
|
||||
}
|
||||
|
||||
// run on called thread
|
||||
void PythonEmbed::runline(QString line)
|
||||
void PythonEmbed::runline(Context *context, QString line)
|
||||
{
|
||||
PyGILState_STATE gstate;
|
||||
gstate = PyGILState_Ensure();
|
||||
@@ -116,6 +116,9 @@ void PythonEmbed::runline(QString line)
|
||||
threadid = PyLong_AsLong(ident);
|
||||
Py_DECREF(ident);
|
||||
|
||||
// add to the thread/context map
|
||||
contexts.insert(threadid, context);
|
||||
|
||||
// run and generate errors etc
|
||||
messages.clear();
|
||||
PyRun_SimpleString(line.toStdString().c_str());
|
||||
|
||||
Reference in New Issue
Block a user