[Paraview] Custom display panel for a source or filter

clinton at elemtech.com clinton at elemtech.com
Thu Jan 10 11:16:57 EST 2008


Change
new QPushButton("TEST", p);
to
new QPushButton("TEST", this);

So the button is a child of the display panel, and not a child of its parent.

Clint

On Thursday 10 January 2008 1:51:26 am Paul Edwards wrote:
> I've attached some code to create a custom display panel for a plot 3d
> reader (although modifying canCreatePanel can change it for any other
> input).  The widget that is displayed is simply a push button and it works
> for the plot3d input.  There is a problem when I add a filter in that both
> the display panels are shown for the new filter - am I doing something
> wrong, or is this a bug?
>
> Regards,
> Paul
>
> On 07/01/2008, Utkarsh Ayachit <utkarsh.ayachit at kitware.com> wrote:
> > Cast it to pqDataRepresentation as follows:
> > pqDataRepresentation* dr = qobject_cast<pqDataRepresentation*>(display);
> >
> > Utkarsh
> >
> > Paul Edwards wrote:
> > > Sorry to keep asking questions but pqRepresentation doesn't have a
> > > "getInput()" method...
> > >
> > > Regards,
> > > Paul
> > >
> > > On 04/01/2008, *Clinton Stimpson * <clinton at elemtech.com
> > > <mailto:clinton at elemtech.com>> wrote:
> > >
> > >
> > >     In your pqDisplayPanelInterface implementation you check for the
> >
> > source
> >
> > >     or filter like so:
> > >
> > >     bool  MyDisplayInterface::canCreatePanel(pqRepresentation* display)
> > >     {
> > >       pqPipelineSource* s = display->getInput();
> > >       vtkSMProxy = s->getProxy();
> > >       if(QString("MySourceOrFilter") == s->GetXMLName())
> > >       {
> > >         return true;
> > >       }
> > >       return false;
> > >     }
> > >
> > >
> > >     Clint
> > >
> > >     Paul Edwards wrote:
> > >      > I can now change the display panel for all sources/filters
> > >
> > >     relating to
> > >
> > >      > a view.  Is there a way to set the display panel depending on
> > >      > the source or filter?
> > >      >
> > >      > Thanks for all the help so far,
> > >      > Paul
> > >      >
> > >      > On 03/01/2008, *Clinton Stimpson* < clinton at elemtech.com
> > >
> > >     <mailto:clinton at elemtech.com>
> > >
> > >      > <mailto:clinton at elemtech.com <mailto:clinton at elemtech.com>>>
> >
> > wrote:
> > >      >     Paul Edwards wrote:
> > >      >     > Does this mean that I don't need to edit the main Paraview
> > >
> > >     code?
> > >
> > >      >     That's correct.  You can do this in a plugin.
> > >      >
> > >      >     > Do you have any examples of a plugin which does this?
> > >      >
> > >      >     The closest example is
> >
> > ParaView3/Examples/Plugins/GUIView.  But
> >
> > >      >     what you
> > >      >     want is different enough that it may not help much.
> > >      >
> > >      >     > If not, I would be happy to make one, but I'm still a
> >
> > little
> >
> > >      >     confused
> > >      >
> > >      >     > as to how to implement it.  So far I have a plugin for the
> > >      >
> > >      >     server and
> > >      >
> > >      >     > one for the client, adding a reader and panel to
> > >      >
> > >      >     paraview.  Below is
> > >      >
> > >      >     > my CMake file:
> > >
> > >     8<----------------------------------------------------------------
> > >
> > >      >     > FIND_PACKAGE(ParaView REQUIRED)
> > >      >     > INCLUDE(${PARAVIEW_USE_FILE})
> > >      >     >
> > >      >     >
> > >      >     > QT4_WRAP_CPP(MOC_SRCS pqMyPanel.h)
> > >      >     > QT4_WRAP_UI(UIC_SRCS pqMyPanel.ui )
> > >      >     >
> > >      >     > ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS CLASS_NAME
> > >
> > >     pqMyPanel
> > >
> > >      >     >                           XML_NAME MyReader XML_GROUP
> >
> > sources)
> >
> > >      >     > ADD_PARAVIEW_PLUGIN(MyReaderSMPlugin "1.0"
> > >      >     >                     SERVER_MANAGER_XML vtkMyReader.xml
> > >      >     >                     SERVER_MANAGER_SOURCES
> > >      >     > vtkMyReader.cxx) ADD_PARAVIEW_PLUGIN(MyReaderGUIPlugin "
> > >      >     > 1.0"
> > >      >     >                     GUI_INTERFACES ${IFACES}
> > >      >     >                     GUI_RESOURCE_FILES pqMyReader.xml
> > >      >     >                     SOURCES pqMyPanel.cxx ${MOC_SRCS}
> > >
> > >     ${UIC_SRCS}
> > >
> > >      >     > ${IFACE_SRCS})
> > >
> > >     ---------------------------------------------------------------->8
> > >
> > >      >     > Is there a macro to add a display panel so the file can be
> > >
> > >     auto
> > >
> > >      >     > generated, or do I need to create my own subclass for
> > >
> > >     pqPlugin and
> > >
> > >      >     > manually add it as one of the interfaces?
> > >      >
> > >      >     As Utkarsh said, you create your own implementation of
> > >      >     pqDisplayPanelInterface, not pqPlugin.
> > >      >     There's an ADD_PARAVIEW_DISPLAY_PANEL macro that you can
> > >
> > >     follow as an
> > >
> > >      >     example.  Since you need to make your own
> > >      >     pqDisplayPanelInterface,  you
> > >      >     can't call that macro.
> > >      >     Your implementation of pqDisplayPanelInterface needs to be
> > >
> > >     give to
> > >
> > >      >     ADD_PARAVIEW_PLUGIN's GUI_INTERFACES argument so it can put
> > >
> > >     it in the
> > >
> > >      >     pqPlugin implementation it creates.
> > >      >
> > >      >     Clint
> > >      >
> > >      >     > On 03/01/2008, *Utkarsh Ayachit*
> > >
> > >     <utkarsh.ayachit at kitware.com <mailto:utkarsh.ayachit at kitware.com>
> > >
> > >      >     <mailto: utkarsh.ayachit at kitware.com
> > >
> > >     <mailto:utkarsh.ayachit at kitware.com>>
> > >
> > >      >     > <mailto: utkarsh.ayachit at kitware.com
> > >
> > >     <mailto:utkarsh.ayachit at kitware.com>
> > >
> > >      >     <mailto:utkarsh.ayachit at kitware.com
> > >
> > >     <mailto:utkarsh.ayachit at kitware.com>>>> wrote:
> > >      >     >     Hi Paul,
> > >      >     >
> > >      >     >     In your plugin, you need to implement the
> > >      >
> > >      >     pqDisplayPanelInterface
> > >      >
> > >      >     >     (just
> > >      >     >     what the pqStandardDisplayPanels in
> > >      >
> > >      >     pqDisplayProxyEditorWidget.cxx
> > >      >
> > >      >     >     does)
> > >      >     >     and the register it with the plugin manager. If you
> >
> > look at
> >
> > >      >     >     pqDisplayProxyEditorWidget::updatePanel, you'll see
> > >
> > >     that it
> > >
> > >      >     checks for
> > >      >
> > >      >     >     all pqDisplayPanelInterface implementations registered
> > >
> > >     and asks
> > >
> > >      >     >     them to
> > >      >     >     create the panel for the source.
> > >      >     >
> > >      >     >     Utkarsh
> > >      >     >
> > >      >     >     Robert Maynard wrote:
> > >      >     >     > Last time I asked the same question, I was told I
> >
> > would
> >
> > >      >     have to
> > >      >
> > >      >     >     include
> > >      >     >
> > >      >     >     > the xmlName of my class to the conditional
> > >      >     >     > statement,
> >
> > and
> >
> > >      >     recompile
> > >      >
> > >      >     >     > paraview to get custom display panels like
> > >      >     >     > TextSource
> > >
> > >     to work.
> > >
> > >      >     >     > On Jan 3, 2008 9:12 AM, Paul Edwards <
> > >      >
> > >      >     paul.m.edwards at gmail.com <mailto:paul.m.edwards at gmail.com>
> > >
> > >     <mailto:paul.m.edwards at gmail.com <mailto:paul.m.edwards at gmail.com>>
> > >
> > >      >     >     <mailto:paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>
> > >
> > >      >     <mailto:paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>>>
> > >
> > >      >     >     > <mailto: paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>
> > >
> > >      >     <mailto:paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>>
> > >
> > >      >     >     <mailto: paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>
> > >
> > >      >     <mailto:paul.m.edwards at gmail.com
> > >
> > >     <mailto:paul.m.edwards at gmail.com>>>>> wrote:
> > >      >     >     >     I am trying to provide a custom display panel
> > >      >     >     > for
> >
> > a
> >
> > >      >     plugin I
> > >      >
> > >      >     >     have
> > >      >     >
> > >      >     >     >     created.  The plugin is for a new source which
> > >      >     >     > is
> >
> > a
> >
> > >      >     subclass of
> > >      >
> > >      >     >     >     vtkMultiBlockPLOT3DReader (the plot3d file is
> > >      >
> > >      >     generated from
> > >      >
> > >      >     >     inputs
> > >      >     >
> > >      >     >     >     selected in the object panel) and I would like
> > >      >     >     > to
> > >      >
> > >      >     customize the
> > >      >
> > >      >     >     >     display options for my users.
> > >      >     >     >
> > >      >     >     >     I can see this is done for "TextSource" and
> > >      >     >
> > >      >     >     "TimeToTextConverter"
> > >      >     >
> > >      >     >     >     but when looking through the code (
> > >      >
> > >      >     pqObjectBuilder.cxx, line
> > >      >
> > >      >     >     400)
> > >      >     >
> > >      >     >     >     there is a conditional statement to check
> > >
> > >     specifically
> > >
> > >      >     for these
> > >      >
> > >      >     >     >     sources.  Does this mean that it is not possible
> > >
> > >     from a
> > >
> > >      >     >     plugin? (Or
> > >      >     >
> > >      >     >     >     am I looking in the wrong place here?)
> > >      >     >     >
> > >      >     >     >     Any help would be appreciated, thanks in
> > >      >     >     > advance, Paul
> > >      >     >     >
> > >      >     >     >     PS Great software ;)
> > >      >     >     >
> > >      >     >     >     _______________________________________________
> > >      >     >     >     ParaView mailing list
> > >      >     >     >     ParaView at paraview.org
> > >
> > >     <mailto:ParaView at paraview.org> <mailto:ParaView at paraview.org
> > >     <mailto:ParaView at paraview.org>>
> > >
> > >      >     <mailto: ParaView at paraview.org
> > >      > <mailto:ParaView at paraview.org>
> > >
> > >     <mailto:ParaView at paraview.org <mailto:ParaView at paraview.org>>>
> > >
> > >      >     >     <mailto:ParaView at paraview.org
> > >
> > >     <mailto:ParaView at paraview.org> <mailto: ParaView at paraview.org
> > >     <mailto:ParaView at paraview.org>>
> > >
> > >      >     <mailto:ParaView at paraview.org <mailto:ParaView at paraview.org>
> > >
> > >     <mailto:ParaView at paraview.org <mailto:ParaView at paraview.org>>>>
> > >
> > >      >     >     >    
> > >      >     >     > http://www.paraview.org/mailman/listinfo/paraview
> >
> > ------------------------------------------------------------------------
> >
> > >      >     >     > _______________________________________________
> > >      >     >     > ParaView mailing list
> > >      >     >     > ParaView at paraview.org <mailto:ParaView at paraview.org>
> > >
> > >     <mailto:ParaView at paraview.org <mailto:ParaView at paraview.org>>
> > >
> > >      >     <mailto: ParaView at paraview.org
> > >      > <mailto:ParaView at paraview.org>
> > >
> > >     <mailto:ParaView at paraview.org <mailto:ParaView at paraview.org>>>
> > >
> > >      >     >     > http://www.paraview.org/mailman/listinfo/paraview
> > >
> > >     <http://www.paraview.org/mailman/listinfo/paraview>
> > >
> > >      >     >     < http://www.paraview.org/mailman/listinfo/paraview>
> >
> > ------------------------------------------------------------------------
> >
> > >      >     > _______________________________________________
> > >      >     > ParaView mailing list
> > >      >     > ParaView at paraview.org <mailto:ParaView at paraview.org>
> > >
> > >     <mailto: ParaView at paraview.org <mailto:ParaView at paraview.org>>
> > >
> > >      >     > http://www.paraview.org/mailman/listinfo/paraview




More information about the ParaView mailing list