mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
fix vector menu creation on qt5
This commit is contained in:
parent
71429be7a2
commit
a17ed10b65
@ -1,6 +1,6 @@
|
|||||||
from processing.core.Processing import Processing
|
from processing.core.Processing import Processing
|
||||||
from processing.core.ProcessingConfig import ProcessingConfig, Setting
|
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.MessageDialog import MessageDialog
|
||||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||||
from qgis.utils import iface
|
from qgis.utils import iface
|
||||||
@ -117,8 +117,8 @@ def updateMenus():
|
|||||||
|
|
||||||
|
|
||||||
def createMenus():
|
def createMenus():
|
||||||
for provider in Processing.algs.values():
|
for provider in list(Processing.algs.values()):
|
||||||
for alg in provider.values():
|
for alg in list(provider.values()):
|
||||||
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
||||||
if menuPath:
|
if menuPath:
|
||||||
paths = menuPath.split("/")
|
paths = menuPath.split("/")
|
||||||
@ -126,8 +126,8 @@ def createMenus():
|
|||||||
|
|
||||||
|
|
||||||
def removeMenus():
|
def removeMenus():
|
||||||
for provider in Processing.algs.values():
|
for provider in list(Processing.algs.values()):
|
||||||
for alg in provider.values():
|
for alg in list(provider.values()):
|
||||||
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
menuPath = ProcessingConfig.getSetting("MENU_" + alg.commandLineName())
|
||||||
if menuPath:
|
if menuPath:
|
||||||
paths = menuPath.split("/")
|
paths = menuPath.split("/")
|
||||||
@ -196,14 +196,11 @@ def _executeAlgorithm(alg):
|
|||||||
|
|
||||||
|
|
||||||
def getMenu(name, parent):
|
def getMenu(name, parent):
|
||||||
menus = [c for c in parent.children() if isinstance(c, QMenu)]
|
menus = [c for c in parent.children() if isinstance(c, QMenu) and c.title() == name]
|
||||||
menusDict = {m.title(): m for m in menus}
|
if menus:
|
||||||
if name in menusDict:
|
return menus[0]
|
||||||
return menusDict[name]
|
|
||||||
else:
|
else:
|
||||||
menu = QMenu(name, parent)
|
return parent.addMenu(name)
|
||||||
parent.addMenu(menu)
|
|
||||||
return menu
|
|
||||||
|
|
||||||
|
|
||||||
def findAction(actions, alg, actionText=None):
|
def findAction(actions, alg, actionText=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user