mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[processing] Improve main window Toolbox action
Brings the behaviour into line with the styling dock, where the action is checkable and checked only when the toolbox is open AND user visible (i.e. not hidden behind another tab). If the toolbox is open but hidden, then hitting the Toolbox action brings it to the front tab. Otherwise it's often necessary to hit to Toolbox shortcut twice - once to close a hidden toolbox tab, and a second time to open and raise it.
This commit is contained in:
parent
e5d00a26ab
commit
63db1be890
@ -177,6 +177,7 @@ class ProcessingPlugin:
|
||||
self.toolbox = ProcessingToolbox()
|
||||
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.toolbox)
|
||||
self.toolbox.hide()
|
||||
self.toolbox.visibilityChanged.connect(self.toolboxVisibilityChanged)
|
||||
|
||||
self.resultsDock = ResultsDock()
|
||||
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.resultsDock)
|
||||
@ -188,12 +189,13 @@ class ProcessingPlugin:
|
||||
self.menu.setObjectName('processing')
|
||||
self.menu.setTitle(self.tr('Pro&cessing'))
|
||||
|
||||
self.toolboxAction = self.toolbox.toggleViewAction()
|
||||
self.toolboxAction = QAction(self.tr('&Toolbox'), self.iface.mainWindow())
|
||||
self.toolboxAction.setCheckable(True)
|
||||
self.toolboxAction.setObjectName('toolboxAction')
|
||||
self.toolboxAction.setIcon(
|
||||
QgsApplication.getThemeIcon("/processingAlgorithm.svg"))
|
||||
self.toolboxAction.setText(self.tr('&Toolbox'))
|
||||
self.iface.registerMainWindowAction(self.toolboxAction, 'Ctrl+Alt+T')
|
||||
self.toolboxAction.toggled.connect(self.openToolbox)
|
||||
self.menu.addAction(self.toolboxAction)
|
||||
|
||||
self.modelerAction = QAction(
|
||||
@ -276,11 +278,11 @@ class ProcessingPlugin:
|
||||
removeMenus()
|
||||
Processing.deinitialize()
|
||||
|
||||
def openToolbox(self):
|
||||
if self.toolbox.isVisible():
|
||||
self.toolbox.hide()
|
||||
else:
|
||||
self.toolbox.show()
|
||||
def openToolbox(self, show):
|
||||
self.toolbox.setUserVisible(show)
|
||||
|
||||
def toolboxVisibilityChanged(self, visible):
|
||||
self.toolboxAction.setChecked(visible)
|
||||
|
||||
def openModeler(self):
|
||||
dlg = ModelerDialog()
|
||||
|
@ -34,6 +34,7 @@ from qgis.PyQt.QtWidgets import QMenu, QAction, QTreeWidgetItem, QLabel, QMessag
|
||||
from qgis.utils import iface
|
||||
from qgis.core import (QgsApplication,
|
||||
QgsProcessingAlgorithm)
|
||||
from qgis.gui import QgsDockWidget
|
||||
|
||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||
from processing.core.Processing import Processing
|
||||
@ -55,7 +56,7 @@ WIDGET, BASE = uic.loadUiType(
|
||||
os.path.join(pluginPath, 'ui', 'ProcessingToolbox.ui'))
|
||||
|
||||
|
||||
class ProcessingToolbox(BASE, WIDGET):
|
||||
class ProcessingToolbox(QgsDockWidget, WIDGET):
|
||||
ALG_ITEM = 'ALG_ITEM'
|
||||
PROVIDER_ITEM = 'PROVIDER_ITEM'
|
||||
GROUP_ITEM = 'GROUP_ITEM'
|
||||
|
Loading…
x
Reference in New Issue
Block a user