|
41 | 41 | QSizePolicy,
|
42 | 42 | QMainWindow,
|
43 | 43 | QShortcut,
|
44 |
| - QLabel) |
45 |
| -from qgis.PyQt.QtGui import QIcon, QImage, QPainter, QKeySequence |
| 44 | + QLabel, |
| 45 | + QDockWidget, |
| 46 | + QWidget, |
| 47 | + QVBoxLayout, |
| 48 | + QGridLayout, |
| 49 | + QFrame, |
| 50 | + QLineEdit) |
| 51 | +from qgis.PyQt.QtGui import (QIcon, |
| 52 | + QImage, |
| 53 | + QPainter, |
| 54 | + QKeySequence) |
46 | 55 | from qgis.PyQt.QtSvg import QSvgGenerator
|
47 | 56 | from qgis.PyQt.QtPrintSupport import QPrinter
|
48 | 57 | from qgis.core import (Qgis,
|
|
55 | 64 | QgsProcessingModelParameter,
|
56 | 65 | QgsProcessingParameterType
|
57 | 66 | )
|
58 |
| -from qgis.gui import QgsMessageBar |
| 67 | +from qgis.gui import (QgsMessageBar, |
| 68 | + QgsDockWidget, |
| 69 | + QgsScrollArea, |
| 70 | + QgsFilterLineEdit) |
59 | 71 | from processing.gui.HelpEditionDialog import HelpEditionDialog
|
60 | 72 | from processing.gui.AlgorithmDialog import AlgorithmDialog
|
61 | 73 | from processing.modeler.ModelerParameterDefinitionDialog import ModelerParameterDefinitionDialog
|
@@ -91,6 +103,108 @@ def __init__(self, model=None):
|
91 | 103 |
|
92 | 104 | self.setupUi(self)
|
93 | 105 |
|
| 106 | + # LOTS of bug reports when we include the dock creation in the UI file |
| 107 | + # see e.g. #16428, #19068 |
| 108 | + # So just roll it all by hand......! |
| 109 | + self.propertiesDock = QgsDockWidget(self) |
| 110 | + self.propertiesDock.setFeatures( |
| 111 | + QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) |
| 112 | + self.propertiesDock.setObjectName("propertiesDock") |
| 113 | + propertiesDockContents = QWidget() |
| 114 | + self.verticalDockLayout_1 = QVBoxLayout(propertiesDockContents) |
| 115 | + self.verticalDockLayout_1.setContentsMargins(0, 0, 0, 0) |
| 116 | + self.verticalDockLayout_1.setSpacing(0) |
| 117 | + self.scrollArea_1 = QgsScrollArea(propertiesDockContents) |
| 118 | + sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, |
| 119 | + QSizePolicy.MinimumExpanding) |
| 120 | + sizePolicy.setHorizontalStretch(0) |
| 121 | + sizePolicy.setVerticalStretch(0) |
| 122 | + sizePolicy.setHeightForWidth(self.scrollArea_1.sizePolicy().hasHeightForWidth()) |
| 123 | + self.scrollArea_1.setSizePolicy(sizePolicy) |
| 124 | + self.scrollArea_1.setFocusPolicy(Qt.WheelFocus) |
| 125 | + self.scrollArea_1.setFrameShape(QFrame.NoFrame) |
| 126 | + self.scrollArea_1.setFrameShadow(QFrame.Plain) |
| 127 | + self.scrollArea_1.setWidgetResizable(True) |
| 128 | + self.scrollAreaWidgetContents_1 = QWidget() |
| 129 | + self.gridLayout = QGridLayout(self.scrollAreaWidgetContents_1) |
| 130 | + self.gridLayout.setContentsMargins(6, 6, 6, 6) |
| 131 | + self.gridLayout.setSpacing(4) |
| 132 | + self.label_1 = QLabel(self.scrollAreaWidgetContents_1) |
| 133 | + self.gridLayout.addWidget(self.label_1, 0, 0, 1, 1) |
| 134 | + self.textName = QLineEdit(self.scrollAreaWidgetContents_1) |
| 135 | + self.gridLayout.addWidget(self.textName, 0, 1, 1, 1) |
| 136 | + self.label_2 = QLabel(self.scrollAreaWidgetContents_1) |
| 137 | + self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) |
| 138 | + self.textGroup = QLineEdit(self.scrollAreaWidgetContents_1) |
| 139 | + self.gridLayout.addWidget(self.textGroup, 1, 1, 1, 1) |
| 140 | + self.label_1.setText(self.tr("Name")) |
| 141 | + self.textName.setToolTip(self.tr("Enter model name here")) |
| 142 | + self.label_2.setText(self.tr("Group")) |
| 143 | + self.textGroup.setToolTip(self.tr("Enter group name here")) |
| 144 | + self.scrollArea_1.setWidget(self.scrollAreaWidgetContents_1) |
| 145 | + self.verticalDockLayout_1.addWidget(self.scrollArea_1) |
| 146 | + self.propertiesDock.setWidget(propertiesDockContents) |
| 147 | + self.addDockWidget(Qt.DockWidgetArea(1), self.propertiesDock) |
| 148 | + self.propertiesDock.setWindowTitle(self.tr("Model properties")) |
| 149 | + |
| 150 | + self.inputsDock = QgsDockWidget(self) |
| 151 | + self.inputsDock.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) |
| 152 | + self.inputsDock.setObjectName("inputsDock") |
| 153 | + self.inputsDockContents = QWidget() |
| 154 | + self.verticalLayout_3 = QVBoxLayout(self.inputsDockContents) |
| 155 | + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) |
| 156 | + self.scrollArea_2 = QgsScrollArea(self.inputsDockContents) |
| 157 | + sizePolicy.setHeightForWidth(self.scrollArea_2.sizePolicy().hasHeightForWidth()) |
| 158 | + self.scrollArea_2.setSizePolicy(sizePolicy) |
| 159 | + self.scrollArea_2.setFocusPolicy(Qt.WheelFocus) |
| 160 | + self.scrollArea_2.setFrameShape(QFrame.NoFrame) |
| 161 | + self.scrollArea_2.setFrameShadow(QFrame.Plain) |
| 162 | + self.scrollArea_2.setWidgetResizable(True) |
| 163 | + self.scrollAreaWidgetContents_2 = QWidget() |
| 164 | + self.verticalLayout = QVBoxLayout(self.scrollAreaWidgetContents_2) |
| 165 | + self.verticalLayout.setContentsMargins(0, 0, 0, 0) |
| 166 | + self.verticalLayout.setSpacing(0) |
| 167 | + self.inputsTree = QTreeWidget(self.scrollAreaWidgetContents_2) |
| 168 | + self.inputsTree.setAlternatingRowColors(True) |
| 169 | + self.inputsTree.header().setVisible(False) |
| 170 | + self.verticalLayout.addWidget(self.inputsTree) |
| 171 | + self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2) |
| 172 | + self.verticalLayout_3.addWidget(self.scrollArea_2) |
| 173 | + self.inputsDock.setWidget(self.inputsDockContents) |
| 174 | + self.addDockWidget(Qt.DockWidgetArea(1), self.inputsDock) |
| 175 | + self.inputsDock.setWindowTitle(self.tr("Inputs")) |
| 176 | + |
| 177 | + self.algorithmsDock = QgsDockWidget(self) |
| 178 | + self.algorithmsDock.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) |
| 179 | + self.algorithmsDock.setObjectName("algorithmsDock") |
| 180 | + self.algorithmsDockContents = QWidget() |
| 181 | + self.verticalLayout_4 = QVBoxLayout(self.algorithmsDockContents) |
| 182 | + self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) |
| 183 | + self.scrollArea_3 = QgsScrollArea(self.algorithmsDockContents) |
| 184 | + sizePolicy.setHeightForWidth(self.scrollArea_3.sizePolicy().hasHeightForWidth()) |
| 185 | + self.scrollArea_3.setSizePolicy(sizePolicy) |
| 186 | + self.scrollArea_3.setFocusPolicy(Qt.WheelFocus) |
| 187 | + self.scrollArea_3.setFrameShape(QFrame.NoFrame) |
| 188 | + self.scrollArea_3.setFrameShadow(QFrame.Plain) |
| 189 | + self.scrollArea_3.setWidgetResizable(True) |
| 190 | + self.scrollAreaWidgetContents_3 = QWidget() |
| 191 | + self.verticalLayout_2 = QVBoxLayout(self.scrollAreaWidgetContents_3) |
| 192 | + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) |
| 193 | + self.verticalLayout_2.setSpacing(4) |
| 194 | + self.searchBox = QgsFilterLineEdit(self.scrollAreaWidgetContents_3) |
| 195 | + self.verticalLayout_2.addWidget(self.searchBox) |
| 196 | + self.algorithmTree = QTreeWidget(self.scrollAreaWidgetContents_3) |
| 197 | + self.algorithmTree.setAlternatingRowColors(True) |
| 198 | + self.algorithmTree.header().setVisible(False) |
| 199 | + self.verticalLayout_2.addWidget(self.algorithmTree) |
| 200 | + self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3) |
| 201 | + self.verticalLayout_4.addWidget(self.scrollArea_3) |
| 202 | + self.algorithmsDock.setWidget(self.algorithmsDockContents) |
| 203 | + self.addDockWidget(Qt.DockWidgetArea(1), self.algorithmsDock) |
| 204 | + self.algorithmsDock.setWindowTitle(self.tr("Algorithms")) |
| 205 | + self.searchBox.setToolTip(self.tr("Enter algorithm name to filter list")) |
| 206 | + self.searchBox.setShowSearchIcon(True) |
| 207 | + |
94 | 208 | self.bar = QgsMessageBar()
|
95 | 209 | self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
|
96 | 210 | self.centralWidget().layout().insertWidget(0, self.bar)
|
|
0 commit comments