[Paraview] troubles with pipeline asynchronous update

Biddiscombe, John A. biddisco at cscs.ch
Tue Feb 7 11:35:06 EST 2012


Probably not safe, you need to update the pipeline on the main paraview gui thread

  if (this->Internals->TcpNotificationSocket) {
    this->connect(this->Internals->TcpNotificationSocket, 
      SIGNAL(readyRead()), SLOT(onNotified()), Qt::QueuedConnection);
    this->Internals->TcpNotificationServer->close();
  }

Note use of Qt::QueuedConnection - in the panel/other handler you can then call update. This should ensure that you don't call update inside a thread whilst paraview is doing an update already somewhere else.

JB

-----Original Message-----
From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org] On Behalf Of Nadir Raimondo
Sent: 07 February 2012 17:13
To: paraview at paraview.org
Subject: [Paraview] troubles with pipeline asynchronous update

Hi all,

I'm developing a GUI based on Qt+ParaView 3.10.0 to control a CNC acquisition system using Paraview builtin server. I have written a plugin that waits until new data is available, this process may require a lot of time; to avoid to block the entire interface I update the pipeline, which contains the plugin, from a QThread like so:

*** SourceUpdateTask.h ***

class SourceUpdateTask : public QRunnable{
public:
     SourceUpdateTask(const QString& id, pqPipelineSource* source);
     virtual ~SourceUpdateTask();

     void run();
protected:
     QString m_id;
     pqPipelineSource *m_source;
};

*** SourceUpdateTask.cpp ***

SourceUpdateTask::SourceUpdateTask(const QString& id, pqPipelineSource*
source): m_id(id), m_source(source) {}
SourceUpdateTask::~SourceUpdateTask() {}

void SourceUpdateTask::run(){
     m_source->updatePipeline();
}

In this way the interface remains functional (it is possible to resize and repaint it and the pqStatusBar receives the progress event
correctly) but it seems that each other qt signals are not processed (all qt widgets are blocked) as if the updatePipeline function locked the qt event loop. At the end of the function the interface return to work correctly.

Can anyone tell me if it is "safe" to update pipelines in this way. Is there another way to do an asynchronous update?

Thanks in advance,
Nadir
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview


More information about the ParaView mailing list