Merge branch 'flowchart-node-menus' into develop
This commit is contained in:
commit
7fa0ce9711
@ -33,7 +33,9 @@ pyqtgraph-0.9.9 [unreleased]
|
||||
- Essentially a graphical interface to dict; all items have text and value
|
||||
- Assigns previously-selected text after list is cleared and repopulated
|
||||
- Get, set current value
|
||||
- Added Flowchart.sigChartChanged
|
||||
- Flowchart updates
|
||||
- Added Flowchart.sigChartChanged
|
||||
- Custom nodes may now be registered in sub-menu trees
|
||||
- ImageItem.getHistogram is more clever about constructing histograms
|
||||
- Added FillBetweenItem.setCurves()
|
||||
- MultiPlotWidget now has setMinimumPlotHeight method and displays scroll bar
|
||||
|
@ -32,6 +32,7 @@ Contributors
|
||||
* Stefan Holzmann
|
||||
* Nicholas TJ
|
||||
* John David Reaver
|
||||
* David Kaplan
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
@ -127,7 +127,10 @@ class UnsharpMaskNode(CtrlNode):
|
||||
## NodeLibrary:
|
||||
library = fclib.LIBRARY.copy() # start with the default node set
|
||||
library.addNodeType(ImageViewNode, [('Display',)])
|
||||
library.addNodeType(UnsharpMaskNode, [('Image',)])
|
||||
# Add the unsharp mask node to two locations in the menu to demonstrate
|
||||
# that we can create arbitrary menu structures
|
||||
library.addNodeType(UnsharpMaskNode, [('Image',),
|
||||
('Submenu_test','submenu2','submenu3')])
|
||||
fc.setLibrary(library)
|
||||
|
||||
|
||||
|
@ -823,16 +823,20 @@ class FlowchartWidget(dockarea.DockArea):
|
||||
self.buildMenu()
|
||||
|
||||
def buildMenu(self, pos=None):
|
||||
def buildSubMenu(node, rootMenu, subMenus, pos=None):
|
||||
for section, node in node.items():
|
||||
menu = QtGui.QMenu(section)
|
||||
rootMenu.addMenu(menu)
|
||||
if isinstance(node, OrderedDict):
|
||||
buildSubMenu(node, menu, subMenus, pos=pos)
|
||||
subMenus.append(menu)
|
||||
else:
|
||||
act = rootMenu.addAction(section)
|
||||
act.nodeType = section
|
||||
act.pos = pos
|
||||
self.nodeMenu = QtGui.QMenu()
|
||||
self.subMenus = []
|
||||
for section, nodes in self.chart.library.getNodeTree().items():
|
||||
menu = QtGui.QMenu(section)
|
||||
self.nodeMenu.addMenu(menu)
|
||||
for name in nodes:
|
||||
act = menu.addAction(name)
|
||||
act.nodeType = name
|
||||
act.pos = pos
|
||||
self.subMenus.append(menu)
|
||||
buildSubMenu(self.chart.library.getNodeTree(), self.nodeMenu, self.subMenus, pos=pos)
|
||||
self.nodeMenu.triggered.connect(self.nodeMenuTriggered)
|
||||
return self.nodeMenu
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user