Skip to content
Permalink
Browse files

[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.
  • Loading branch information
nyalldawson committed Jan 24, 2018
1 parent e5d00a2 commit 63db1be8908314b3f97d0c54b1139c3629cb3757
@@ -177,6 +177,7 @@ def initGui(self):
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 @@ def initGui(self):
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 @@ def unload(self):
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.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 @@
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'

0 comments on commit 63db1be

Please sign in to comment.
You can’t perform that action at this time.