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" <[email protected]>
Subject: [Paraview] Browsing server files from plugin
To: "Paraview Mailing List" <[email protected]>
Message-ID: <c5b75cff.5bcc%[email protected]>
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: [email protected]
**  ***  **  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>

_______________________________________________
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

Reply via email to