[Paraview] Browsing server files from plugin

Nehme Bilal nbilal at mirarco.org
Wed Feb 11 09:41:53 EST 2009


Hi,

to get the active server, look a this example:

pqServer* PrismCore::getActiveServer() const
{
   pqApplicationCore* core = 
pqApplicationCore::instance();
   pqServerManagerSelection sels = 
*core->getSelectionModel()->selectedItems();
   pqPipelineSource* source = 0;
   pqServer* server=0;
   pqOutputPort* outputPort=0;
   pqServerManagerModelItem* item = 0;
   pqServerManagerSelection::ConstIterator iter = 
sels.begin();

   item = *iter;
   source = dynamic_cast<pqPipelineSource*>(item);
  
   if(source)
     {
     server = source->getServer();
     }
   else
     {
     outputPort=dynamic_cast<pqOutputPort*>(item);
     if(outputPort)
       {
       server= outputPort->getServer();
       }
     else
       {
       server = dynamic_cast<pqServer*>(item);
       }
     }
   return server;
}

You need at least a pqServerManagerModelItem to use this 
way.
I don't know why pqActiveServer::current() is not static !

Then use pqFileDialog with the current server:

pqFileDialog::pqFileDialog(
     pqServer* server,
     QWidget* p,
     const QString& title,
     const QString& startDirectory,
     const QString& nameFilter);

Nehme


> ------------------------------
> 
> Message: 2
> Date: Tue, 10 Feb 2009 16:34:07 -0700
>From: "Moreland, Kenneth" <kmorel at sandia.gov>
> Subject: [Paraview] Browsing server files from plugin
> To: "Paraview Mailing List" <paraview at paraview.org>
> Message-ID: <C5B75CFF.5BCC%kmorel at sandia.gov>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> I have a plugin that adds toolbar actions.  From one of 
>these actions I want to be able to open a dialog box to 
>browse files on the server.  From within the plugin 
>action, how do I get the active pqServer to point to the 
>right connection?
> 
> As an added bonus, how do I get a reference to the main 
>window so that the dialog boxes have an appropriate 
>parent?
> 
> -Ken
> 
>   ****      Kenneth Moreland
>    ***      Sandia National Laboratories
> ***********
> *** *** ***  email: kmorel at sandia.gov
> **  ***  **  phone: (505) 844-8919
>    ***      web:   http://www.cs.unm.edu/~kmorel
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
><http://www.paraview.org/pipermail/paraview/attachments/20090210/a602a6b3/attachment-0001.htm>
> 


More information about the ParaView mailing list