[Paraview] Is is possible to create second filters menu?

Kit Chambers kit.chambers at rocktalkimaging.com
Thu Jun 16 07:58:15 EDT 2011


Ok, I'm still not having much luck with creating my own proxy group and
associated menu. Using the 3.11.1 code from the git i have the following
menu builder routine:

void pqParaView2MenuBuilders::buildFiltersMenu(QMenu& menu, QMainWindow*
mainWindow)
{
	  pqProxyGroupMenuManager* mgr = new pqProxyGroupMenuManager(&menu,
"ParaViewFilters2");
	  mgr->addProxyDefinitionUpdateListener("filters2");
	  mgr->setRecentlyUsedMenuSize(10);

	  new pq2FiltersMenuReaction(mgr);
	  pqPVApplicationCore::instance()->registerForQuicklaunch(&menu);
}


And a plugin filter specified as 

<ProxyGroup name="filters2">
   <SourceProxy name="MyElevationFilter" class="vtkMyElevationFilter"
label="MyElevation">
...
</ProxyGroup>

The pq2FiltersMenuReaction class is a copy of the class
pqFiltersMenuReaction. 

I have discovered at least one area where things are going wrong. For
some reason the new menu manager class is not created with any actions
so the foreach loop in the updateEnableState is never entered.

  pqProxyGroupMenuManager* mgr =
    static_cast<pqProxyGroupMenuManager*>(this->parent());
 mgr->setEnabled(enabled);
 bool some_enabled = false;
 
foreach (QAction* action, mgr->actions())
{
 ... [ never goes in here ]
}

Any suggestions? Is there anything special you need to define to
initialize your own proxy groups either in the plugin or as part of the
main app?

Kit



On Tue, 2011-06-14 at 09:16 -0400, Utkarsh Ayachit wrote:

> Use pqProxyGroupMenuManager::addProxyDefinitionUpdateListener() to set
> the group to listen to for updates (assuming you are using
> git-master/3.11.1)
> 
> Utkarsh
> 
> On Tue, Jun 14, 2011 at 7:26 AM, Kit Chambers
> <kit.chambers at rocktalkimaging.com> wrote:
> >
> > Ok,
> >
> > Here's what I have so far:
> >
> > The filters for the new menu are given a different ProxyGroup name  ("myfiltergroup" ) in the XML i.e
> > <ServerManagerConfiguration>
> >   <ProxyGroup name="myfiltergroup">
> >    <SourceProxy name="MyCellDerivatives" class="vtkCellDerivatives" label="My Cell Derivatives">
> >      <Documentation
> >         long_help="Create point attribute array by projecting points onto an elevation vector."
> >         short_help="Create a point array representing elevation.">
> >      </Documentation>
> >      <InputProperty
> >         name="Input"
> >         command="SetInputConnection">
> >            <ProxyGroupDomain name="filters">
> >              <Group name="sources"/>
> >              <Group name="filters"/>
> >            </ProxyGroupDomain>
> >            <DataTypeDomain name="input_type">
> >              <DataType value="vtkDataSet"/>
> >            </DataTypeDomain>
> >       </InputProperty>
> >    </SourceProxy>
> > </ProxyGroup>
> > </ServerManagerConfiguration>
> >
> >
> > Then I define a menu builder function which is called from the MainWindow app.
> >
> > void MyMenuBuilders::buildSecondFiltersMenu(QMenu* menu, QMainWindow* mainWindow)
> > {
> >   pqProxyGroupMenuManager* mgr =
> >     new pqProxyGroupMenuManager(menu, "mysetfilters");
> >   mgr->setRecentlyUsedMenuSize(10);
> >   new RosieProcessingMenuReactions(mgr);
> >
> >   new pqUpdateProxyDefinitionsBehavior(
> >     pqUpdateProxyDefinitionsBehavior::ANY, "myfiltergroup", mgr);
> >   pqPVApplicationCore::instance()->registerForQuicklaunch(menu);
> >
> >   if (mainWindow)
> >   {
> >     // create toolbars for categories as needed.
> >     new pqCategoryToolbarsBehavior(mgr, mainWindow);
> >   }
> > }
> >
> >
> > I can specify various filters to be loaded at startup by putting them inside the mysetfilters XML  (i.e. just like the ParaViewFilters XML object). However, The when the above server manager XML is used a plugin it doesn't come up in the menu.
> >
> > Any ideas as to what I'm missing here? Any guidance is welcome.
> >
> > Kit
> >
> >
> >
> >
> > On Mon, 2011-06-13 at 16:27 -0400, Utkarsh Ayachit wrote:
> >
> > You are on the right track. Any proxy registered in the "filters" group from the plugins will automatically end up in the "Filters" menu, there's no way around it. The solution would be create a new group for your filters that's being shown in your menu. Theoretically, it should work, but I don't think we test it, but definitely worth a try.
> >
> >
> > Utkarsh
> >
> > On Mon, Jun 13, 2011 at 3:43 PM, Kit Chambers <kit.chambers at rocktalkimaging.com> wrote:
> >
> > Dear all
> >
> > Is it possible to create a second filters menu which I specify plugin filters to be added to?
> >
> > I can create a static menu from the main application using pqProxyGroupMenuManager() with the appropriate XML but cannot work out how to specify make filters from plugins go to the new menu rather than the filters menu. I guess I would like to be able to do something like specify a ProxyGroup (i.e. <ProxyGroup name="MyGroup"> ... )  in the plugin XML which puts filters in the new menu rather than in with the filters as a normal <ProxyGroup name="filters"> does.
> >
> > Any suggestions and or help is welcome.
> >
> > Kit
> >
> >
> >
> >
> >
> > Kit Chambers
> >
> > Principal Geophysicist
> > Office: +33 9 6418 7790
> > Direct: +44 1872 879 007
> > Mobile: +44 7816506558
> > Email:  kit.chambers at rocktalkimaging.com
> >
> > NOTE: OUR WEBSITE AND EMAIL ADDRESSES HAVE CHANGED. TO ENSURE WE RECEIVE YOUR COMMUNICATION, PLEASE UPDATE YOUR RECORDS.
> > _______________________________________________
> > 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
> >
> >
> >
> >
> >
> >
> > Kit Chambers
> >
> > Principal Geophysicist
> > Office: +33 9 6418 7790
> > Direct: +44 1872 879 007
> > Mobile: +44 7816506558
> > Email:  kit.chambers at rocktalkimaging.com
> >
> > NOTE: OUR WEBSITE AND EMAIL ADDRESSES HAVE CHANGED. TO ENSURE WE RECEIVE YOUR COMMUNICATION, PLEASE UPDATE YOUR RECORDS.




Kit Chambers

Principal Geophysicist
Office: +33 9 6418 7790
Direct: +44 1872 879 007
Mobile: +44 7816506558
Email:  kit.chambers at rocktalkimaging.com

NOTE: OUR WEBSITE AND EMAIL ADDRESSES HAVE CHANGED. TO ENSURE WE RECEIVE
YOUR COMMUNICATION, PLEASE UPDATE YOUR RECORDS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110616/74131120/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rocktalk_imagingextermelysmall.png
Type: image/png
Size: 7226 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110616/74131120/attachment-0001.png>


More information about the ParaView mailing list