Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix vector menu creation on qt5
  • Loading branch information
jef-n committed Mar 19, 2016
1 parent 71429be commit a17ed10
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions python/plugins/processing/gui/menus.py
@@ -1,6 +1,6 @@
from processing.core.Processing import Processing
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from PyQt4.QtGui import QAction, QMenu
from PyQt.QtWidgets import QAction, QMenu
from processing.gui.MessageDialog import MessageDialog
from processing.gui.AlgorithmDialog import AlgorithmDialog
from qgis.utils import iface
Expand Down Expand Up @@ -117,17 +117,17 @@ def updateMenus():


def createMenus():
for provider in Processing.algs.values():
for alg in provider.values():
for provider in list(Processing.algs.values()):
for alg in list(provider.values()):
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
if menuPath:
paths = menuPath.split("/")
addAlgorithmEntry(alg, paths[0], paths[-1])


def removeMenus():
for provider in Processing.algs.values():
for alg in provider.values():
for provider in list(Processing.algs.values()):
for alg in list(provider.values()):
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
if menuPath:
paths = menuPath.split("/")
Expand Down Expand Up @@ -196,14 +196,11 @@ def _executeAlgorithm(alg):


def getMenu(name, parent):
menus = [c for c in parent.children() if isinstance(c, QMenu)]
menusDict = {m.title(): m for m in menus}
if name in menusDict:
return menusDict[name]
menus = [c for c in parent.children() if isinstance(c, QMenu) and c.title() == name]
if menus:
return menus[0]
else:
menu = QMenu(name, parent)
parent.addMenu(menu)
return menu
return parent.addMenu(name)


def findAction(actions, alg, actionText=None):
Expand Down

0 comments on commit a17ed10

Please sign in to comment.