예제 #1
0
    def filterExpressionWidget(self):
        """
        Retrieves a new widget for filtering expression setting.
        :return: (QgsFieldExpressionWidget) snap mode selection widget.
        """
        fe = QgsFieldExpressionWidget()

        def setValueProxy(exp):
            layer = fe.layer()
            if layer and exp.strip() in layer.fields().names():
                # if a layer is set and the expression is the name purely a
                # field, it will be ignore. single names are causing a weird
                # crash when running the algorithm. this seems to solve it.
                exp = ""
            fe.setExpression(exp)

        def getValueProxy():
            layer = fe.layer()
            exp = fe.currentText()
            if layer and exp.strip() in layer.fields().names():
                exp = ""
            return exp

        fe.setExpression_ = setValueProxy
        fe.currentText_ = getValueProxy
        return fe
예제 #2
0
    def __init__(self, parent, layer):
        '''
        Constructor
        '''
        QDialog.__init__(self, parent)
        self.ui = Ui_VectorLayerProPertyDialog()
        self.ui.setupUi(self)

        self.ui.txtLayerName.setText(layer.name())
        self.ui.txtLayerSource.setText(layer.source())
        self.ui.txtCrs.setText(layer.crs().authid() + " - " +
                               layer.crs().description())
        self.ui.btnCrsSelect.clicked.connect(self.selectCrs)
        self.mCrs = layer.crs()
        self.vLayer = layer
        self.ui.mOptionsListWidget.currentRowChanged.connect(
            self.changeStackWidget)
        ''' init RenderV2 Widget'''
        self.mRendererDialog = QgsRendererV2PropertiesDialog(
            self.vLayer, QgsStyleV2.defaultStyle(), True)
        self.ui.stackedWidget.insertWidget(1, self.mRendererDialog)
        self.ui.buttonBox.accepted.connect(self.OK)

        frame_Label = QFrame()
        verticalLayout_Label = QVBoxLayout(frame_Label)
        self.mLabelWidget = QgsFieldExpressionWidget()
        self.mLabelWidget.setLayer(layer)
        verticalLayout_Label.addWidget(self.mLabelWidget)

        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        verticalLayout_Label.addItem(spacerItem)
        frame_Label.setLayout(verticalLayout_Label)
        self.ui.stackedWidget.insertWidget(2, frame_Label)
    def setupUi(self, SvgBubblDialogBase):
        SvgBubblDialogBase.setObjectName(_fromUtf8("SvgBubblDialogBase"))
        SvgBubblDialogBase.resize(400, 300)
        self.button_box = QtGui.QDialogButtonBox(SvgBubblDialogBase)
        self.button_box.setGeometry(QtCore.QRect(30, 240, 341, 32))
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                           | QtGui.QDialogButtonBox.Ok)
        self.button_box.setObjectName(_fromUtf8("button_box"))
        self.comboBox = QtGui.QComboBox(SvgBubblDialogBase)
        self.comboBox.setGeometry(QtCore.QRect(120, 10, 161, 22))
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        self.label = QtGui.QLabel(SvgBubblDialogBase)
        self.label.setGeometry(QtCore.QRect(30, 10, 61, 21))
        self.label.setObjectName(_fromUtf8("label"))
        self.mFieldExpressionWidget = QgsFieldExpressionWidget(
            SvgBubblDialogBase)
        self.mFieldExpressionWidget.setGeometry(QtCore.QRect(110, 50, 200, 27))
        self.mFieldExpressionWidget.setObjectName(
            _fromUtf8("mFieldExpressionWidget"))

        self.retranslateUi(SvgBubblDialogBase)
        QtCore.QObject.connect(self.button_box,
                               QtCore.SIGNAL(_fromUtf8("accepted()")),
                               SvgBubblDialogBase.accept)
        QtCore.QObject.connect(self.button_box,
                               QtCore.SIGNAL(_fromUtf8("rejected()")),
                               SvgBubblDialogBase.reject)
        QtCore.QMetaObject.connectSlotsByName(SvgBubblDialogBase)
예제 #4
0
    def __init__(self, dialog):
        super(ExecuteSQLWidget, self).__init__(None)
        self.setupUi(self)
        self.dialog = dialog
        self.dialogType = dialogTypes[dialog.__class__.__name__]

        self.mExpressionWidget = QgsFieldExpressionWidget()

        # add model parameters in context scope if called from modeler
        if self.dialogType == DIALOG_MODELER:
            strings = dialog.getAvailableValuesOfType(
                [QgsProcessingParameterString, QgsProcessingParameterNumber],
                [])
            model_params = [dialog.resolveValueDescription(s) for s in strings]

            scope = QgsExpressionContextScope()
            for param in model_params:
                var = QgsExpressionContextScope.StaticVariable(param)
                scope.addVariable(var)

            self.mExpressionWidget.appendScope(scope)

        self.mHLayout.insertWidget(0, self.mExpressionWidget)

        self.mInsert.clicked.connect(self.insert)
예제 #5
0
 def createEditor(self, parent, option, index):
     editor = QgsFieldExpressionWidget(parent)
     editor.setLayer(index.model().layer())
     editor.registerExpressionContextGenerator(index.model().contextGenerator())
     editor.fieldChanged.connect(self.on_expression_fieldChange)
     editor.setAutoFillBackground(True)
     editor.setAllowEvalErrors(self.parent().dialogType == DIALOG_MODELER)
     return editor
class Ui_ComboEditWidget(object):
    def setupUi(self, ComboEditWidget):
        ComboEditWidget.setObjectName("ComboEditWidget")
        ComboEditWidget.resize(228, 52)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            ComboEditWidget.sizePolicy().hasHeightForWidth())
        ComboEditWidget.setSizePolicy(sizePolicy)
        ComboEditWidget.setMinimumSize(QtCore.QSize(50, 0))
        self.formLayout = QtWidgets.QFormLayout(ComboEditWidget)
        self.formLayout.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setContentsMargins(0, 2, 0, 2)
        self.formLayout.setObjectName("formLayout")
        self.label_1 = QtWidgets.QLabel(ComboEditWidget)
        self.label_1.setMinimumSize(QtCore.QSize(60, 0))
        self.label_1.setObjectName("label_1")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_1)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.comboBox = QtWidgets.QComboBox(ComboEditWidget)
        self.comboBox.setObjectName("comboBox")
        self.horizontalLayout.addWidget(self.comboBox)
        self.checkBox = QtWidgets.QCheckBox(ComboEditWidget)
        self.checkBox.setObjectName("checkBox")
        self.horizontalLayout.addWidget(self.checkBox)
        self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout)
        self.label_2 = QtWidgets.QLabel(ComboEditWidget)
        self.label_2.setMinimumSize(QtCore.QSize(60, 0))
        self.label_2.setText("")
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.expression = QgsFieldExpressionWidget(ComboEditWidget)
        self.expression.setObjectName("expression")
        self.horizontalLayout_2.addWidget(self.expression)
        self.toolButton = QtWidgets.QToolButton(ComboEditWidget)
        self.toolButton.setObjectName("toolButton")
        self.horizontalLayout_2.addWidget(self.toolButton)
        self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_2)

        self.retranslateUi(ComboEditWidget)
        QtCore.QMetaObject.connectSlotsByName(ComboEditWidget)
        ComboEditWidget.setTabOrder(self.comboBox, self.checkBox)
        ComboEditWidget.setTabOrder(self.checkBox, self.toolButton)

    def retranslateUi(self, ComboEditWidget):
        _translate = QtCore.QCoreApplication.translate
        ComboEditWidget.setWindowTitle(_translate("ComboEditWidget", "Form"))
        self.toolButton.setText(_translate("ComboEditWidget", "..."))
 def action_field_add(self):
     #self.bar.pushMessage("Trigger", "signal received", level=QgsMessageBar.INFO)
     field_expression_widget = QgsFieldExpressionWidget()
     field_expression_widget.setLayer(self.lyrCombobox.currentLayer())
     color_btn_widget = QgsColorButton()
     spinbox = QtGui.QSpinBox()
     presetrow = PresetRow(qgsfieldexpressionwidget=field_expression_widget,
                           qgscolorbutton=color_btn_widget,
                           qspinbox=spinbox)
     self._preset_rows.add_preset(presetrow)
     self.redraw_fields()
예제 #8
0
 def createEditor(self, parent, option, index):
     editor = QgsFieldExpressionWidget(parent)
     editor.setLayer(index.model().layer())
     editor.registerExpressionContextGenerator(index.model().contextGenerator())
     editor.fieldChanged.connect(self.on_expression_fieldChange)
     editor.setAutoFillBackground(True)
     editor.setAllowEvalErrors(self.parent().dialogType == DIALOG_MODELER)
     return editor
예제 #9
0
 def __addRow(self):
     """
     Add a row for the fields
     """
     count = self.mTableWidget.rowCount()
     self.mTableWidget.insertRow(count)
     comboBox = QtWidgets.QComboBox()
     layer = self.mLayerOutput.currentLayer()
     comboBox.insertItems(0, [f.displayName() for f in layer.fields()])
     self.mTableWidget.setCellWidget(count, 0, comboBox)
     expr = QgsFieldExpressionWidget()
     expr.setLayer(layer)
     self.mTableWidget.setCellWidget(count, 1, expr)
 def __init__(self,
              qgsfieldexpressionwidget=None,
              qgscolorbutton=None,
              qspinbox=None):
     self._qgsfieldexpressionwidget = qgsfieldexpressionwidget
     if qgsfieldexpressionwidget is None:
         self._qgsfieldexpressionwidget = QgsFieldExpressionWidget()
     self._qgscolorbutton = qgscolorbutton
     if qgscolorbutton is None:
         self._qgscolorbutton = QgsColorButton()
     self._qspinbox = qspinbox
     if qspinbox is None:
         self._qspinbox = QtGui.QSpinBox()
     self._last_feature = None
예제 #11
0
 def createEditor(self, parent, option, index):
     editor = QgsFieldExpressionWidget(parent)
     editor.setLayer(index.model().layer())
     editor.registerExpressionContextGenerator(index.model().contextGenerator())
     editor.fieldChanged.connect(self.on_expression_fieldChange)
     editor.setAutoFillBackground(True)
     return editor
예제 #12
0
 def setupGroupBoxFilters(self, isSpatial=True):
     """
     Sets up the part the spatial/complex layers' GUI part. It does not handle selection (e.g.
     everyone is selected).
     :param isSpatial: (bool) indicates whether groupbox to be set is spatial (or complex).
     """
     gb = self.mGroupBox if isSpatial else self.mGroupBox_2
     layers = self.spatialLayers if isSpatial else self.complexLayers
     layout = self.spatialGridLayout if isSpatial else self.complexGridLayout
     for row, (layerName, layerFcMap) in enumerate(layers.items()):
         checkBoxWidget, fieldExpressionWidget = QCheckBox(
         ), QgsFieldExpressionWidget()
         _, layer = self._abstractDb.getTableSchema(layerName)
         checkBoxWidget.setChecked(True)
         # allow filtering option only when layer is marked to be filtered
         checkBoxWidget.toggled.connect(fieldExpressionWidget.setEnabled)
         checkBoxWidget.toggled.connect(
             partial(fieldExpressionWidget.setExpression, ""))
         msg = self.tr('{0} ({1} features)'
                       ) if layerFcMap['featureCount'] > 1 else self.tr(
                           '{0} ({1} feature)')
         checkBoxWidget.setText(
             msg.format(layer, layerFcMap['featureCount']))
         fieldExpressionWidget.setLayer(layerFcMap['layer'])
         layout.addWidget(checkBoxWidget, row, 0)
         layout.addWidget(fieldExpressionWidget, row, 1)
예제 #13
0
 def filterExpressionWidget(self):
     """
     Retrieves a new widget for filtering expression setting.
     :return: (QgsFieldExpressionWidget) snap mode selection widget.
     """
     filterWidget = QgsFieldExpressionWidget()
     return filterWidget
예제 #14
0
    def setupUi(self, ComboEditWidget):
        ComboEditWidget.setObjectName("ComboEditWidget")
        ComboEditWidget.resize(259, 52)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            ComboEditWidget.sizePolicy().hasHeightForWidth())
        ComboEditWidget.setSizePolicy(sizePolicy)
        ComboEditWidget.setMinimumSize(QtCore.QSize(50, 0))
        self.formLayout = QtWidgets.QFormLayout(ComboEditWidget)
        self.formLayout.setContentsMargins(0, 2, 0, 2)
        self.formLayout.setObjectName("formLayout")
        self.gridLayout_1 = QtWidgets.QGridLayout()
        self.gridLayout_1.setObjectName("gridLayout_1")
        self.comboBox = QtWidgets.QComboBox(ComboEditWidget)
        self.comboBox.setMinimumSize(QtCore.QSize(125, 0))
        self.comboBox.setObjectName("comboBox")
        self.gridLayout_1.addWidget(self.comboBox, 0, 2, 1, 1)
        self.checkBox = QtWidgets.QCheckBox(ComboEditWidget)
        self.checkBox.setObjectName("checkBox")
        self.gridLayout_1.addWidget(self.checkBox, 0, 4, 1, 1)
        self.toolButton = QtWidgets.QToolButton(ComboEditWidget)
        self.toolButton.setObjectName("toolButton")
        self.gridLayout_1.addWidget(self.toolButton, 0, 5, 1, 1)
        self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole,
                                  self.gridLayout_1)
        self.label_1 = QtWidgets.QLabel(ComboEditWidget)
        self.label_1.setMinimumSize(QtCore.QSize(50, 0))
        self.label_1.setObjectName("label_1")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_1)
        self.expression = QgsFieldExpressionWidget(ComboEditWidget)
        self.expression.setMinimumSize(QtCore.QSize(20, 20))
        self.expression.setObjectName("expression")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.expression)
        self.label_2 = QtWidgets.QLabel(ComboEditWidget)
        self.label_2.setMinimumSize(QtCore.QSize(50, 0))
        self.label_2.setText("")
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)

        self.retranslateUi(ComboEditWidget)
        QtCore.QMetaObject.connectSlotsByName(ComboEditWidget)
예제 #15
0
 def createEditor(self, parent, option, index):
     editor = QgsFieldExpressionWidget(parent)
     editor.setLayer(index.model().layer())
     editor.registerExpressionContextGenerator(index.model().contextGenerator())
     editor.fieldChanged.connect(self.on_expression_fieldChange)
     editor.setAutoFillBackground(True)
     return editor
예제 #16
0
    def addExpressionWidget(self):
        hor = QtGui.QHBoxLayout()
        fieldExp = QgsFieldExpressionWidget()
        combo = QtGui.QComboBox()
        hor.addWidget(combo)
        self.combos.append(combo)
        hor.addWidget(fieldExp)
        del_btn = QtGui.QPushButton(self.tr("Delete"))
        hor.addWidget(del_btn)
        self.dels.append(del_btn)
        self.verticalLayout.addLayout(hor)
        self.exps.append(fieldExp)
        self.hors.append(hor)
        if self.slave is not None:
            self.updateComboBoxFromLayerAttributes(combo, self.slave.fields())
        if self.master is not None:
            fieldExp.setLayer(self.master)

        del_btn.clicked.connect(self.removeExpressionWidget)
예제 #17
0
    def addExpressionWidget(self):
        hor = QHBoxLayout()
        fieldExp = QgsFieldExpressionWidget()
        combo = QComboBox()
        hor.addWidget(combo)
        self.combos.append(combo)
        hor.addWidget(fieldExp)
        del_btn = QPushButton(self.tr("Delete"))
        hor.addWidget(del_btn)
        self.dels.append(del_btn)
        self.verticalLayout.addLayout(hor)
        self.exps.append(fieldExp)
        self.hors.append(hor)
        if self.slave is not None:
            self.updateComboBoxFromLayerAttributes(combo, self.slave.fields())
        if self.master is not None:
            fieldExp.setLayer(self.master)

        del_btn.clicked.connect(self.removeExpressionWidget)
예제 #18
0
    def createEditor(self, parent, option, index):
        column = index.column()

        fieldType = FieldsMappingModel.columns[column]['type']
        if fieldType == QtCore.QVariant.Type:
            editor = QtGui.QComboBox(parent)
            for key, text in FieldsMappingModel.fieldTypes.iteritems():
                editor.addItem(text, key)

        elif fieldType == QgsExpression:
            editor = QgsFieldExpressionWidget(parent)
            editor.setLayer(index.model().layer())
            # editor.fieldChanged.connect(self.on_expression_fieldChange)

        else:
            editor = QtGui.QStyledItemDelegate.createEditor(self, parent, option, index)

        editor.setAutoFillBackground(True)
        return editor
예제 #19
0
    def addLayerFields(self, layer_source):
        layer = layer_source.layer

        if layer.type() != QgsMapLayer.VectorLayer:
            return

        for i, field in enumerate(layer.fields()):
            row = self.rowCount()
            ews = layer.editorWidgetSetup(i)

            if ews.type() == 'ExternalResource':
                # for later: if ews.config().get('DocumentViewer', QgsExternalResourceWidget.NoContent) == QgsExternalResourceWidget.Image:
                self.insertRow(row)
                item = QTableWidgetItem(layer.name())
                item.setData(Qt.UserRole, layer_source)
                self.setItem(row, 0, item)
                item = QTableWidgetItem(field.name())
                self.setItem(row, 1, item)
                ew = QgsFieldExpressionWidget()
                ew.setLayer(layer)
                expression = layer_source.photo_naming(field.name())
                ew.setExpression(expression)
                self.setCellWidget(row, 2, ew)

        self.resizeColumnsToContents()
    def copy(self):
        field_expression_widget = QgsFieldExpressionWidget()
        field_expression_widget.setLayer(
            self._qgsfieldexpressionwidget.layer())
        field_expression_widget.setField(
            self._qgsfieldexpressionwidget.currentText())

        color_btn_widget = QgsColorButton()
        color_btn_widget.setColor(self._qgscolorbutton.color())
        spinbox = QtGui.QSpinBox()
        spinbox.setValue(self._qspinbox.value())
        return PresetRow(field_expression_widget, color_btn_widget, spinbox)
예제 #21
0
    def createEditor(self, parent, option, index):
        column = index.column()

        fieldType = FieldsMappingModel.columns[column]['type']
        if fieldType == QVariant.Type:
            editor = QComboBox(parent)
            for key, text in list(FieldsMappingModel.fieldTypes.items()):
                editor.addItem(text, key)

        elif fieldType == QgsExpression:
            editor = QgsFieldExpressionWidget(parent)
            editor.setLayer(index.model().layer())
            editor.fieldChanged.connect(self.on_expression_fieldChange)

        else:
            editor = QStyledItemDelegate.createEditor(self, parent, option, index)

        editor.setAutoFillBackground(True)
        return editor
예제 #22
0
    def __init__(self, dialog):
        super(ExecuteSQLWidget, self).__init__(None)
        self.setupUi(self)
        self.dialog = dialog
        self.dialogType = dialogTypes[dialog.__class__.__name__]

        self.mExpressionWidget = QgsFieldExpressionWidget()

        # add model parameters in context scope if called from modeler
        if self.dialogType == DIALOG_MODELER:
            strings = dialog.getAvailableValuesOfType(
                [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
            model_params = [dialog.resolveValueDescription(s) for s in strings]

            scope = QgsExpressionContextScope()
            for param in model_params:
                var = QgsExpressionContextScope.StaticVariable(param)
                scope.addVariable(var)

            self.mExpressionWidget.appendScope(scope)

        self.mHLayout.insertWidget(0, self.mExpressionWidget)

        self.mInsert.clicked.connect(self.insert)
예제 #23
0
 def createWidget(self):
     if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
         if self.param.parent_layer:
             widget = QgsFieldExpressionWidget()
         else:
             widget = QgsExpressionLineEdit()
         if self.param.default:
             widget.setExpression(self.param.default)
     else:
         strings = self.dialog.getAvailableValuesOfType(
             [ParameterExpression, ParameterString, ParameterNumber],
             OutputString)
         options = [(self.dialog.resolveValueDescription(s), s)
                    for s in strings]
         widget = QComboBox()
         widget.setEditable(True)
         for desc, val in options:
             widget.addItem(desc, val)
         widget.setEditText(self.param.default or "")
     return widget
class PresetRow():
    def __init__(self,
                 qgsfieldexpressionwidget=None,
                 qgscolorbutton=None,
                 qspinbox=None):
        self._qgsfieldexpressionwidget = qgsfieldexpressionwidget
        if qgsfieldexpressionwidget is None:
            self._qgsfieldexpressionwidget = QgsFieldExpressionWidget()
        self._qgscolorbutton = qgscolorbutton
        if qgscolorbutton is None:
            self._qgscolorbutton = QgsColorButton()
        self._qspinbox = qspinbox
        if qspinbox is None:
            self._qspinbox = QtGui.QSpinBox()
        self._last_feature = None

    def set_layer(self, layer_id):
        self._qgsfieldexpressionwidget.setLayer(layer_id)

    def __del__(self):
        self._qgsfieldexpressionwidget.deleteLater()
        self._qgsfieldexpressionwidget = None
        self._qgscolorbutton.deleteLater()
        self._qgscolorbutton = None
        self._qspinbox.deleteLater()
        self._qspinbox = None

    def __str__(self):
        return "{}-{}-{}".format(str(self._qgsfieldexpressionwidget),
                                 str(self._qgscolorbutton),
                                 str(self._qspinbox))

    def __repr__(self):
        return self.__str__()

    def asLst(self):
        return self._qgscolorbutton, self._qgsfieldexpressionwidget, self._qspinbox

    @property
    def qgsfieldexp(self):
        return self._qgsfieldexpressionwidget

    @property
    def exp_txt(self):
        return self._qgsfieldexpressionwidget.currentText()

    @property
    def qgscolorbutton(self):
        return self._qgscolorbutton

    @property
    def qspinbox(self):
        return self._qspinbox

    @property
    def lvl(self):
        return self._qspinbox.value()

    def copy(self):
        field_expression_widget = QgsFieldExpressionWidget()
        field_expression_widget.setLayer(
            self._qgsfieldexpressionwidget.layer())
        field_expression_widget.setField(
            self._qgsfieldexpressionwidget.currentText())

        color_btn_widget = QgsColorButton()
        color_btn_widget.setColor(self._qgscolorbutton.color())
        spinbox = QtGui.QSpinBox()
        spinbox.setValue(self._qspinbox.value())
        return PresetRow(field_expression_widget, color_btn_widget, spinbox)

    #===========================================================================
    #
    #===========================================================================
    def dump(self):
        exp = self._qgsfieldexpressionwidget.currentText()
        #color=self._qgscolorbutton.color().name()
        color = self._qgscolorbutton.color().rgba()
        idx = self._qspinbox.value()
        res = {"exp": exp, "color": color, "idx": idx}
        return json.dumps(res)

    #=======================================================================
    #
    #=======================================================================
    def load(self, str_dump):
        res = json.loads(str_dump)
        self._qgsfieldexpressionwidget.setField(res["exp"])
        #self._qgscolorbutton.color().setNamedColor(res["color"])
        qcolor = self._qgscolorbutton.color()
        qcolor.setRgba(res["color"])
        self._qgscolorbutton.setColor(qcolor)
        self._qspinbox.setValue(res["idx"])

    @property
    def exp(self):
        return QgsExpression(self._qgsfieldexpressionwidget.asExpression())

    @property
    def qcolor(self):
        return self._qgscolorbutton.color()

    @property
    def color_rgba(self):
        return self._qgscolorbutton.color().rgba()

    @property
    def color_hex(self):
        return self._qgscolorbutton.color().name()

    def setFeature(self, feature):
        self._last_feature = feature

    def execute(self, feature=None):
        if feature is not None:
            self.setFeature(feature)
        if self._last_feature is None: return None
        else: return self.exp.evaluate(self._last_feature)
예제 #25
0
class ExecuteSQLWidget(BASE, WIDGET):

    def __init__(self, dialog):
        super(ExecuteSQLWidget, self).__init__(None)
        self.setupUi(self)
        self.dialog = dialog
        self.dialogType = dialogTypes[dialog.__class__.__name__]

        self.mExpressionWidget = QgsFieldExpressionWidget()

        # add model parameters in context scope if called from modeler
        if self.dialogType == DIALOG_MODELER:
            strings = dialog.getAvailableValuesOfType(
                [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
            model_params = [dialog.resolveValueDescription(s) for s in strings]

            scope = QgsExpressionContextScope()
            for param in model_params:
                var = QgsExpressionContextScope.StaticVariable(param)
                scope.addVariable(var)

            self.mExpressionWidget.appendScope(scope)

        self.mHLayout.insertWidget(0, self.mExpressionWidget)

        self.mInsert.clicked.connect(self.insert)

    def insert(self):
        if self.mExpressionWidget.currentText():
            exp = '[%{}%]'.format(self.mExpressionWidget.currentText())
            self.mText.insertPlainText(exp)

    def setValue(self, value):
        text = value

        if self.dialogType == DIALOG_MODELER:
            if isinstance(value, list):
                for v in value:
                    if isinstance(v, QgsProcessingModelChildParameterSource) \
                            and v.source() == QgsProcessingModelChildParameterSource.ExpressionText:
                        text = v.expressionText()

                        # replace parameter's name by expression (diverging after model save)
                        names = QgsExpression.referencedVariables(text)

                        strings = self.dialog.getAvailableValuesOfType(
                            [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
                        model_params = [(self.dialog.resolveValueDescription(s), s) for s in strings]

                        for k, v in model_params:
                            if v.parameterName() in names:
                                text = text.replace('[% @{} %]'.format(v.parameterName()), '[% @{} %]'.format(k))

        self.mText.setPlainText(text)

    def value(self):
        value = self.mText.toPlainText()

        if self.dialogType == DIALOG_MODELER:
            expression_values = self._expressionValues(value)
            if len(expression_values) > 1:
                value = expression_values

        return value

    def _expressionValues(self, text):
        strings = self.dialog.getAvailableValuesOfType(
            [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
        model_params = [(self.dialog.resolveValueDescription(s), s) for s in strings]

        variables = QgsExpression.referencedVariables(text)

        # replace description by parameter's name (diverging after model save)
        descriptions = QgsExpression.referencedVariables(text)

        for k, v in model_params:
            if k in descriptions:
                text = text.replace('[% @{} %]'.format(k), '[% @{} %]'.format(v.parameterName()))

        src = QgsProcessingModelChildParameterSource.fromExpressionText(text)

        # add parameters currently used by the expression
        expression_values = []
        expression_values.append(src)

        for k, v in model_params:
            if k in variables:
                expression_values.append(v)

        return expression_values
예제 #26
0
    def setupUi(self, changeDataSourceDialogBase):
        changeDataSourceDialogBase.setObjectName(_fromUtf8("changeDataSourceDialogBase"))
        changeDataSourceDialogBase.resize(1027, 461)
        self.verticalLayout = QtGui.QVBoxLayout(changeDataSourceDialogBase)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.layerTable = QtGui.QTableWidget(changeDataSourceDialogBase)
        self.layerTable.setAlternatingRowColors(True)
        self.layerTable.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
        self.layerTable.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.layerTable.setGridStyle(QtCore.Qt.DotLine)
        self.layerTable.setObjectName(_fromUtf8("layerTable"))
        self.layerTable.setColumnCount(0)
        self.layerTable.setRowCount(0)
        self.layerTable.horizontalHeader().setHighlightSections(False)
        self.layerTable.horizontalHeader().setSortIndicatorShown(True)
        self.layerTable.verticalHeader().setVisible(True)
        self.verticalLayout.addWidget(self.layerTable)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(changeDataSourceDialogBase)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.findEdit = QtGui.QLineEdit(changeDataSourceDialogBase)
        self.findEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.findEdit.setObjectName(_fromUtf8("findEdit"))
        self.horizontalLayout.addWidget(self.findEdit)
        self.label_2 = QtGui.QLabel(changeDataSourceDialogBase)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout.addWidget(self.label_2)
        self.replaceEdit = QtGui.QLineEdit(changeDataSourceDialogBase)
        self.replaceEdit.setMaximumSize(QtCore.QSize(100, 16777215))
        self.replaceEdit.setObjectName(_fromUtf8("replaceEdit"))
        self.horizontalLayout.addWidget(self.replaceEdit)
        self.label_4 = QtGui.QLabel(changeDataSourceDialogBase)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.horizontalLayout.addWidget(self.label_4)
        self.mFieldExpressionWidget = QgsFieldExpressionWidget(changeDataSourceDialogBase)
        self.mFieldExpressionWidget.setObjectName(_fromUtf8("mFieldExpressionWidget"))
        self.horizontalLayout.addWidget(self.mFieldExpressionWidget)
        self.label_3 = QtGui.QLabel(changeDataSourceDialogBase)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.horizontalLayout.addWidget(self.label_3)
        self.datasourceCombo = QtGui.QComboBox(changeDataSourceDialogBase)
        self.datasourceCombo.setObjectName(_fromUtf8("datasourceCombo"))
        self.horizontalLayout.addWidget(self.datasourceCombo)
        self.onlySelectedCheck = QtGui.QCheckBox(changeDataSourceDialogBase)
        self.onlySelectedCheck.setObjectName(_fromUtf8("onlySelectedCheck"))
        self.horizontalLayout.addWidget(self.onlySelectedCheck)
        self.replaceButton = QtGui.QPushButton(changeDataSourceDialogBase)
        self.replaceButton.setObjectName(_fromUtf8("replaceButton"))
        self.horizontalLayout.addWidget(self.replaceButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.handleBadLayersCheckbox = QtGui.QCheckBox(changeDataSourceDialogBase)
        self.handleBadLayersCheckbox.setObjectName(_fromUtf8("handleBadLayersCheckbox"))
        self.horizontalLayout_2.addWidget(self.handleBadLayersCheckbox)
        self.reconcileButton = QtGui.QPushButton(changeDataSourceDialogBase)
        self.reconcileButton.setObjectName(_fromUtf8("reconcileButton"))
        self.horizontalLayout_2.addWidget(self.reconcileButton)
        self.buttonBox = QtGui.QDialogButtonBox(changeDataSourceDialogBase)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.buttonBox.sizePolicy().hasHeightForWidth())
        self.buttonBox.setSizePolicy(sizePolicy)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Apply|QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Reset)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.horizontalLayout_2.addWidget(self.buttonBox)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(changeDataSourceDialogBase)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), changeDataSourceDialogBase.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), changeDataSourceDialogBase.reject)
        QtCore.QMetaObject.connectSlotsByName(changeDataSourceDialogBase)
예제 #27
0
    def setupUi(self, VectorPropertiesWidget):
        VectorPropertiesWidget.setObjectName("VectorPropertiesWidget")
        VectorPropertiesWidget.resize(354, 481)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(VectorPropertiesWidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_4.setContentsMargins(8, -1, 6, -1)
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_ObjectType = QtWidgets.QLabel(VectorPropertiesWidget)
        self.label_ObjectType.setMinimumSize(QtCore.QSize(50, 0))
        self.label_ObjectType.setObjectName("label_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_ObjectType)
        self.comboBox_ObjectType = QtWidgets.QComboBox(VectorPropertiesWidget)
        self.comboBox_ObjectType.setObjectName("comboBox_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.comboBox_ObjectType)
        self.verticalLayout_2.addLayout(self.formLayout_4)
        self.label_ObjectTypeMessage = QtWidgets.QLabel(VectorPropertiesWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_ObjectTypeMessage.setFont(font)
        self.label_ObjectTypeMessage.setStyleSheet("font-weight: bold;")
        self.label_ObjectTypeMessage.setAlignment(QtCore.Qt.AlignCenter)
        self.label_ObjectTypeMessage.setWordWrap(True)
        self.label_ObjectTypeMessage.setObjectName("label_ObjectTypeMessage")
        self.verticalLayout_2.addWidget(self.label_ObjectTypeMessage)
        self.groupBox_zCoordinate = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_zCoordinate.setObjectName("groupBox_zCoordinate")
        self.verticalLayout_6 = QtWidgets.QVBoxLayout(
            self.groupBox_zCoordinate)
        self.verticalLayout_6.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.label_2 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_2.setObjectName("label_2")
        self.verticalLayout_6.addWidget(self.label_2)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setContentsMargins(4, -1, -1, -1)
        self.verticalLayout.setObjectName("verticalLayout")
        self.radioButton_Absolute = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_Absolute.setChecked(True)
        self.radioButton_Absolute.setObjectName("radioButton_Absolute")
        self.buttonGroup_zMode = QtWidgets.QButtonGroup(VectorPropertiesWidget)
        self.buttonGroup_zMode.setObjectName("buttonGroup_zMode")
        self.buttonGroup_zMode.addButton(self.radioButton_Absolute)
        self.verticalLayout.addWidget(self.radioButton_Absolute)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.radioButton_Relative = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_Relative.setObjectName("radioButton_Relative")
        self.buttonGroup_zMode.addButton(self.radioButton_Relative)
        self.horizontalLayout.addWidget(self.radioButton_Relative)
        self.comboBox_zDEMLayer = QtWidgets.QComboBox(
            self.groupBox_zCoordinate)
        self.comboBox_zDEMLayer.setObjectName("comboBox_zDEMLayer")
        self.horizontalLayout.addWidget(self.comboBox_zDEMLayer)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout_6.addLayout(self.verticalLayout)
        self.label_3 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_3.setObjectName("label_3")
        self.verticalLayout_6.addWidget(self.label_3)
        self.verticalLayout_5 = QtWidgets.QVBoxLayout()
        self.verticalLayout_5.setContentsMargins(4, -1, -1, -1)
        self.verticalLayout_5.setObjectName("verticalLayout_5")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.radioButton_FieldValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_FieldValue.setChecked(True)
        self.radioButton_FieldValue.setObjectName("radioButton_FieldValue")
        self.buttonGroup_zValue = QtWidgets.QButtonGroup(
            VectorPropertiesWidget)
        self.buttonGroup_zValue.setObjectName("buttonGroup_zValue")
        self.buttonGroup_zValue.addButton(self.radioButton_FieldValue)
        self.horizontalLayout_2.addWidget(self.radioButton_FieldValue)
        self.radioButton_zValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_zValue.setObjectName("radioButton_zValue")
        self.buttonGroup_zValue.addButton(self.radioButton_zValue)
        self.horizontalLayout_2.addWidget(self.radioButton_zValue)
        self.radioButton_mValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_mValue.setObjectName("radioButton_mValue")
        self.buttonGroup_zValue.addButton(self.radioButton_mValue)
        self.horizontalLayout_2.addWidget(self.radioButton_mValue)
        self.verticalLayout_5.addLayout(self.horizontalLayout_2)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label_zExpression = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_zExpression.setMinimumSize(QtCore.QSize(46, 0))
        self.label_zExpression.setObjectName("label_zExpression")
        self.gridLayout.addWidget(self.label_zExpression, 0, 0, 1, 1)
        self.fieldExpressionWidget_zCoordinate = QgsFieldExpressionWidget(
            self.groupBox_zCoordinate)
        self.fieldExpressionWidget_zCoordinate.setMinimumSize(
            QtCore.QSize(0, 20))
        self.fieldExpressionWidget_zCoordinate.setObjectName(
            "fieldExpressionWidget_zCoordinate")
        self.gridLayout.addWidget(self.fieldExpressionWidget_zCoordinate, 0, 1,
                                  1, 1)
        self.gridLayout.setColumnStretch(1, 1)
        self.verticalLayout_5.addLayout(self.gridLayout)
        self.verticalLayout_6.addLayout(self.verticalLayout_5)
        self.verticalLayout_2.addWidget(self.groupBox_zCoordinate)
        self.groupBox_Styles = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Styles.setMinimumSize(QtCore.QSize(0, 0))
        self.groupBox_Styles.setObjectName("groupBox_Styles")
        self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_Styles)
        self.gridLayout_8.setContentsMargins(9, 3, 9, 3)
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.verticalLayout_Styles = QtWidgets.QVBoxLayout()
        self.verticalLayout_Styles.setObjectName("verticalLayout_Styles")
        self.gridLayout_8.addLayout(self.verticalLayout_Styles, 1, 0, 1, 1)
        self.verticalLayout_2.addWidget(self.groupBox_Styles)
        self.groupBox_Features = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Features.setObjectName("groupBox_Features")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_Features)
        self.verticalLayout_3.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.radioButton_AllFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_AllFeatures.setObjectName("radioButton_AllFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_AllFeatures)
        self.radioButton_IntersectingFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_IntersectingFeatures.setChecked(True)
        self.radioButton_IntersectingFeatures.setObjectName(
            "radioButton_IntersectingFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_IntersectingFeatures)
        self.verticalLayout_Feature = QtWidgets.QVBoxLayout()
        self.verticalLayout_Feature.setContentsMargins(20, -1, -1, -1)
        self.verticalLayout_Feature.setObjectName("verticalLayout_Feature")
        self.checkBox_Clip = QtWidgets.QCheckBox(self.groupBox_Features)
        self.checkBox_Clip.setChecked(True)
        self.checkBox_Clip.setObjectName("checkBox_Clip")
        self.verticalLayout_Feature.addWidget(self.checkBox_Clip)
        self.verticalLayout_3.addLayout(self.verticalLayout_Feature)
        self.verticalLayout_2.addWidget(self.groupBox_Features)
        self.groupBox_Attrs = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Attrs.setObjectName("groupBox_Attrs")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_Attrs)
        self.verticalLayout_4.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.checkBox_ExportAttrs = QtWidgets.QCheckBox(self.groupBox_Attrs)
        self.checkBox_ExportAttrs.setChecked(False)
        self.checkBox_ExportAttrs.setObjectName("checkBox_ExportAttrs")
        self.verticalLayout_4.addWidget(self.checkBox_ExportAttrs)
        self.formLayout_Label = QtWidgets.QFormLayout()
        self.formLayout_Label.setContentsMargins(2, -1, 2, -1)
        self.formLayout_Label.setObjectName("formLayout_Label")
        self.label = QtWidgets.QLabel(self.groupBox_Attrs)
        self.label.setEnabled(False)
        self.label.setMinimumSize(QtCore.QSize(76, 0))
        self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing
                                | QtCore.Qt.AlignVCenter)
        self.label.setObjectName("label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                        self.label)
        self.comboBox_Label = QtWidgets.QComboBox(self.groupBox_Attrs)
        self.comboBox_Label.setEnabled(False)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_Label.sizePolicy().hasHeightForWidth())
        self.comboBox_Label.setSizePolicy(sizePolicy)
        self.comboBox_Label.setMaximumSize(QtCore.QSize(270, 16777215))
        self.comboBox_Label.setObjectName("comboBox_Label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                        self.comboBox_Label)
        self.verticalLayout_4.addLayout(self.formLayout_Label)
        self.verticalLayout_Label = QtWidgets.QVBoxLayout()
        self.verticalLayout_Label.setObjectName("verticalLayout_Label")
        self.verticalLayout_4.addLayout(self.verticalLayout_Label)
        self.verticalLayout_2.addWidget(self.groupBox_Attrs)
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem)

        self.retranslateUi(VectorPropertiesWidget)
        self.radioButton_IntersectingFeatures.toggled['bool'].connect(
            self.checkBox_Clip.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(VectorPropertiesWidget)
# coding: utf-8
from qgis.gui import QgsFieldExpressionWidget

field_expression_widget = QgsFieldExpressionWidget()

field_expression_widget.show()
예제 #29
0
class ExecuteSQLWidget(BASE, WIDGET):

    def __init__(self, dialog):
        super(ExecuteSQLWidget, self).__init__(None)
        self.setupUi(self)
        self.dialog = dialog
        self.dialogType = dialogTypes[dialog.__class__.__name__]

        self.mExpressionWidget = QgsFieldExpressionWidget()

        # add model parameters in context scope if called from modeler
        if self.dialogType == DIALOG_MODELER:
            strings = dialog.getAvailableValuesOfType(
                [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
            model_params = [dialog.resolveValueDescription(s) for s in strings]

            scope = QgsExpressionContextScope()
            for param in model_params:
                var = QgsExpressionContextScope.StaticVariable(param)
                scope.addVariable(var)

            self.mExpressionWidget.appendScope(scope)

        self.mHLayout.insertWidget(0, self.mExpressionWidget)

        self.mInsert.clicked.connect(self.insert)

    def insert(self):
        if self.mExpressionWidget.currentText():
            exp = '[%{}%]'.format(self.mExpressionWidget.currentText())
            self.mText.insertPlainText(exp)

    def setValue(self, value):
        text = value

        if self.dialogType == DIALOG_MODELER:
            if isinstance(value, list):
                for v in value:
                    if isinstance(v, QgsProcessingModelChildParameterSource) \
                            and v.source() == QgsProcessingModelChildParameterSource.ExpressionText:
                        text = v.expressionText()

                        # replace parameter's name by expression (diverging after model save)
                        names = QgsExpression.referencedVariables(text)

                        strings = self.dialog.getAvailableValuesOfType(
                            [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
                        model_params = [(self.dialog.resolveValueDescription(s), s) for s in strings]

                        for k, v in model_params:
                            if v.parameterName() in names:
                                text = text.replace('[% @{} %]'.format(v.parameterName()), '[% @{} %]'.format(k))

        self.mText.setPlainText(text)

    def value(self):
        value = self.mText.toPlainText()

        if self.dialogType == DIALOG_MODELER:
            expression_values = self._expressionValues(value)
            if len(expression_values) > 1:
                value = expression_values

        return value

    def _expressionValues(self, text):
        strings = self.dialog.getAvailableValuesOfType(
            [QgsProcessingParameterString, QgsProcessingParameterNumber], [])
        model_params = [(self.dialog.resolveValueDescription(s), s) for s in strings]

        variables = QgsExpression.referencedVariables(text)

        # replace description by parameter's name (diverging after model save)
        descriptions = QgsExpression.referencedVariables(text)

        for k, v in model_params:
            if k in descriptions:
                text = text.replace('[% @{} %]'.format(k), '[% @{} %]'.format(v.parameterName()))

        src = QgsProcessingModelChildParameterSource.fromExpressionText(text)

        # add parameters currently used by the expression
        expression_values = []
        expression_values.append(src)

        for k, v in model_params:
            if k in variables:
                expression_values.append(v)

        return expression_values
    def setupUi(self, VectorPropertiesWidget):
        VectorPropertiesWidget.setObjectName("VectorPropertiesWidget")
        VectorPropertiesWidget.resize(340, 410)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(VectorPropertiesWidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_4.setContentsMargins(12, -1, 10, -1)
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_ObjectType = QtWidgets.QLabel(VectorPropertiesWidget)
        self.label_ObjectType.setMinimumSize(QtCore.QSize(60, 0))
        self.label_ObjectType.setObjectName("label_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_ObjectType)
        self.comboBox_ObjectType = QtWidgets.QComboBox(VectorPropertiesWidget)
        self.comboBox_ObjectType.setObjectName("comboBox_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.comboBox_ObjectType)
        self.verticalLayout_2.addLayout(self.formLayout_4)
        self.groupBox_zCoordinate = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_zCoordinate.setObjectName("groupBox_zCoordinate")
        self.verticalLayout_6 = QtWidgets.QVBoxLayout(
            self.groupBox_zCoordinate)
        self.verticalLayout_6.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_2.setMinimumSize(QtCore.QSize(60, 0))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout_2.addWidget(self.label_2)
        self.radioButton_zValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_zValue.setObjectName("radioButton_zValue")
        self.buttonGroup_altitude = QtWidgets.QButtonGroup(
            VectorPropertiesWidget)
        self.buttonGroup_altitude.setObjectName("buttonGroup_altitude")
        self.buttonGroup_altitude.addButton(self.radioButton_zValue)
        self.horizontalLayout_2.addWidget(self.radioButton_zValue)
        self.radioButton_mValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_mValue.setObjectName("radioButton_mValue")
        self.buttonGroup_altitude.addButton(self.radioButton_mValue)
        self.horizontalLayout_2.addWidget(self.radioButton_mValue)
        self.radioButton_Expression = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_Expression.setChecked(True)
        self.radioButton_Expression.setObjectName("radioButton_Expression")
        self.buttonGroup_altitude.addButton(self.radioButton_Expression)
        self.horizontalLayout_2.addWidget(self.radioButton_Expression)
        self.verticalLayout_6.addLayout(self.horizontalLayout_2)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setContentsMargins(10, -1, -1, -1)
        self.formLayout.setObjectName("formLayout")
        self.label_zExpression = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_zExpression.setMinimumSize(QtCore.QSize(60, 0))
        self.label_zExpression.setObjectName("label_zExpression")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_zExpression)
        self.fieldExpressionWidget_altitude = QgsFieldExpressionWidget(
            self.groupBox_zCoordinate)
        self.fieldExpressionWidget_altitude.setMinimumSize(QtCore.QSize(0, 20))
        self.fieldExpressionWidget_altitude.setObjectName(
            "fieldExpressionWidget_altitude")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.fieldExpressionWidget_altitude)
        self.verticalLayout_6.addLayout(self.formLayout)
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_3 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_3.setMinimumSize(QtCore.QSize(60, 0))
        self.label_3.setObjectName("label_3")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_3)
        self.comboBox_altitudeMode = QtWidgets.QComboBox(
            self.groupBox_zCoordinate)
        self.comboBox_altitudeMode.setObjectName("comboBox_altitudeMode")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.comboBox_altitudeMode)
        self.verticalLayout_6.addLayout(self.formLayout_2)
        self.verticalLayout_2.addWidget(self.groupBox_zCoordinate)
        self.groupBox_Styles = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Styles.setMinimumSize(QtCore.QSize(0, 0))
        self.groupBox_Styles.setObjectName("groupBox_Styles")
        self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_Styles)
        self.gridLayout_8.setContentsMargins(9, 3, 9, 3)
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.verticalLayout_Styles = QtWidgets.QVBoxLayout()
        self.verticalLayout_Styles.setObjectName("verticalLayout_Styles")
        self.gridLayout_8.addLayout(self.verticalLayout_Styles, 1, 0, 1, 1)
        self.verticalLayout_2.addWidget(self.groupBox_Styles)
        self.groupBox_Features = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Features.setObjectName("groupBox_Features")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_Features)
        self.verticalLayout_3.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.radioButton_AllFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_AllFeatures.setObjectName("radioButton_AllFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_AllFeatures)
        self.radioButton_IntersectingFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_IntersectingFeatures.setChecked(True)
        self.radioButton_IntersectingFeatures.setObjectName(
            "radioButton_IntersectingFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_IntersectingFeatures)
        self.verticalLayout_Feature = QtWidgets.QVBoxLayout()
        self.verticalLayout_Feature.setContentsMargins(20, -1, -1, -1)
        self.verticalLayout_Feature.setObjectName("verticalLayout_Feature")
        self.checkBox_Clip = QtWidgets.QCheckBox(self.groupBox_Features)
        self.checkBox_Clip.setChecked(True)
        self.checkBox_Clip.setObjectName("checkBox_Clip")
        self.verticalLayout_Feature.addWidget(self.checkBox_Clip)
        self.verticalLayout_3.addLayout(self.verticalLayout_Feature)
        self.verticalLayout_2.addWidget(self.groupBox_Features)
        self.groupBox_Attrs = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Attrs.setObjectName("groupBox_Attrs")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_Attrs)
        self.verticalLayout_4.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.checkBox_ExportAttrs = QtWidgets.QCheckBox(self.groupBox_Attrs)
        self.checkBox_ExportAttrs.setChecked(False)
        self.checkBox_ExportAttrs.setObjectName("checkBox_ExportAttrs")
        self.verticalLayout_4.addWidget(self.checkBox_ExportAttrs)
        self.formLayout_Label = QtWidgets.QFormLayout()
        self.formLayout_Label.setObjectName("formLayout_Label")
        self.label = QtWidgets.QLabel(self.groupBox_Attrs)
        self.label.setEnabled(False)
        self.label.setMinimumSize(QtCore.QSize(60, 0))
        self.label.setObjectName("label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                        self.label)
        self.comboBox_Label = QtWidgets.QComboBox(self.groupBox_Attrs)
        self.comboBox_Label.setEnabled(False)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_Label.sizePolicy().hasHeightForWidth())
        self.comboBox_Label.setSizePolicy(sizePolicy)
        self.comboBox_Label.setMaximumSize(QtCore.QSize(270, 16777215))
        self.comboBox_Label.setObjectName("comboBox_Label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                        self.comboBox_Label)
        self.verticalLayout_4.addLayout(self.formLayout_Label)
        self.verticalLayout_Label = QtWidgets.QVBoxLayout()
        self.verticalLayout_Label.setObjectName("verticalLayout_Label")
        self.verticalLayout_4.addLayout(self.verticalLayout_Label)
        self.verticalLayout_2.addWidget(self.groupBox_Attrs)
        self.groupBox_Others = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Others.setObjectName("groupBox_Others")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox_Others)
        self.verticalLayout.setObjectName("verticalLayout")
        self.checkBox_Visible = QtWidgets.QCheckBox(self.groupBox_Others)
        self.checkBox_Visible.setChecked(True)
        self.checkBox_Visible.setObjectName("checkBox_Visible")
        self.verticalLayout.addWidget(self.checkBox_Visible)
        self.verticalLayout_2.addWidget(self.groupBox_Others)
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem)

        self.retranslateUi(VectorPropertiesWidget)
        self.radioButton_IntersectingFeatures.toggled['bool'].connect(
            self.checkBox_Clip.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(VectorPropertiesWidget)
        VectorPropertiesWidget.setTabOrder(self.comboBox_ObjectType,
                                           self.radioButton_zValue)
        VectorPropertiesWidget.setTabOrder(self.radioButton_zValue,
                                           self.radioButton_mValue)
        VectorPropertiesWidget.setTabOrder(self.radioButton_mValue,
                                           self.radioButton_Expression)
        VectorPropertiesWidget.setTabOrder(self.radioButton_Expression,
                                           self.comboBox_altitudeMode)
        VectorPropertiesWidget.setTabOrder(self.comboBox_altitudeMode,
                                           self.radioButton_AllFeatures)
        VectorPropertiesWidget.setTabOrder(
            self.radioButton_AllFeatures,
            self.radioButton_IntersectingFeatures)
        VectorPropertiesWidget.setTabOrder(
            self.radioButton_IntersectingFeatures, self.checkBox_Clip)
        VectorPropertiesWidget.setTabOrder(self.checkBox_Clip,
                                           self.checkBox_ExportAttrs)
        VectorPropertiesWidget.setTabOrder(self.checkBox_ExportAttrs,
                                           self.comboBox_Label)
예제 #31
0
    def setupUi(self, ContourDialog):
        ContourDialog.setObjectName("ContourDialog")
        ContourDialog.setWindowModality(QtCore.Qt.NonModal)
        ContourDialog.resize(655, 742)
        ContourDialog.setSizeGripEnabled(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(ContourDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.scrollArea_2 = QtWidgets.QScrollArea(ContourDialog)
        self.scrollArea_2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.scrollArea_2.setWidgetResizable(True)
        self.scrollArea_2.setObjectName("scrollArea_2")
        self.scrollAreaWidgetContents_2 = QtWidgets.QWidget()
        self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 641, 654))
        self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents_2)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.groupBox_2 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2)
        self.groupBox_2.setObjectName("groupBox_2")
        self.gridLayout = QtWidgets.QGridLayout(self.groupBox_2)
        self.gridLayout.setObjectName("gridLayout")
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setContentsMargins(-1, 0, -1, -1)
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_3 = QtWidgets.QLabel(self.groupBox_2)
        self.label_3.setObjectName("label_3")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_3)
        self.uSourceLayer = QgsMapLayerComboBox(self.groupBox_2)
        self.uSourceLayer.setObjectName("uSourceLayer")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.uSourceLayer)
        self.label_4 = QtWidgets.QLabel(self.groupBox_2)
        self.label_4.setObjectName("label_4")
        self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4)
        self.uDataField = QgsFieldExpressionWidget(self.groupBox_2)
        self.uDataField.setObjectName("uDataField")
        self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.uDataField)
        self.uSelectedOnly = QtWidgets.QCheckBox(self.groupBox_2)
        self.uSelectedOnly.setObjectName("uSelectedOnly")
        self.formLayout_2.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.uSelectedOnly)
        self.gridLayout.addLayout(self.formLayout_2, 1, 0, 1, 1)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtWidgets.QLabel(self.groupBox_2)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.uRemoveDuplicates = QtWidgets.QCheckBox(self.groupBox_2)
        self.uRemoveDuplicates.setText("")
        self.uRemoveDuplicates.setObjectName("uRemoveDuplicates")
        self.horizontalLayout.addWidget(self.uRemoveDuplicates)
        self.label_11 = QtWidgets.QLabel(self.groupBox_2)
        self.label_11.setObjectName("label_11")
        self.horizontalLayout.addWidget(self.label_11)
        self.uDuplicateTolerance = QtWidgets.QDoubleSpinBox(self.groupBox_2)
        self.uDuplicateTolerance.setDecimals(3)
        self.uDuplicateTolerance.setMinimum(0.001)
        self.uDuplicateTolerance.setMaximum(99999.999)
        self.uDuplicateTolerance.setSingleStep(0.001)
        self.uDuplicateTolerance.setProperty("value", 0.001)
        self.uDuplicateTolerance.setObjectName("uDuplicateTolerance")
        self.horizontalLayout.addWidget(self.uDuplicateTolerance)
        self.uUseGridLabel = QtWidgets.QLabel(self.groupBox_2)
        self.uUseGridLabel.setEnabled(True)
        self.uUseGridLabel.setObjectName("uUseGridLabel")
        self.horizontalLayout.addWidget(self.uUseGridLabel)
        self.uUseGrid = QtWidgets.QCheckBox(self.groupBox_2)
        self.uUseGrid.setText("")
        self.uUseGrid.setObjectName("uUseGrid")
        self.horizontalLayout.addWidget(self.uUseGrid)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.gridLayout.addLayout(self.horizontalLayout, 3, 0, 1, 1)
        self.uLayerDescription = QtWidgets.QLabel(self.groupBox_2)
        self.uLayerDescription.setText("")
        self.uLayerDescription.setObjectName("uLayerDescription")
        self.gridLayout.addWidget(self.uLayerDescription, 4, 0, 1, 1)
        self.verticalLayout_2.addWidget(self.groupBox_2)
        self.groupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.uLinesContours = QtWidgets.QRadioButton(self.groupBox)
        self.uLinesContours.setObjectName("uLinesContours")
        self.horizontalLayout_7.addWidget(self.uLinesContours)
        self.uFilledContours = QtWidgets.QRadioButton(self.groupBox)
        self.uFilledContours.setObjectName("uFilledContours")
        self.horizontalLayout_7.addWidget(self.uFilledContours)
        self.uBoth = QtWidgets.QRadioButton(self.groupBox)
        self.uBoth.setObjectName("uBoth")
        self.horizontalLayout_7.addWidget(self.uBoth)
        self.uLayerContours = QtWidgets.QRadioButton(self.groupBox)
        self.uLayerContours.setObjectName("uLayerContours")
        self.horizontalLayout_7.addWidget(self.uLayerContours)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem1)
        self.gridLayout_2.addLayout(self.horizontalLayout_7, 0, 0, 1, 3)
        spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_2.addItem(spacerItem2, 10, 1, 1, 1)
        self.label_5 = QtWidgets.QLabel(self.groupBox)
        self.label_5.setObjectName("label_5")
        self.gridLayout_2.addWidget(self.label_5, 5, 0, 1, 1)
        self.label = QtWidgets.QLabel(self.groupBox)
        self.label.setObjectName("label")
        self.gridLayout_2.addWidget(self.label, 3, 0, 1, 1)
        self.uNContour = QtWidgets.QSpinBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uNContour.sizePolicy().hasHeightForWidth())
        self.uNContour.setSizePolicy(sizePolicy)
        self.uNContour.setMinimum(1)
        self.uNContour.setMaximum(9999)
        self.uNContour.setProperty("value", 10)
        self.uNContour.setObjectName("uNContour")
        self.gridLayout_2.addWidget(self.uNContour, 3, 1, 1, 1)
        self.label_10 = QtWidgets.QLabel(self.groupBox)
        self.label_10.setObjectName("label_10")
        self.gridLayout_2.addWidget(self.label_10, 8, 0, 1, 1)
        self.uExtend = QtWidgets.QComboBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uExtend.sizePolicy().hasHeightForWidth())
        self.uExtend.setSizePolicy(sizePolicy)
        self.uExtend.setObjectName("uExtend")
        self.gridLayout_2.addWidget(self.uExtend, 8, 1, 1, 1)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setContentsMargins(-1, 0, -1, -1)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.uSetMaximum = QtWidgets.QCheckBox(self.groupBox)
        self.uSetMaximum.setObjectName("uSetMaximum")
        self.horizontalLayout_6.addWidget(self.uSetMaximum)
        self.uMaxContour = QtWidgets.QDoubleSpinBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uMaxContour.sizePolicy().hasHeightForWidth())
        self.uMaxContour.setSizePolicy(sizePolicy)
        self.uMaxContour.setLocale(QtCore.QLocale(QtCore.QLocale.C, QtCore.QLocale.AnyCountry))
        self.uMaxContour.setDecimals(4)
        self.uMaxContour.setMinimum(-999999999.0)
        self.uMaxContour.setMaximum(999999999.0)
        self.uMaxContour.setObjectName("uMaxContour")
        self.horizontalLayout_6.addWidget(self.uMaxContour)
        self.gridLayout_2.addLayout(self.horizontalLayout_6, 7, 1, 1, 1)
        self.label_7 = QtWidgets.QLabel(self.groupBox)
        self.label_7.setObjectName("label_7")
        self.gridLayout_2.addWidget(self.label_7, 1, 0, 1, 1)
        self.uMethod = QtWidgets.QComboBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uMethod.sizePolicy().hasHeightForWidth())
        self.uMethod.setSizePolicy(sizePolicy)
        self.uMethod.setObjectName("uMethod")
        self.gridLayout_2.addWidget(self.uMethod, 1, 1, 1, 1)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setContentsMargins(-1, 0, -1, -1)
        self.horizontalLayout_5.setSpacing(10)
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.uSetMinimum = QtWidgets.QCheckBox(self.groupBox)
        self.uSetMinimum.setObjectName("uSetMinimum")
        self.horizontalLayout_5.addWidget(self.uSetMinimum)
        self.uMinContour = QtWidgets.QDoubleSpinBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uMinContour.sizePolicy().hasHeightForWidth())
        self.uMinContour.setSizePolicy(sizePolicy)
        self.uMinContour.setLocale(QtCore.QLocale(QtCore.QLocale.C, QtCore.QLocale.AnyCountry))
        self.uMinContour.setDecimals(4)
        self.uMinContour.setMinimum(-999999999.0)
        self.uMinContour.setMaximum(999999999.0)
        self.uMinContour.setObjectName("uMinContour")
        self.horizontalLayout_5.addWidget(self.uMinContour)
        self.gridLayout_2.addLayout(self.horizontalLayout_5, 5, 1, 1, 1)
        self.label_6 = QtWidgets.QLabel(self.groupBox)
        self.label_6.setObjectName("label_6")
        self.gridLayout_2.addWidget(self.label_6, 7, 0, 1, 1)
        self.uContourInterval = QtWidgets.QDoubleSpinBox(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uContourInterval.sizePolicy().hasHeightForWidth())
        self.uContourInterval.setSizePolicy(sizePolicy)
        self.uContourInterval.setLocale(QtCore.QLocale(QtCore.QLocale.C, QtCore.QLocale.AnyCountry))
        self.uContourInterval.setDecimals(4)
        self.uContourInterval.setMinimum(-999999999.0)
        self.uContourInterval.setMaximum(999999999.0)
        self.uContourInterval.setObjectName("uContourInterval")
        self.gridLayout_2.addWidget(self.uContourInterval, 2, 1, 1, 1)
        self.label_15 = QtWidgets.QLabel(self.groupBox)
        self.label_15.setObjectName("label_15")
        self.gridLayout_2.addWidget(self.label_15, 2, 0, 1, 1)
        self.uLevelsList = QtWidgets.QListWidget(self.groupBox)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uLevelsList.sizePolicy().hasHeightForWidth())
        self.uLevelsList.setSizePolicy(sizePolicy)
        self.uLevelsList.setLocale(QtCore.QLocale(QtCore.QLocale.C, QtCore.QLocale.AnyCountry))
        self.uLevelsList.setObjectName("uLevelsList")
        self.gridLayout_2.addWidget(self.uLevelsList, 1, 2, 10, 1)
        self.verticalLayout_2.addWidget(self.groupBox)
        self.groupBox_3 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2)
        self.groupBox_3.setObjectName("groupBox_3")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_3)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setContentsMargins(-1, -1, -1, 6)
        self.formLayout.setObjectName("formLayout")
        self.label_8 = QtWidgets.QLabel(self.groupBox_3)
        self.label_8.setObjectName("label_8")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_8)
        self.uOutputName = QtWidgets.QLineEdit(self.groupBox_3)
        self.uOutputName.setObjectName("uOutputName")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.uOutputName)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(0, 0, -1, -1)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.uPrecision = QtWidgets.QSpinBox(self.groupBox_3)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uPrecision.sizePolicy().hasHeightForWidth())
        self.uPrecision.setSizePolicy(sizePolicy)
        self.uPrecision.setMinimum(-1)
        self.uPrecision.setMaximum(10)
        self.uPrecision.setProperty("value", 4)
        self.uPrecision.setObjectName("uPrecision")
        self.horizontalLayout_2.addWidget(self.uPrecision)
        self.label_14 = QtWidgets.QLabel(self.groupBox_3)
        self.label_14.setObjectName("label_14")
        self.horizontalLayout_2.addWidget(self.label_14)
        self.uTrimZeros = QtWidgets.QCheckBox(self.groupBox_3)
        self.uTrimZeros.setText("")
        self.uTrimZeros.setObjectName("uTrimZeros")
        self.horizontalLayout_2.addWidget(self.uTrimZeros)
        self.label_12 = QtWidgets.QLabel(self.groupBox_3)
        self.label_12.setObjectName("label_12")
        self.horizontalLayout_2.addWidget(self.label_12)
        self.uLabelUnits = QtWidgets.QLineEdit(self.groupBox_3)
        self.uLabelUnits.setObjectName("uLabelUnits")
        self.horizontalLayout_2.addWidget(self.uLabelUnits)
        spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem3)
        self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_2)
        self.label_9 = QtWidgets.QLabel(self.groupBox_3)
        self.label_9.setObjectName("label_9")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_9)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setContentsMargins(-1, -1, -1, 0)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.uApplyColors = QtWidgets.QCheckBox(self.groupBox_3)
        self.uApplyColors.setText("")
        self.uApplyColors.setObjectName("uApplyColors")
        self.horizontalLayout_4.addWidget(self.uApplyColors)
        self.uColorRamp = QgsColorRampButton(self.groupBox_3)
        self.uColorRamp.setObjectName("uColorRamp")
        self.horizontalLayout_4.addWidget(self.uColorRamp)
        self.uReverseRamp = QtWidgets.QCheckBox(self.groupBox_3)
        self.uReverseRamp.setObjectName("uReverseRamp")
        self.horizontalLayout_4.addWidget(self.uReverseRamp)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem4)
        self.horizontalLayout_4.setStretch(1, 1)
        self.formLayout.setLayout(2, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_4)
        self.label_13 = QtWidgets.QLabel(self.groupBox_3)
        self.label_13.setObjectName("label_13")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_13)
        self.gridLayout_4.addLayout(self.formLayout, 0, 0, 1, 1)
        self.verticalLayout_2.addWidget(self.groupBox_3)
        self.verticalLayout_2.setStretch(1, 1)
        self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
        self.verticalLayout.addWidget(self.scrollArea_2)
        self.uMessageBar = QgsMessageBar(ContourDialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.uMessageBar.sizePolicy().hasHeightForWidth())
        self.uMessageBar.setSizePolicy(sizePolicy)
        self.uMessageBar.setMinimumSize(QtCore.QSize(0, 27))
        self.uMessageBar.setObjectName("uMessageBar")
        self.verticalLayout.addWidget(self.uMessageBar)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setContentsMargins(-1, 0, -1, -1)
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.progressBar = QtWidgets.QProgressBar(ContourDialog)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setAlignment(QtCore.Qt.AlignCenter)
        self.progressBar.setTextVisible(True)
        self.progressBar.setObjectName("progressBar")
        self.horizontalLayout_8.addWidget(self.progressBar)
        self.uHelpButton = QtWidgets.QPushButton(ContourDialog)
        self.uHelpButton.setAutoDefault(False)
        self.uHelpButton.setObjectName("uHelpButton")
        self.horizontalLayout_8.addWidget(self.uHelpButton)
        self.uAddButton = QtWidgets.QPushButton(ContourDialog)
        self.uAddButton.setObjectName("uAddButton")
        self.horizontalLayout_8.addWidget(self.uAddButton)
        self.uCloseButton = QtWidgets.QPushButton(ContourDialog)
        self.uCloseButton.setObjectName("uCloseButton")
        self.horizontalLayout_8.addWidget(self.uCloseButton)
        self.verticalLayout.addLayout(self.horizontalLayout_8)
        self.verticalLayout.setStretch(0, 1)
        self.label_3.setBuddy(self.uSourceLayer)
        self.label_4.setBuddy(self.uDataField)
        self.label_2.setBuddy(self.uRemoveDuplicates)
        self.label_11.setBuddy(self.uDuplicateTolerance)
        self.uUseGridLabel.setBuddy(self.uUseGrid)
        self.label_5.setBuddy(self.uSetMinimum)
        self.label.setBuddy(self.uNContour)
        self.label_10.setBuddy(self.uExtend)
        self.label_7.setBuddy(self.uMethod)
        self.label_6.setBuddy(self.uSetMaximum)
        self.label_15.setBuddy(self.uContourInterval)
        self.label_8.setBuddy(self.uOutputName)
        self.label_14.setBuddy(self.uTrimZeros)
        self.label_12.setBuddy(self.uLabelUnits)
        self.label_9.setBuddy(self.uPrecision)
        self.label_13.setBuddy(self.uApplyColors)

        self.retranslateUi(ContourDialog)
        QtCore.QMetaObject.connectSlotsByName(ContourDialog)
        ContourDialog.setTabOrder(self.uSourceLayer, self.uSelectedOnly)
        ContourDialog.setTabOrder(self.uSelectedOnly, self.uRemoveDuplicates)
        ContourDialog.setTabOrder(self.uRemoveDuplicates, self.uDuplicateTolerance)
        ContourDialog.setTabOrder(self.uDuplicateTolerance, self.uLinesContours)
        ContourDialog.setTabOrder(self.uLinesContours, self.uFilledContours)
        ContourDialog.setTabOrder(self.uFilledContours, self.uBoth)
        ContourDialog.setTabOrder(self.uBoth, self.uLayerContours)
        ContourDialog.setTabOrder(self.uLayerContours, self.uMethod)
        ContourDialog.setTabOrder(self.uMethod, self.uContourInterval)
        ContourDialog.setTabOrder(self.uContourInterval, self.uNContour)
        ContourDialog.setTabOrder(self.uNContour, self.uSetMinimum)
        ContourDialog.setTabOrder(self.uSetMinimum, self.uMinContour)
        ContourDialog.setTabOrder(self.uMinContour, self.uSetMaximum)
        ContourDialog.setTabOrder(self.uSetMaximum, self.uMaxContour)
        ContourDialog.setTabOrder(self.uMaxContour, self.uExtend)
        ContourDialog.setTabOrder(self.uExtend, self.uLevelsList)
        ContourDialog.setTabOrder(self.uLevelsList, self.uOutputName)
        ContourDialog.setTabOrder(self.uOutputName, self.uPrecision)
        ContourDialog.setTabOrder(self.uPrecision, self.uTrimZeros)
        ContourDialog.setTabOrder(self.uTrimZeros, self.uLabelUnits)
        ContourDialog.setTabOrder(self.uLabelUnits, self.uApplyColors)
        ContourDialog.setTabOrder(self.uApplyColors, self.uColorRamp)
        ContourDialog.setTabOrder(self.uColorRamp, self.uReverseRamp)
        ContourDialog.setTabOrder(self.uReverseRamp, self.uAddButton)
        ContourDialog.setTabOrder(self.uAddButton, self.uCloseButton)
예제 #32
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(858, 36)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred,
            QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        Form.setMinimumSize(QtCore.QSize(0, 20))
        Form.setMaximumSize(QtCore.QSize(900, 50))
        Form.setToolTip("")
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.splitter = QtWidgets.QSplitter(Form)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.mMapLayerComboBox = QgsMapLayerComboBox(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mMapLayerComboBox.sizePolicy().hasHeightForWidth())
        self.mMapLayerComboBox.setSizePolicy(sizePolicy)
        self.mMapLayerComboBox.setMinimumSize(QtCore.QSize(0, 20))
        self.mMapLayerComboBox.setMaximumSize(QtCore.QSize(16777215, 32))
        self.mMapLayerComboBox.setFilters(
            core.QgsMapLayerProxyModel.HasGeometry
            | core.QgsMapLayerProxyModel.LineLayer
            | core.QgsMapLayerProxyModel.NoGeometry
            | core.QgsMapLayerProxyModel.PluginLayer
            | core.QgsMapLayerProxyModel.PointLayer
            | core.QgsMapLayerProxyModel.PolygonLayer
            | core.QgsMapLayerProxyModel.VectorLayer)
        self.mMapLayerComboBox.setObjectName("mMapLayerComboBox")
        self.refreshPushButton = QtWidgets.QPushButton(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.refreshPushButton.sizePolicy().hasHeightForWidth())
        self.refreshPushButton.setSizePolicy(sizePolicy)
        self.refreshPushButton.setMinimumSize(QtCore.QSize(24, 24))
        self.refreshPushButton.setMaximumSize(QtCore.QSize(24, 24))
        self.refreshPushButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/plugins/DsgTools/icons/reload.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.refreshPushButton.setIcon(icon)
        self.refreshPushButton.setIconSize(QtCore.QSize(16, 16))
        self.refreshPushButton.setObjectName("refreshPushButton")
        self.zoomPercentageSpinBox = QgsDoubleSpinBox(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.zoomPercentageSpinBox.sizePolicy().hasHeightForWidth())
        self.zoomPercentageSpinBox.setSizePolicy(sizePolicy)
        self.zoomPercentageSpinBox.setMinimumSize(QtCore.QSize(0, 20))
        self.zoomPercentageSpinBox.setMaximumSize(
            QtCore.QSize(16777215, 16777215))
        self.zoomPercentageSpinBox.setObjectName("zoomPercentageSpinBox")
        self.mScaleWidget = QgsScaleWidget(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mScaleWidget.sizePolicy().hasHeightForWidth())
        self.mScaleWidget.setSizePolicy(sizePolicy)
        self.mScaleWidget.setMinimumSize(QtCore.QSize(0, 20))
        self.mScaleWidget.setMaximumSize(QtCore.QSize(16194919, 32))
        self.mScaleWidget.setShowCurrentScaleButton(True)
        self.mScaleWidget.setObjectName("mScaleWidget")
        self.idSpinBox = QtWidgets.QSpinBox(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.idSpinBox.sizePolicy().hasHeightForWidth())
        self.idSpinBox.setSizePolicy(sizePolicy)
        self.idSpinBox.setMinimumSize(QtCore.QSize(40, 20))
        self.idSpinBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.idSpinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.idSpinBox.setSuffix("")
        self.idSpinBox.setObjectName("idSpinBox")
        self.backInspectButton = QtWidgets.QPushButton(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.backInspectButton.sizePolicy().hasHeightForWidth())
        self.backInspectButton.setSizePolicy(sizePolicy)
        self.backInspectButton.setMinimumSize(QtCore.QSize(24, 24))
        self.backInspectButton.setMaximumSize(QtCore.QSize(24, 24))
        self.backInspectButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(":/plugins/DsgTools/icons/backInspect.png"),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.backInspectButton.setIcon(icon)
        self.backInspectButton.setIconSize(QtCore.QSize(16, 16))
        self.backInspectButton.setObjectName("backInspectButton")
        self.nextInspectButton = QtWidgets.QPushButton(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.nextInspectButton.sizePolicy().hasHeightForWidth())
        self.nextInspectButton.setSizePolicy(sizePolicy)
        self.nextInspectButton.setMinimumSize(QtCore.QSize(24, 24))
        self.nextInspectButton.setMaximumSize(QtCore.QSize(24, 24))
        self.nextInspectButton.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(":/plugins/DsgTools/icons/nextInspect.png"),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.nextInspectButton.setIcon(icon1)
        self.nextInspectButton.setIconSize(QtCore.QSize(16, 16))
        self.nextInspectButton.setObjectName("nextInspectButton")
        self.mFieldExpressionWidget = QgsFieldExpressionWidget(self.splitter)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mFieldExpressionWidget.sizePolicy().hasHeightForWidth())
        self.mFieldExpressionWidget.setSizePolicy(sizePolicy)
        self.mFieldExpressionWidget.setMinimumSize(QtCore.QSize(0, 20))
        self.mFieldExpressionWidget.setObjectName("mFieldExpressionWidget")
        self.gridLayout.addWidget(self.splitter, 0, 2, 1, 1)
        self.inspectPushButton = QtWidgets.QPushButton(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.inspectPushButton.sizePolicy().hasHeightForWidth())
        self.inspectPushButton.setSizePolicy(sizePolicy)
        self.inspectPushButton.setMinimumSize(QtCore.QSize(24, 24))
        self.inspectPushButton.setMaximumSize(QtCore.QSize(24, 24))
        self.inspectPushButton.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(":/plugins/DsgTools/icons/inspectFeatures.png"),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.inspectPushButton.setIcon(icon2)
        self.inspectPushButton.setIconSize(QtCore.QSize(16, 16))
        self.inspectPushButton.setCheckable(True)
        self.inspectPushButton.setObjectName("inspectPushButton")
        self.gridLayout.addWidget(self.inspectPushButton, 0, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
예제 #33
0
class vectorLayerPropertyDlg(QDialog):
    '''
    classdocs
    '''
    def __init__(self, parent, layer):
        '''
        Constructor
        '''
        QDialog.__init__(self, parent)
        self.ui = Ui_VectorLayerProPertyDialog()
        self.ui.setupUi(self)

        self.ui.txtLayerName.setText(layer.name())
        self.ui.txtLayerSource.setText(layer.source())
        self.ui.txtCrs.setText(layer.crs().authid() + " - " +
                               layer.crs().description())
        self.ui.btnCrsSelect.clicked.connect(self.selectCrs)
        self.mCrs = layer.crs()
        self.vLayer = layer
        self.ui.mOptionsListWidget.currentRowChanged.connect(
            self.changeStackWidget)
        ''' init RenderV2 Widget'''
        self.mRendererDialog = QgsRendererV2PropertiesDialog(
            self.vLayer, QgsStyleV2.defaultStyle(), True)
        self.ui.stackedWidget.insertWidget(1, self.mRendererDialog)
        self.ui.buttonBox.accepted.connect(self.OK)

        frame_Label = QFrame()
        verticalLayout_Label = QVBoxLayout(frame_Label)
        self.mLabelWidget = QgsFieldExpressionWidget()
        self.mLabelWidget.setLayer(layer)
        verticalLayout_Label.addWidget(self.mLabelWidget)

        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        verticalLayout_Label.addItem(spacerItem)
        frame_Label.setLayout(verticalLayout_Label)
        self.ui.stackedWidget.insertWidget(2, frame_Label)
#         self.ui.buttonBox.accepted.connect(self.OK)

    def selectCrs(self):
        projectionDlg = QgsGenericProjectionSelector(self)
        projectionDlg.setSelectedAuthId(self.mCrs.authid())
        if projectionDlg.exec_():
            self.mCrs = QgsCoordinateReferenceSystem(
                projectionDlg.selectedCrsId(),
                QgsCoordinateReferenceSystem.InternalCrsId)
            self.ui.txtCrs.setText(self.mCrs.authid() + " - " +
                                   self.mCrs.description())

    def changeStackWidget(self, index):
        self.ui.stackedWidget.setCurrentIndex(index)

    def OK(self):
        self.vLayer.setCrs(self.mCrs)
        self.mRendererDialog.apply()
        self.vLayer.triggerRepaint()
        if self.ui.stackedWidget.currentIndex(
        ) == 2 and self.mLabelWidget.currentText() != "":
            self.vLayer.setCustomProperty("labeling", "pal")
            self.vLayer.setCustomProperty("labeling/enabled", "true")
            self.vLayer.setCustomProperty("labeling/fontFamily", "Arial")
            self.vLayer.setCustomProperty("labeling/fontSize", "8")
            self.vLayer.setCustomProperty("labeling/fieldName",
                                          self.mLabelWidget.currentText())

            # palLayerSetting = QgsPalLayerSettings()
            # palLayerSetting.readFromLayer(self.vLayer)
            # palLayerSetting.enabled = True
            # palLayerSetting.fieldName = self.mLabelWidget.currentText()
            # palLayerSetting.isExpression = True
            if self.vLayer.geometryType() == QGis.Line:
                self.vLayer.setCustomProperty("labeling/placement", "2")
                self.vLayer.setCustomProperty(
                    "labeling/placementFlags",
                    str(QgsPalLayerSettings.AboveLine))
                # palLayerSetting.placement = QgsPalLayerSettings.Line
                # palLayerSetting.placementFlags = QgsPalLayerSettings.AboveLine
            elif self.vLayer.geometryType() == QGis.Point:
                self.vLayer.setCustomProperty("labeling/placement", "0")
                self.vLayer.setCustomProperty(
                    "labeling/placementFlags",
                    str(QgsPalLayerSettings.AroundPoint))
                # self.vLayer.setCustomProperty("labeling/placementFlags", "0")
                # palLayerSetting.placement = QgsPalLayerSettings.Points
                # palLayerSetting.placementFlags = QgsPalLayerSettings.AroundPoint
            else:
                self.vLayer.setCustomProperty("labeling/placement", "3")
                self.vLayer.setCustomProperty(
                    "labeling/placementFlags",
                    str(QgsPalLayerSettings.AboveLine))
                # palLayerSetting.placement = QgsPalLayerSettings.PolygonBoundary
                # palLayerSetting.placementFlags = QgsPalLayerSettings.AboveLine
            # palLayerSetting.setDataDefinedProperty(QgsPalLayerSettings.Size, True, True, '8', "")
            # palLayerSetting.writeToLayer(self.vLayer)
        elif self.ui.stackedWidget.currentIndex(
        ) == 2 and self.mLabelWidget.currentText() == "":
            self.vLayer.setCustomProperty("labeling", "")
        QgsProject.instance().dirty(True)
        QDialog.accept(self)
예제 #34
0
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)
        # self.setObjectName(_fromUtf8("QgsAtlasCompositionWidgetBase"))
        self.resize(435, 359)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.verticalFrame = QtGui.QFrame(self)
        self.verticalFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.verticalFrame.setObjectName(_fromUtf8("verticalFrame"))
        self.gridLayout = QtGui.QGridLayout(self.verticalFrame)
        self.gridLayout.setMargin(0)
        self.gridLayout.setHorizontalSpacing(0)
        self.gridLayout.setVerticalSpacing(3)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.mUseAtlasCheckBox = QtGui.QCheckBox(self.verticalFrame)
        self.mUseAtlasCheckBox.setObjectName(_fromUtf8("mUseAtlasCheckBox"))
        self.gridLayout.addWidget(self.mUseAtlasCheckBox, 0, 1, 1, 1)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 2, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(12, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1)
        self.scrollArea = QtGui.QScrollArea(self.verticalFrame)
        self.scrollArea.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setEnabled(True)
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 431, 332))
        self.scrollAreaWidgetContents.setObjectName(_fromUtf8("scrollAreaWidgetContents"))
        self.mainLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
        self.mainLayout.setContentsMargins(-1, -1, -1, 0)
        self.mainLayout.setObjectName(_fromUtf8("mainLayout"))
        self.mConfigurationGroup = QgsCollapsibleGroupBoxBasic(self.scrollAreaWidgetContents)
        self.mConfigurationGroup.setEnabled(False)
        self.mConfigurationGroup.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mConfigurationGroup.setCheckable(False)
        self.mConfigurationGroup.setProperty("syncGroup", _fromUtf8("composeritem"))
        self.mConfigurationGroup.setProperty("collapsed", False)
        self.mConfigurationGroup.setObjectName(_fromUtf8("mConfigurationGroup"))
        self.gridLayout_2 = QtGui.QGridLayout(self.mConfigurationGroup)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.mAtlasSortFeatureDirectionButton = QtGui.QToolButton(self.mConfigurationGroup)
        self.mAtlasSortFeatureDirectionButton.setArrowType(QtCore.Qt.UpArrow)
        self.mAtlasSortFeatureDirectionButton.setObjectName(_fromUtf8("mAtlasSortFeatureDirectionButton"))
        self.gridLayout_2.addWidget(self.mAtlasSortFeatureDirectionButton, 4, 2, 1, 1)
        self.mAtlasSortFeatureKeyComboBox = QgsFieldComboBox(self.mConfigurationGroup)
        self.mAtlasSortFeatureKeyComboBox.setObjectName(_fromUtf8("mAtlasSortFeatureKeyComboBox"))
        self.gridLayout_2.addWidget(self.mAtlasSortFeatureKeyComboBox, 4, 1, 1, 1)
        self.mAtlasFeatureFilterCheckBox = QtGui.QCheckBox(self.mConfigurationGroup)
        self.mAtlasFeatureFilterCheckBox.setObjectName(_fromUtf8("mAtlasFeatureFilterCheckBox"))
        self.gridLayout_2.addWidget(self.mAtlasFeatureFilterCheckBox, 3, 0, 1, 1)
        self.mAtlasFeatureFilterButton = QtGui.QToolButton(self.mConfigurationGroup)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("Resource/images/themes/default/mIconExpression.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mAtlasFeatureFilterButton.setIcon(icon)
        self.mAtlasFeatureFilterButton.setObjectName(_fromUtf8("mAtlasFeatureFilterButton"))
        self.gridLayout_2.addWidget(self.mAtlasFeatureFilterButton, 3, 2, 1, 1)
        self.mAtlasHideCoverageCheckBox = QtGui.QCheckBox(self.mConfigurationGroup)
        self.mAtlasHideCoverageCheckBox.setObjectName(_fromUtf8("mAtlasHideCoverageCheckBox"))
        self.gridLayout_2.addWidget(self.mAtlasHideCoverageCheckBox, 1, 0, 1, 3)
        self.mHorizontalAlignementLabel = QtGui.QLabel(self.mConfigurationGroup)
        self.mHorizontalAlignementLabel.setObjectName(_fromUtf8("mHorizontalAlignementLabel"))
        self.gridLayout_2.addWidget(self.mHorizontalAlignementLabel, 0, 0, 1, 1)
        self.label = QtGui.QLabel(self.mConfigurationGroup)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout_2.addWidget(self.label, 2, 0, 1, 1)
        self.mAtlasFeatureFilterEdit = QtGui.QLineEdit(self.mConfigurationGroup)
        self.mAtlasFeatureFilterEdit.setObjectName(_fromUtf8("mAtlasFeatureFilterEdit"))
        self.gridLayout_2.addWidget(self.mAtlasFeatureFilterEdit, 3, 1, 1, 1)
        self.mAtlasCoverageLayerComboBox = QgsMapLayerComboBox(self.mConfigurationGroup)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mAtlasCoverageLayerComboBox.sizePolicy().hasHeightForWidth())
        self.mAtlasCoverageLayerComboBox.setSizePolicy(sizePolicy)
        self.mAtlasCoverageLayerComboBox.setObjectName(_fromUtf8("mAtlasCoverageLayerComboBox"))
        self.gridLayout_2.addWidget(self.mAtlasCoverageLayerComboBox, 0, 1, 1, 2)
        self.mPageNameWidget = QgsFieldExpressionWidget(self.mConfigurationGroup)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mPageNameWidget.sizePolicy().hasHeightForWidth())
        self.mPageNameWidget.setSizePolicy(sizePolicy)
        self.mPageNameWidget.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.mPageNameWidget.setObjectName(_fromUtf8("mPageNameWidget"))
        self.gridLayout_2.addWidget(self.mPageNameWidget, 2, 1, 1, 2)
        self.mAtlasSortFeatureCheckBox = QtGui.QCheckBox(self.mConfigurationGroup)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mAtlasSortFeatureCheckBox.sizePolicy().hasHeightForWidth())
        self.mAtlasSortFeatureCheckBox.setSizePolicy(sizePolicy)
        self.mAtlasSortFeatureCheckBox.setObjectName(_fromUtf8("mAtlasSortFeatureCheckBox"))
        self.gridLayout_2.addWidget(self.mAtlasSortFeatureCheckBox, 4, 0, 1, 1)
        self.gridLayout_2.setColumnStretch(1, 1)
        self.mainLayout.addWidget(self.mConfigurationGroup)
        self.mOutputGroup = QgsCollapsibleGroupBoxBasic(self.scrollAreaWidgetContents)
        self.mOutputGroup.setEnabled(False)
        self.mOutputGroup.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mOutputGroup.setCheckable(False)
        self.mOutputGroup.setProperty("syncGroup", _fromUtf8("composeritem"))
        self.mOutputGroup.setProperty("collapsed", False)
        self.mOutputGroup.setObjectName(_fromUtf8("mOutputGroup"))
        self.gridLayout_3 = QtGui.QGridLayout(self.mOutputGroup)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.label_4 = QtGui.QLabel(self.mOutputGroup)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout_3.addWidget(self.label_4, 0, 0, 1, 2)
        self.mAtlasFilenameExpressionButton = QtGui.QToolButton(self.mOutputGroup)
        self.mAtlasFilenameExpressionButton.setIcon(icon)
        self.mAtlasFilenameExpressionButton.setObjectName(_fromUtf8("mAtlasFilenameExpressionButton"))
        self.gridLayout_3.addWidget(self.mAtlasFilenameExpressionButton, 1, 2, 1, 1)
        self.mAtlasFilenamePatternEdit = QtGui.QLineEdit(self.mOutputGroup)
        self.mAtlasFilenamePatternEdit.setObjectName(_fromUtf8("mAtlasFilenamePatternEdit"))
        self.gridLayout_3.addWidget(self.mAtlasFilenamePatternEdit, 1, 0, 1, 2)
        self.mAtlasSingleFileCheckBox = QtGui.QCheckBox(self.mOutputGroup)
        self.mAtlasSingleFileCheckBox.setObjectName(_fromUtf8("mAtlasSingleFileCheckBox"))
        self.gridLayout_3.addWidget(self.mAtlasSingleFileCheckBox, 2, 0, 1, 3)
        self.mainLayout.addWidget(self.mOutputGroup)
        spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.mainLayout.addItem(spacerItem2)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout.addWidget(self.scrollArea, 1, 0, 1, 3)
        self.verticalLayout.addWidget(self.verticalFrame)

        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(self)
        self.setTabOrder(self.mUseAtlasCheckBox, self.mConfigurationGroup)
        self.setTabOrder(self.mConfigurationGroup, self.mAtlasCoverageLayerComboBox)
        self.setTabOrder(self.mAtlasCoverageLayerComboBox, self.mAtlasHideCoverageCheckBox)
        self.setTabOrder(self.mAtlasHideCoverageCheckBox, self.mAtlasFeatureFilterCheckBox)
        self.setTabOrder(self.mAtlasFeatureFilterCheckBox, self.mAtlasFeatureFilterEdit)
        self.setTabOrder(self.mAtlasFeatureFilterEdit, self.mAtlasFeatureFilterButton)
        self.setTabOrder(self.mAtlasFeatureFilterButton, self.mAtlasSortFeatureCheckBox)
        self.setTabOrder(self.mAtlasSortFeatureCheckBox, self.mAtlasSortFeatureKeyComboBox)
        self.setTabOrder(self.mAtlasSortFeatureKeyComboBox, self.mAtlasSortFeatureDirectionButton)
        self.setTabOrder(self.mAtlasSortFeatureDirectionButton, self.mOutputGroup)
        self.setTabOrder(self.mOutputGroup, self.mAtlasFilenamePatternEdit)
        self.setTabOrder(self.mAtlasFilenamePatternEdit, self.mAtlasFilenameExpressionButton)
        self.setTabOrder(self.mAtlasFilenameExpressionButton, self.mAtlasSingleFileCheckBox)
        self.setTabOrder(self.mAtlasSingleFileCheckBox, self.scrollArea)
예제 #35
0
class Ui_VectorPropertiesWidget(object):
    def setupUi(self, VectorPropertiesWidget):
        VectorPropertiesWidget.setObjectName("VectorPropertiesWidget")
        VectorPropertiesWidget.resize(354, 481)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(VectorPropertiesWidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.formLayout_4 = QtWidgets.QFormLayout()
        self.formLayout_4.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_4.setContentsMargins(8, -1, 6, -1)
        self.formLayout_4.setObjectName("formLayout_4")
        self.label_ObjectType = QtWidgets.QLabel(VectorPropertiesWidget)
        self.label_ObjectType.setMinimumSize(QtCore.QSize(50, 0))
        self.label_ObjectType.setObjectName("label_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_ObjectType)
        self.comboBox_ObjectType = QtWidgets.QComboBox(VectorPropertiesWidget)
        self.comboBox_ObjectType.setObjectName("comboBox_ObjectType")
        self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.comboBox_ObjectType)
        self.verticalLayout_2.addLayout(self.formLayout_4)
        self.groupBox_zCoordinate = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_zCoordinate.setObjectName("groupBox_zCoordinate")
        self.verticalLayout_6 = QtWidgets.QVBoxLayout(
            self.groupBox_zCoordinate)
        self.verticalLayout_6.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_6.setObjectName("verticalLayout_6")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_2 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_2.setMinimumSize(QtCore.QSize(46, 0))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout_2.addWidget(self.label_2)
        self.radioButton_zValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_zValue.setObjectName("radioButton_zValue")
        self.buttonGroup_altitude = QtWidgets.QButtonGroup(
            VectorPropertiesWidget)
        self.buttonGroup_altitude.setObjectName("buttonGroup_altitude")
        self.buttonGroup_altitude.addButton(self.radioButton_zValue)
        self.horizontalLayout_2.addWidget(self.radioButton_zValue)
        self.radioButton_mValue = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_mValue.setObjectName("radioButton_mValue")
        self.buttonGroup_altitude.addButton(self.radioButton_mValue)
        self.horizontalLayout_2.addWidget(self.radioButton_mValue)
        self.radioButton_Expression = QtWidgets.QRadioButton(
            self.groupBox_zCoordinate)
        self.radioButton_Expression.setChecked(True)
        self.radioButton_Expression.setObjectName("radioButton_Expression")
        self.buttonGroup_altitude.addButton(self.radioButton_Expression)
        self.horizontalLayout_2.addWidget(self.radioButton_Expression)
        self.verticalLayout_6.addLayout(self.horizontalLayout_2)
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setContentsMargins(10, -1, -1, -1)
        self.formLayout.setObjectName("formLayout")
        self.label_zExpression = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_zExpression.setMinimumSize(QtCore.QSize(46, 0))
        self.label_zExpression.setObjectName("label_zExpression")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_zExpression)
        self.fieldExpressionWidget_altitude = QgsFieldExpressionWidget(
            self.groupBox_zCoordinate)
        self.fieldExpressionWidget_altitude.setMinimumSize(QtCore.QSize(0, 20))
        self.fieldExpressionWidget_altitude.setObjectName(
            "fieldExpressionWidget_altitude")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.fieldExpressionWidget_altitude)
        self.verticalLayout_6.addLayout(self.formLayout)
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.label_3 = QtWidgets.QLabel(self.groupBox_zCoordinate)
        self.label_3.setMinimumSize(QtCore.QSize(46, 0))
        self.label_3.setObjectName("label_3")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                    self.label_3)
        self.comboBox_altitudeMode = QtWidgets.QComboBox(
            self.groupBox_zCoordinate)
        self.comboBox_altitudeMode.setObjectName("comboBox_altitudeMode")
        self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                    self.comboBox_altitudeMode)
        self.verticalLayout_6.addLayout(self.formLayout_2)
        self.verticalLayout_2.addWidget(self.groupBox_zCoordinate)
        self.groupBox_Styles = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Styles.setMinimumSize(QtCore.QSize(0, 0))
        self.groupBox_Styles.setObjectName("groupBox_Styles")
        self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_Styles)
        self.gridLayout_8.setContentsMargins(9, 3, 9, 3)
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.verticalLayout_Styles = QtWidgets.QVBoxLayout()
        self.verticalLayout_Styles.setObjectName("verticalLayout_Styles")
        self.gridLayout_8.addLayout(self.verticalLayout_Styles, 1, 0, 1, 1)
        self.verticalLayout_2.addWidget(self.groupBox_Styles)
        self.groupBox_Features = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Features.setObjectName("groupBox_Features")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_Features)
        self.verticalLayout_3.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.radioButton_AllFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_AllFeatures.setObjectName("radioButton_AllFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_AllFeatures)
        self.radioButton_IntersectingFeatures = QtWidgets.QRadioButton(
            self.groupBox_Features)
        self.radioButton_IntersectingFeatures.setChecked(True)
        self.radioButton_IntersectingFeatures.setObjectName(
            "radioButton_IntersectingFeatures")
        self.verticalLayout_3.addWidget(self.radioButton_IntersectingFeatures)
        self.verticalLayout_Feature = QtWidgets.QVBoxLayout()
        self.verticalLayout_Feature.setContentsMargins(20, -1, -1, -1)
        self.verticalLayout_Feature.setObjectName("verticalLayout_Feature")
        self.checkBox_Clip = QtWidgets.QCheckBox(self.groupBox_Features)
        self.checkBox_Clip.setChecked(True)
        self.checkBox_Clip.setObjectName("checkBox_Clip")
        self.verticalLayout_Feature.addWidget(self.checkBox_Clip)
        self.verticalLayout_3.addLayout(self.verticalLayout_Feature)
        self.verticalLayout_2.addWidget(self.groupBox_Features)
        self.groupBox_Attrs = QtWidgets.QGroupBox(VectorPropertiesWidget)
        self.groupBox_Attrs.setObjectName("groupBox_Attrs")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_Attrs)
        self.verticalLayout_4.setContentsMargins(9, 3, 9, 3)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.checkBox_ExportAttrs = QtWidgets.QCheckBox(self.groupBox_Attrs)
        self.checkBox_ExportAttrs.setChecked(False)
        self.checkBox_ExportAttrs.setObjectName("checkBox_ExportAttrs")
        self.verticalLayout_4.addWidget(self.checkBox_ExportAttrs)
        self.formLayout_Label = QtWidgets.QFormLayout()
        self.formLayout_Label.setContentsMargins(2, -1, 2, -1)
        self.formLayout_Label.setObjectName("formLayout_Label")
        self.label = QtWidgets.QLabel(self.groupBox_Attrs)
        self.label.setEnabled(False)
        self.label.setMinimumSize(QtCore.QSize(76, 0))
        self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing
                                | QtCore.Qt.AlignVCenter)
        self.label.setObjectName("label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                        self.label)
        self.comboBox_Label = QtWidgets.QComboBox(self.groupBox_Attrs)
        self.comboBox_Label.setEnabled(False)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.comboBox_Label.sizePolicy().hasHeightForWidth())
        self.comboBox_Label.setSizePolicy(sizePolicy)
        self.comboBox_Label.setMaximumSize(QtCore.QSize(270, 16777215))
        self.comboBox_Label.setObjectName("comboBox_Label")
        self.formLayout_Label.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                        self.comboBox_Label)
        self.verticalLayout_4.addLayout(self.formLayout_Label)
        self.verticalLayout_Label = QtWidgets.QVBoxLayout()
        self.verticalLayout_Label.setObjectName("verticalLayout_Label")
        self.verticalLayout_4.addLayout(self.verticalLayout_Label)
        self.verticalLayout_2.addWidget(self.groupBox_Attrs)
        spacerItem = QtWidgets.QSpacerItem(20, 40,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem)

        self.retranslateUi(VectorPropertiesWidget)
        self.radioButton_IntersectingFeatures.toggled['bool'].connect(
            self.checkBox_Clip.setEnabled)
        QtCore.QMetaObject.connectSlotsByName(VectorPropertiesWidget)

    def retranslateUi(self, VectorPropertiesWidget):
        _translate = QtCore.QCoreApplication.translate
        VectorPropertiesWidget.setWindowTitle(
            _translate("VectorPropertiesWidget", "Form"))
        self.label_ObjectType.setText(
            _translate("VectorPropertiesWidget", "Object type"))
        self.groupBox_zCoordinate.setTitle(
            _translate("VectorPropertiesWidget", "&Z coordinate"))
        self.label_2.setText(_translate("VectorPropertiesWidget", "Altitude"))
        self.radioButton_zValue.setText(
            _translate("VectorPropertiesWidget", "Z Value"))
        self.radioButton_mValue.setText(
            _translate("VectorPropertiesWidget", "M Value"))
        self.radioButton_Expression.setText(
            _translate("VectorPropertiesWidget", "Expression"))
        self.label_3.setText(_translate("VectorPropertiesWidget", "Mode"))
        self.groupBox_Styles.setTitle(
            _translate("VectorPropertiesWidget", "&Style"))
        self.groupBox_Features.setTitle(
            _translate("VectorPropertiesWidget", "&Features"))
        self.radioButton_AllFeatures.setText(
            _translate("VectorPropertiesWidget", "All features"))
        self.radioButton_IntersectingFeatures.setText(
            _translate("VectorPropertiesWidget",
                       "Features that intersect with map canvas extent"))
        self.checkBox_Clip.setText(
            _translate("VectorPropertiesWidget", "Clip geometries"))
        self.groupBox_Attrs.setTitle(
            _translate("VectorPropertiesWidget", "&Attribute and label"))
        self.checkBox_ExportAttrs.setText(
            _translate("VectorPropertiesWidget", "Export attributes"))
        self.label.setText(_translate("VectorPropertiesWidget", "Label field"))
예제 #36
0
 def createWidget(self):
     if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
         if self.param.parent_layer:
             widget = QgsFieldExpressionWidget()
         else:
             widget = QgsExpressionLineEdit()
         if self.param.default:
             widget.setExpression(self.param.default)
     else:
         strings = self.dialog.getAvailableValuesOfType([ParameterExpression, ParameterString, ParameterNumber], OutputString)
         options = [(self.dialog.resolveValueDescription(s), s) for s in strings]
         widget = QComboBox()
         widget.setEditable(True)
         for desc, val in options:
             widget.addItem(desc, val)
         widget.setEditText(self.param.default or "")
     return widget
    def setupUi(self, ProjectSearch):
        ProjectSearch.setObjectName(_fromUtf8("ProjectSearch"))
        ProjectSearch.resize(282, 295)
        self.formLayout = QtWidgets.QFormLayout(ProjectSearch)
        self.formLayout.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.label = QtWidgets.QLabel(ProjectSearch)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.searchName = QtWidgets.QLineEdit(ProjectSearch)
        self.searchName.setObjectName(_fromUtf8("searchName"))
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.searchName)
        self.layerLabel = QtWidgets.QLabel(ProjectSearch)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.layerLabel.sizePolicy().hasHeightForWidth())
        self.layerLabel.setSizePolicy(sizePolicy)
        self.layerLabel.setObjectName(_fromUtf8("layerLabel"))
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.layerLabel)
        self.layerCombo = QgsMapLayerComboBox(ProjectSearch)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.layerCombo.sizePolicy().hasHeightForWidth())
        self.layerCombo.setSizePolicy(sizePolicy)
        self.layerCombo.setSizeAdjustPolicy(
            QtWidgets.QComboBox.AdjustToContents)
        self.layerCombo.setObjectName(_fromUtf8("layerCombo"))
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.layerCombo)
        self.FieldNameLabel = QtWidgets.QLabel(ProjectSearch)
        self.FieldNameLabel.setObjectName(_fromUtf8("FieldNameLabel"))
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                  self.FieldNameLabel)
        self.fieldExpressionWidget = QgsFieldExpressionWidget(ProjectSearch)
        self.fieldExpressionWidget.setObjectName(
            _fromUtf8("fieldExpressionWidget"))
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                  self.fieldExpressionWidget)
        self.label_2 = QtWidgets.QLabel(ProjectSearch)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.priorityBox = QtWidgets.QSpinBox(ProjectSearch)
        self.priorityBox.setMinimum(1)
        self.priorityBox.setMaximum(999)
        self.priorityBox.setProperty("value", 1)
        self.priorityBox.setObjectName(_fromUtf8("priorityBox"))
        self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole,
                                  self.priorityBox)
        self.progressBar = QtWidgets.QProgressBar(ProjectSearch)
        self.progressBar.setProperty("value", 24)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.formLayout.setWidget(10, QtWidgets.QFormLayout.SpanningRole,
                                  self.progressBar)
        self.evaluateCheckBox = QtWidgets.QCheckBox(ProjectSearch)
        self.evaluateCheckBox.setChecked(True)
        self.evaluateCheckBox.setObjectName(_fromUtf8("evaluateCheckBox"))
        self.formLayout.setWidget(9, QtWidgets.QFormLayout.SpanningRole,
                                  self.evaluateCheckBox)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.cancelButton = QtWidgets.QPushButton(ProjectSearch)
        self.cancelButton.setObjectName(_fromUtf8("cancelButton"))
        self.horizontalLayout.addWidget(self.cancelButton)
        self.okButton = QtWidgets.QPushButton(ProjectSearch)
        self.okButton.setObjectName(_fromUtf8("okButton"))
        self.horizontalLayout.addWidget(self.okButton)
        self.formLayout.setLayout(11, QtWidgets.QFormLayout.SpanningRole,
                                  self.horizontalLayout)
        self.geometryStorageLabel = QtWidgets.QLabel(ProjectSearch)
        self.geometryStorageLabel.setObjectName(
            _fromUtf8("geometryStorageLabel"))
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole,
                                  self.geometryStorageLabel)
        self.geometryStorageCombo = QtWidgets.QComboBox(ProjectSearch)
        self.geometryStorageCombo.setObjectName(
            _fromUtf8("geometryStorageCombo"))
        self.geometryStorageCombo.addItem(_fromUtf8(""))
        self.geometryStorageCombo.addItem(_fromUtf8(""))
        self.geometryStorageCombo.addItem(_fromUtf8(""))
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole,
                                  self.geometryStorageCombo)

        self.retranslateUi(ProjectSearch)
        QtCore.QMetaObject.connectSlotsByName(ProjectSearch)
        ProjectSearch.setTabOrder(self.searchName, self.layerCombo)
        ProjectSearch.setTabOrder(self.layerCombo, self.geometryStorageCombo)
        ProjectSearch.setTabOrder(self.geometryStorageCombo, self.priorityBox)
        ProjectSearch.setTabOrder(self.priorityBox, self.evaluateCheckBox)
        ProjectSearch.setTabOrder(self.evaluateCheckBox, self.cancelButton)
        ProjectSearch.setTabOrder(self.cancelButton, self.okButton)