Skip to content

Commit

Permalink
Move 'Run as batch' button to bottom of algorithm dialog
Browse files Browse the repository at this point in the history
Inserting it into the tab widget doesn't work well cross
platform/between hidpi/lowdpi displays. So instead add
it as a normal button in the button box.

Also fix capitalization of button text

Fixes #16767
  • Loading branch information
nyalldawson committed Jul 25, 2017
1 parent 06374a6 commit a95cbe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
15 changes: 5 additions & 10 deletions python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
QLineEdit,
QComboBox,
QCheckBox,
QSizePolicy)
QSizePolicy,
QDialogButtonBox)

from qgis.gui import QgsMessageBar

Expand All @@ -57,15 +58,9 @@ def __init__(self, alg):

self.setMainWidget(GdalParametersPanel(self, alg))

cornerWidget = QWidget()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 5)
self.tabWidget.setStyleSheet("QTabBar::tab { height: 30px; }")
runAsBatchButton = QPushButton(self.tr("Run as batch process..."))
runAsBatchButton.clicked.connect(self.runAsBatch)
layout.addWidget(runAsBatchButton)
cornerWidget.setLayout(layout)
self.tabWidget.setCornerWidget(cornerWidget)
self.runAsBatchButton = QPushButton(self.tr("Run as Batch Process…"))
self.runAsBatchButton.clicked.connect(self.runAsBatch)
self.buttonBox.addButton(self.runAsBatchButton, QDialogButtonBox.ResetRole) # reset role to ensure left alignment

self.mainWidget.parametersHaveChanged()

Expand Down
11 changes: 3 additions & 8 deletions python/plugins/processing/gui/AlgorithmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import time

from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QMessageBox, QApplication, QPushButton, QWidget, QVBoxLayout, QSizePolicy
from qgis.PyQt.QtWidgets import QMessageBox, QApplication, QPushButton, QWidget, QVBoxLayout, QSizePolicy, QDialogButtonBox
from qgis.PyQt.QtGui import QCursor, QColor, QPalette

from qgis.core import (QgsProject,
Expand Down Expand Up @@ -83,14 +83,9 @@ def __init__(self, alg):
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.layout().insertWidget(0, self.bar)

self.cornerWidget = QWidget()
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 5)
self.runAsBatchButton = QPushButton(self.tr("Run as batch process..."))
self.runAsBatchButton = QPushButton(self.tr("Run as Batch Process…"))
self.runAsBatchButton.clicked.connect(self.runAsBatch)
layout.addWidget(self.runAsBatchButton)
self.cornerWidget.setLayout(layout)
self.tabWidget.setCornerWidget(self.cornerWidget)
self.buttonBox.addButton(self.runAsBatchButton, QDialogButtonBox.ResetRole) # reset role to ensure left alignment

def getParametersPanel(self, alg, parent):
return ParametersPanel(parent, alg)
Expand Down

0 comments on commit a95cbe9

Please sign in to comment.