|
1 | 1 | from processing.core.Processing import Processing
|
2 | 2 | from processing.core.ProcessingConfig import ProcessingConfig, Setting
|
3 |
| -from PyQt4.QtGui import QAction, QMenu |
| 3 | +from PyQt.QtWidgets import QAction, QMenu |
4 | 4 | from processing.gui.MessageDialog import MessageDialog
|
5 | 5 | from processing.gui.AlgorithmDialog import AlgorithmDialog
|
6 | 6 | from qgis.utils import iface
|
@@ -117,17 +117,17 @@ def updateMenus():
|
117 | 117 |
|
118 | 118 |
|
119 | 119 | def createMenus():
|
120 |
| - for provider in Processing.algs.values(): |
121 |
| - for alg in provider.values(): |
| 120 | + for provider in list(Processing.algs.values()): |
| 121 | + for alg in list(provider.values()): |
122 | 122 | menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
123 | 123 | if menuPath:
|
124 | 124 | paths = menuPath.split("/")
|
125 | 125 | addAlgorithmEntry(alg, paths[0], paths[-1])
|
126 | 126 |
|
127 | 127 |
|
128 | 128 | def removeMenus():
|
129 |
| - for provider in Processing.algs.values(): |
130 |
| - for alg in provider.values(): |
| 129 | + for provider in list(Processing.algs.values()): |
| 130 | + for alg in list(provider.values()): |
131 | 131 | menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
132 | 132 | if menuPath:
|
133 | 133 | paths = menuPath.split("/")
|
@@ -196,14 +196,11 @@ def _executeAlgorithm(alg):
|
196 | 196 |
|
197 | 197 |
|
198 | 198 | def getMenu(name, parent):
|
199 |
| - menus = [c for c in parent.children() if isinstance(c, QMenu)] |
200 |
| - menusDict = {m.title(): m for m in menus} |
201 |
| - if name in menusDict: |
202 |
| - return menusDict[name] |
| 199 | + menus = [c for c in parent.children() if isinstance(c, QMenu) and c.title() == name] |
| 200 | + if menus: |
| 201 | + return menus[0] |
203 | 202 | else:
|
204 |
| - menu = QMenu(name, parent) |
205 |
| - parent.addMenu(menu) |
206 |
| - return menu |
| 203 | + return parent.addMenu(name) |
207 | 204 |
|
208 | 205 |
|
209 | 206 | def findAction(actions, alg, actionText=None):
|
|
0 commit comments