Skip to content

Commit

Permalink
[processing] automatically open results viewer panel when items added
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 12, 2018
1 parent 207a947 commit 4ada498
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions python/plugins/processing/ProcessingPlugin.py
Expand Up @@ -180,8 +180,6 @@ def initGui(self):
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.resultsDock)
self.resultsDock.hide()

resultsList.resultAdded.connect(self.resultsDock.fillTree)

self.menu = QMenu(self.iface.mainWindow().menuBar())
self.menu.setObjectName('processing')
self.menu.setTitle(self.tr('Pro&cessing'))
Expand Down
12 changes: 11 additions & 1 deletion python/plugins/processing/gui/ResultsDock.py
Expand Up @@ -32,6 +32,7 @@
from qgis.PyQt.QtCore import (QUrl,
QFileInfo,
QDir)
from qgis.gui import QgsDockWidget
from qgis.PyQt.QtGui import QDesktopServices
from qgis.PyQt.QtWidgets import QTreeWidgetItem

Expand All @@ -42,12 +43,14 @@
os.path.join(pluginPath, 'ui', 'resultsdockbase.ui'))


class ResultsDock(BASE, WIDGET):
class ResultsDock(QgsDockWidget, WIDGET):

def __init__(self):
super(ResultsDock, self).__init__(None)
self.setupUi(self)

resultsList.resultAdded.connect(self.addResult)

self.treeResults.currentItemChanged.connect(self.updateDescription)
self.treeResults.itemDoubleClicked.connect(self.openResult)

Expand All @@ -56,6 +59,13 @@ def __init__(self):

self.fillTree()

def addResult(self):
self.fillTree()

# Automatically open the panel for users to see output
self.setUserVisible(True)
self.treeResults.setCurrentItem(self.treeResults.topLevelItem(0))

def fillTree(self):
self.treeResults.blockSignals(True)
self.treeResults.clear()
Expand Down

0 comments on commit 4ada498

Please sign in to comment.