Commit 6961b47b authored by Clinton Stimpson's avatar Clinton Stimpson
Browse files

BUG: Do wait on GUI thread, not python thread.

parent b2748280
......@@ -215,7 +215,25 @@ QtTesting_wait(PyObject* /*self*/, PyObject* args)
return NULL;
}
pqEventDispatcher::processEventsAndWait(ms);
if(Instance && QThread::currentThread() != QApplication::instance()->thread())
{
QMetaObject::invokeMethod(Instance, "threadWait", Qt::QueuedConnection,
Q_ARG(int, ms) );
if(!Instance->waitForGUI())
{
PyErr_SetString(PyExc_ValueError, "error waiting");
return NULL;
}
}
else if(QThread::currentThread() == QApplication::instance()->thread())
{
pqPythonEventSource::wait(ms);
}
else
{
PyErr_SetString(PyExc_AssertionError, "pqPythonEventSource not defined");
return NULL;
}
return Py_BuildValue(const_cast<char*>(""));
}
......@@ -561,3 +579,14 @@ QString pqPythonEventSource::invokeMethod(QString& object, QString& method)
return ret.toString();
}
void pqPythonEventSource::threadWait(int ms)
{
this->wait(ms);
this->guiAcknowledge();
}
void pqPythonEventSource::wait(int ms)
{
pqEventDispatcher::processEventsAndWait(ms);
}
......@@ -52,6 +52,7 @@ public:
static void setProperty(QString& object, QString& prop, const QString& value);
static QStringList getChildren(QString& object);
static QString invokeMethod(QString& object, QString& method);
static void wait(int ms);
protected:
virtual void run();
......@@ -61,6 +62,7 @@ protected slots:
void threadSetProperty();
void threadGetChildren();
void threadInvokeMethod();
void threadWait(int);
private:
class pqInternal;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment