コード例 #1
0
    def testFilter(self):
        """ test setting field with filter """
        l = create_layer()
        w = QgsFieldComboBox()
        w.setLayer(l)
        w.setFilters(QgsFieldProxyModel.Int)
        self.assertEqual(w.layer(), l)

        w.setField('fldint')
        self.assertEqual(w.currentField(), 'fldint')
コード例 #2
0
    def __init__(self, curPointLayerName, curPolygonLayerName, curFiledName, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.resize(300, 100)
        Plugin().plPrint("curPointLayerName:: %s" % curPointLayerName)
        Plugin().plPrint("curPolygonLayerName:: %s" % curPolygonLayerName)
        Plugin().plPrint("curFiledName:: %s" % curFiledName)
        self.setWindowTitle(Plugin().getPluginName())
        self.__mainLayout = QtGui.QVBoxLayout(self)
        self.__layout = QtGui.QGridLayout(self)

        # self.__layout.addWidget(QtGui.QLabel(self.tr("Point layer name") + ":"), 0, 0)
        l1 = QtGui.QLabel(u"Имя точечного слоя" + ":")
        l1.setSizePolicy(
            QtGui.QSizePolicy.Preferred,
            QtGui.QSizePolicy.Fixed
        )
        self.__layout.addWidget(l1, 0, 0)
        self.pointsLayersComboBox = QgsMapLayerComboBox()
        self.pointsLayersComboBox.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.pointsLayersComboBox.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.pointsLayersComboBox.setEditable(True)
        self.pointsLayersComboBox.setEditText(curPointLayerName)
        self.pointsLayersComboBox.layerChanged.connect(self.layerChooze1)
        self.__layout.addWidget(self.pointsLayersComboBox, 0, 1)


        # self.__layout.addWidget(QtGui.QLabel(self.tr("Field name") + ":"), 2, 0)
        self.__layout.addWidget(QtGui.QLabel(u"Имя поля" + ":"), 2, 0)
        self.fieldName = QgsFieldComboBox()
        self.fieldName.setFilters(QgsFieldProxyModel.Int)
        self.fieldName.setEditable(True)
        self.fieldName.setEditText(curFiledName)
        self.fieldName.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fieldName, 2, 1)

        # self.__layout.addWidget(QtGui.QLabel(self.tr("Polypon layer name") + ":"), 1, 0)
        self.__layout.addWidget(QtGui.QLabel(u"Имя полигонального слоя" + ":"), 1, 0)
        self.polygonsLayersComboBox = QgsMapLayerComboBox()
        self.polygonsLayersComboBox.setFilters(QgsMapLayerProxyModel.PolygonLayer)
        self.polygonsLayersComboBox.setEditable(True)
        self.polygonsLayersComboBox.setEditText(curPolygonLayerName)
        self.polygonsLayersComboBox.layerChanged.connect(self.layerChooze2)
        self.polygonsLayersComboBox.layerChanged.connect(self.fieldName.setLayer)
        self.__layout.addWidget(self.polygonsLayersComboBox, 1, 1)

        # self.startButton = QtGui.QPushButton(self.tr("Start"))
        # self.startButton.clicked.connect(self.startCalculation)
        # self.__layout.addWidget(self.startButton, 3, 1)

        self.__mainLayout.addLayout(self.__layout)
        # self.progress = QtGui.QLabel()
        # self.__mainLayout.addWidget(self.progress)
        self.__bbox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
        self.__bbox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        self.__bbox.accepted.connect(self.accept)
        self.__mainLayout.addWidget(self.__bbox)
コード例 #3
0
    def testGettersSetters(self):
        """ test combobox getters/setters """
        l = create_layer()
        w = QgsFieldComboBox()
        w.setLayer(l)
        self.assertEqual(w.layer(), l)

        w.setField('fldint')
        self.assertEqual(w.currentField(), 'fldint')
コード例 #4
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(500, 100)
        self.setWindowTitle("Settings")

        layout = QGridLayout(self)

        csTargetLayerName = getCSLayerName()
        bufferTargetLayerName = getRZLayerName()

        csLable = QLabel("Compressor staitions layer:")
        csLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        layout.addWidget(csLable, 0, 0)
        self.__csLayerName = QgsMapLayerComboBox()
        self.__csLayerName.setEditable(True)
        self.__csLayerName.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.__csLayerName.setEditText(csTargetLayerName)
        self.__csLayerName.layerChanged.connect(self.csLayerChooze)
        self.__csLayerName.editTextChanged.connect(self.csLayernameSave)
        self.__csLayerName.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        layout.addWidget(self.__csLayerName, 0, 1)

        self.__csIdField = QgsFieldComboBox()
        self.__csIdField.setEditable(True)
        self.__csIdField.fieldChanged.connect(self.csIdFiledChooze)
        self.__csIdField.editTextChanged.connect(self.csIdFieldSave)
        self.__csIdField.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.csIdFieldFill()
        layout.addWidget(self.__csIdField, 0, 2)

        bufferLable = QLabel("Buffer layer:")
        bufferLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        layout.addWidget(bufferLable, 1, 0)
        # self.__bufferLayerName = QLineEdit(bufferTargetLayerName, self)
        # self.__bufferLayerName.editingFinished.connect(self.bufferTargetLayernameSave)
        self.__bufferLayerName = QgsMapLayerComboBox()
        self.__bufferLayerName.setEditable(True)
        self.__bufferLayerName.setFilters(QgsMapLayerProxyModel.PolygonLayer)
        self.__bufferLayerName.setEditText(bufferTargetLayerName)
        self.__bufferLayerName.layerChanged.connect(self.bufferLayerChooze)
        self.__bufferLayerName.editTextChanged.connect(self.bufferLayernameSave)
        layout.addWidget(self.__bufferLayerName, 1, 1)
コード例 #5
0
    def setupUi(self, Autocorrelation):
        Autocorrelation.setObjectName(_fromUtf8("Autocorrelation"))
        Autocorrelation.setWindowModality(QtCore.Qt.NonModal)
        Autocorrelation.resize(674, 462)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Autocorrelation.sizePolicy().hasHeightForWidth())
        Autocorrelation.setSizePolicy(sizePolicy)
        Autocorrelation.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.verticalLayout = QtGui.QVBoxLayout(Autocorrelation)
        self.verticalLayout.setSizeConstraint(QtGui.QLayout.SetDefaultConstraint)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.formLayout = QtGui.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.label = QtGui.QLabel(Autocorrelation)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
        self.cbx_aggregation_layer = QgsMapLayerComboBox(Autocorrelation)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbx_aggregation_layer.sizePolicy().hasHeightForWidth())
        self.cbx_aggregation_layer.setSizePolicy(sizePolicy)
        self.cbx_aggregation_layer.setObjectName(_fromUtf8("cbx_aggregation_layer"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.cbx_aggregation_layer)
        self.label_4 = QtGui.QLabel(Autocorrelation)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
        self.cbx_indicator_field = QgsFieldComboBox(Autocorrelation)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbx_indicator_field.sizePolicy().hasHeightForWidth())
        self.cbx_indicator_field.setSizePolicy(sizePolicy)
        self.cbx_indicator_field.setObjectName(_fromUtf8("cbx_indicator_field"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.cbx_indicator_field)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.le_output_filepath = QtGui.QLineEdit(Autocorrelation)
        self.le_output_filepath.setObjectName(_fromUtf8("le_output_filepath"))
        self.horizontalLayout_6.addWidget(self.le_output_filepath)
        self.button_browse = QtGui.QPushButton(Autocorrelation)
        self.button_browse.setObjectName(_fromUtf8("button_browse"))
        self.horizontalLayout_6.addWidget(self.button_browse)
        self.formLayout.setLayout(12, QtGui.QFormLayout.FieldRole, self.horizontalLayout_6)
        self.label_3 = QtGui.QLabel(Autocorrelation)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.label_3)
        self.cbx_contiguity = QtGui.QComboBox(Autocorrelation)
        self.cbx_contiguity.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbx_contiguity.sizePolicy().hasHeightForWidth())
        self.cbx_contiguity.setSizePolicy(sizePolicy)
        self.cbx_contiguity.setMinimumSize(QtCore.QSize(104, 0))
        self.cbx_contiguity.setObjectName(_fromUtf8("cbx_contiguity"))
        self.cbx_contiguity.addItem(_fromUtf8(""))
        self.cbx_contiguity.addItem(_fromUtf8(""))
        self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.cbx_contiguity)
        self.label_8 = QtGui.QLabel(Autocorrelation)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout.setWidget(12, QtGui.QFormLayout.LabelRole, self.label_8)
        self.verticalLayout.addLayout(self.formLayout)
        self.button_box_ok = QtGui.QDialogButtonBox(Autocorrelation)
        self.button_box_ok.setOrientation(QtCore.Qt.Horizontal)
        self.button_box_ok.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.button_box_ok.setObjectName(_fromUtf8("button_box_ok"))
        self.verticalLayout.addWidget(self.button_box_ok)

        self.retranslateUi(Autocorrelation)
        QtCore.QObject.connect(self.cbx_aggregation_layer, QtCore.SIGNAL(_fromUtf8("layerChanged(QgsMapLayer*)")), self.cbx_indicator_field.setLayer)
        QtCore.QMetaObject.connectSlotsByName(Autocorrelation)
コード例 #6
0
    def setupUi(self, hcmgis_prefix_suffix_form):
        hcmgis_prefix_suffix_form.setObjectName("hcmgis_prefix_suffix_form")
        hcmgis_prefix_suffix_form.setWindowModality(QtCore.Qt.ApplicationModal)
        hcmgis_prefix_suffix_form.setEnabled(True)
        hcmgis_prefix_suffix_form.resize(343, 287)
        hcmgis_prefix_suffix_form.setMouseTracking(False)
        self.verticalLayout = QtWidgets.QVBoxLayout(hcmgis_prefix_suffix_form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.LblInput = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblInput.setObjectName("LblInput")
        self.verticalLayout.addWidget(self.LblInput)
        self.CboInput = QgsMapLayerComboBox(hcmgis_prefix_suffix_form)
        self.CboInput.setObjectName("CboInput")
        self.verticalLayout.addWidget(self.CboInput)
        self.LblOutput_2 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblOutput_2.setObjectName("LblOutput_2")
        self.verticalLayout.addWidget(self.LblOutput_2)
        self.CboField = QgsFieldComboBox(hcmgis_prefix_suffix_form)
        self.CboField.setObjectName("CboField")
        self.verticalLayout.addWidget(self.CboField)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
        self.gridLayout.setObjectName("gridLayout")
        self.LblChar = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar.setObjectName("LblChar")
        self.gridLayout.addWidget(self.LblChar, 0, 0, 1, 1)
        self.LblChar_3 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_3.setObjectName("LblChar_3")
        self.gridLayout.addWidget(self.LblChar_3, 0, 1, 1, 1)
        self.LinPrefix = QtWidgets.QLineEdit(hcmgis_prefix_suffix_form)
        self.LinPrefix.setObjectName("LinPrefix")
        self.gridLayout.addWidget(self.LinPrefix, 1, 0, 1, 1)
        self.CboCharPrefix = QtWidgets.QComboBox(hcmgis_prefix_suffix_form)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.CboCharPrefix.setFont(font)
        self.CboCharPrefix.setEditable(True)
        self.CboCharPrefix.setObjectName("CboCharPrefix")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.gridLayout.addWidget(self.CboCharPrefix, 1, 1, 1, 1)
        self.LblChar_2 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_2.setObjectName("LblChar_2")
        self.gridLayout.addWidget(self.LblChar_2, 2, 0, 1, 1)
        self.LblChar_4 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_4.setObjectName("LblChar_4")
        self.gridLayout.addWidget(self.LblChar_4, 2, 1, 1, 1)
        self.LinSuffix = QtWidgets.QLineEdit(hcmgis_prefix_suffix_form)
        self.LinSuffix.setObjectName("LinSuffix")
        self.gridLayout.addWidget(self.LinSuffix, 3, 0, 1, 1)
        self.CboCharSuffix = QtWidgets.QComboBox(hcmgis_prefix_suffix_form)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.CboCharSuffix.setFont(font)
        self.CboCharSuffix.setEditable(True)
        self.CboCharSuffix.setObjectName("CboCharSuffix")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.gridLayout.addWidget(self.CboCharSuffix, 3, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.ChkSelectedFeaturesOnly = QtWidgets.QCheckBox(
            hcmgis_prefix_suffix_form)
        self.ChkSelectedFeaturesOnly.setObjectName("ChkSelectedFeaturesOnly")
        self.verticalLayout.addWidget(self.ChkSelectedFeaturesOnly)
        self.BtnOKCancel = QtWidgets.QDialogButtonBox(
            hcmgis_prefix_suffix_form)
        self.BtnOKCancel.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                            | QtWidgets.QDialogButtonBox.Ok)
        self.BtnOKCancel.setObjectName("BtnOKCancel")
        self.verticalLayout.addWidget(self.BtnOKCancel)

        self.retranslateUi(hcmgis_prefix_suffix_form)
        self.BtnOKCancel.accepted.connect(hcmgis_prefix_suffix_form.accept)
        self.BtnOKCancel.rejected.connect(hcmgis_prefix_suffix_form.reject)
        QtCore.QMetaObject.connectSlotsByName(hcmgis_prefix_suffix_form)
コード例 #7
0
    def testSignals(self):
        l = create_layer()
        w = QgsFieldComboBox()
        w.setLayer(l)

        spy = QSignalSpy(w.fieldChanged)
        w.setField('fldint2')
        self.assertEqual(len(spy), 1)
        self.assertEqual(spy[-1][0], 'fldint2')
        w.setField('fldint2')
        self.assertEqual(len(spy), 1)
        self.assertEqual(spy[-1][0], 'fldint2')
        w.setField('fldint')
        self.assertEqual(len(spy), 2)
        self.assertEqual(spy[-1][0], 'fldint')
        w.setField(None)
        self.assertEqual(len(spy), 3)
        self.assertEqual(spy[-1][0], None)
        w.setField(None)
        self.assertEqual(len(spy), 3)
        self.assertEqual(spy[-1][0], None)
コード例 #8
0
    def createWidget(self):
        self._layer = None

        if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
            if self.param.multiple:
                return MultipleInputPanel(options=[])
            else:
                widget = QgsFieldComboBox()
                widget.setAllowEmptyFieldName(self.param.optional)
                widget.fieldChanged.connect(
                    lambda: self.widgetValueHasChanged.emit(self))
                if self.param.datatype == ParameterTableField.DATA_TYPE_NUMBER:
                    widget.setFilters(QgsFieldProxyModel.Numeric)
                elif self.param.datatype == ParameterTableField.DATA_TYPE_STRING:
                    widget.setFilters(QgsFieldProxyModel.String)
                elif self.param.datatype == ParameterTableField.DATA_TYPE_DATETIME:
                    widget.setFilters(QgsFieldProxyModel.Date
                                      | QgsFieldProxyModel.Time)
                return widget
        else:
            widget = QComboBox()
            widget.setEditable(True)
            fields = self.dialog.getAvailableValuesOfType(
                ParameterTableField, None)
            if self.param.optional:
                widget.addItem(self.NOT_SET, None)
            for f in fields:
                widget.addItem(self.dialog.resolveValueDescription(f), f)
            return widget
コード例 #9
0
class Ui_hcmgis_prefix_suffix_form(object):
    def setupUi(self, hcmgis_prefix_suffix_form):
        hcmgis_prefix_suffix_form.setObjectName("hcmgis_prefix_suffix_form")
        hcmgis_prefix_suffix_form.setWindowModality(QtCore.Qt.ApplicationModal)
        hcmgis_prefix_suffix_form.setEnabled(True)
        hcmgis_prefix_suffix_form.resize(343, 287)
        hcmgis_prefix_suffix_form.setMouseTracking(False)
        self.verticalLayout = QtWidgets.QVBoxLayout(hcmgis_prefix_suffix_form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.LblInput = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblInput.setObjectName("LblInput")
        self.verticalLayout.addWidget(self.LblInput)
        self.CboInput = QgsMapLayerComboBox(hcmgis_prefix_suffix_form)
        self.CboInput.setObjectName("CboInput")
        self.verticalLayout.addWidget(self.CboInput)
        self.LblOutput_2 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblOutput_2.setObjectName("LblOutput_2")
        self.verticalLayout.addWidget(self.LblOutput_2)
        self.CboField = QgsFieldComboBox(hcmgis_prefix_suffix_form)
        self.CboField.setObjectName("CboField")
        self.verticalLayout.addWidget(self.CboField)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setSizeConstraint(QtWidgets.QLayout.SetNoConstraint)
        self.gridLayout.setObjectName("gridLayout")
        self.LblChar = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar.setObjectName("LblChar")
        self.gridLayout.addWidget(self.LblChar, 0, 0, 1, 1)
        self.LblChar_3 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_3.setObjectName("LblChar_3")
        self.gridLayout.addWidget(self.LblChar_3, 0, 1, 1, 1)
        self.LinPrefix = QtWidgets.QLineEdit(hcmgis_prefix_suffix_form)
        self.LinPrefix.setObjectName("LinPrefix")
        self.gridLayout.addWidget(self.LinPrefix, 1, 0, 1, 1)
        self.CboCharPrefix = QtWidgets.QComboBox(hcmgis_prefix_suffix_form)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.CboCharPrefix.setFont(font)
        self.CboCharPrefix.setEditable(True)
        self.CboCharPrefix.setObjectName("CboCharPrefix")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.CboCharPrefix.addItem("")
        self.gridLayout.addWidget(self.CboCharPrefix, 1, 1, 1, 1)
        self.LblChar_2 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_2.setObjectName("LblChar_2")
        self.gridLayout.addWidget(self.LblChar_2, 2, 0, 1, 1)
        self.LblChar_4 = QtWidgets.QLabel(hcmgis_prefix_suffix_form)
        self.LblChar_4.setObjectName("LblChar_4")
        self.gridLayout.addWidget(self.LblChar_4, 2, 1, 1, 1)
        self.LinSuffix = QtWidgets.QLineEdit(hcmgis_prefix_suffix_form)
        self.LinSuffix.setObjectName("LinSuffix")
        self.gridLayout.addWidget(self.LinSuffix, 3, 0, 1, 1)
        self.CboCharSuffix = QtWidgets.QComboBox(hcmgis_prefix_suffix_form)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.CboCharSuffix.setFont(font)
        self.CboCharSuffix.setEditable(True)
        self.CboCharSuffix.setObjectName("CboCharSuffix")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.CboCharSuffix.addItem("")
        self.gridLayout.addWidget(self.CboCharSuffix, 3, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.ChkSelectedFeaturesOnly = QtWidgets.QCheckBox(
            hcmgis_prefix_suffix_form)
        self.ChkSelectedFeaturesOnly.setObjectName("ChkSelectedFeaturesOnly")
        self.verticalLayout.addWidget(self.ChkSelectedFeaturesOnly)
        self.BtnOKCancel = QtWidgets.QDialogButtonBox(
            hcmgis_prefix_suffix_form)
        self.BtnOKCancel.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                            | QtWidgets.QDialogButtonBox.Ok)
        self.BtnOKCancel.setObjectName("BtnOKCancel")
        self.verticalLayout.addWidget(self.BtnOKCancel)

        self.retranslateUi(hcmgis_prefix_suffix_form)
        self.BtnOKCancel.accepted.connect(hcmgis_prefix_suffix_form.accept)
        self.BtnOKCancel.rejected.connect(hcmgis_prefix_suffix_form.reject)
        QtCore.QMetaObject.connectSlotsByName(hcmgis_prefix_suffix_form)

    def retranslateUi(self, hcmgis_prefix_suffix_form):
        _translate = QtCore.QCoreApplication.translate
        hcmgis_prefix_suffix_form.setWindowTitle(
            _translate("hcmgis_prefix_suffix_form", "Add Prefix/ Suffix"))
        self.LblInput.setText(
            _translate("hcmgis_prefix_suffix_form", "Imput Layer"))
        self.LblOutput_2.setText(
            _translate("hcmgis_prefix_suffix_form", "Field"))
        self.LblChar.setText(_translate("hcmgis_prefix_suffix_form", "Prefix"))
        self.LblChar_3.setText(
            _translate("hcmgis_prefix_suffix_form", "Linking Characters"))
        self.CboCharPrefix.setItemText(
            0, _translate("hcmgis_prefix_suffix_form", "Space"))
        self.CboCharPrefix.setItemText(
            1, _translate("hcmgis_prefix_suffix_form", "Tab"))
        self.CboCharPrefix.setItemText(
            2, _translate("hcmgis_prefix_suffix_form", ","))
        self.CboCharPrefix.setItemText(
            3, _translate("hcmgis_prefix_suffix_form", "_"))
        self.CboCharPrefix.setItemText(
            4, _translate("hcmgis_prefix_suffix_form", "-"))
        self.CboCharPrefix.setItemText(
            5, _translate("hcmgis_prefix_suffix_form", "/"))
        self.CboCharPrefix.setItemText(
            6, _translate("hcmgis_prefix_suffix_form", "|"))
        self.CboCharPrefix.setItemText(
            7, _translate("hcmgis_prefix_suffix_form", "\\"))
        self.CboCharPrefix.setItemText(
            8, _translate("hcmgis_prefix_suffix_form", "."))
        self.CboCharPrefix.setItemText(
            9, _translate("hcmgis_prefix_suffix_form", ":"))
        self.CboCharPrefix.setItemText(
            10, _translate("hcmgis_prefix_suffix_form", ";"))
        self.CboCharPrefix.setItemText(
            11, _translate("hcmgis_prefix_suffix_form", "~"))
        self.CboCharPrefix.setItemText(
            12, _translate("hcmgis_prefix_suffix_form", "`"))
        self.CboCharPrefix.setItemText(
            13, _translate("hcmgis_prefix_suffix_form", "!"))
        self.CboCharPrefix.setItemText(
            14, _translate("hcmgis_prefix_suffix_form", "@"))
        self.CboCharPrefix.setItemText(
            15, _translate("hcmgis_prefix_suffix_form", "#"))
        self.CboCharPrefix.setItemText(
            16, _translate("hcmgis_prefix_suffix_form", "$"))
        self.CboCharPrefix.setItemText(
            17, _translate("hcmgis_prefix_suffix_form", "%"))
        self.CboCharPrefix.setItemText(
            18, _translate("hcmgis_prefix_suffix_form", "&"))
        self.CboCharPrefix.setItemText(
            19, _translate("hcmgis_prefix_suffix_form", "*"))
        self.CboCharPrefix.setItemText(
            20, _translate("hcmgis_prefix_suffix_form", "("))
        self.CboCharPrefix.setItemText(
            21, _translate("hcmgis_prefix_suffix_form", ")"))
        self.CboCharPrefix.setItemText(
            22, _translate("hcmgis_prefix_suffix_form", "{"))
        self.CboCharPrefix.setItemText(
            23, _translate("hcmgis_prefix_suffix_form", "}"))
        self.CboCharPrefix.setItemText(
            24, _translate("hcmgis_prefix_suffix_form", "["))
        self.CboCharPrefix.setItemText(
            25, _translate("hcmgis_prefix_suffix_form", "]"))
        self.CboCharPrefix.setItemText(
            26, _translate("hcmgis_prefix_suffix_form", "\'"))
        self.CboCharPrefix.setItemText(
            27, _translate("hcmgis_prefix_suffix_form", "\""))
        self.CboCharPrefix.setItemText(
            28, _translate("hcmgis_prefix_suffix_form", "<"))
        self.CboCharPrefix.setItemText(
            29, _translate("hcmgis_prefix_suffix_form", ">"))
        self.LblChar_2.setText(
            _translate("hcmgis_prefix_suffix_form", "Suffix"))
        self.LblChar_4.setText(
            _translate("hcmgis_prefix_suffix_form", "Linking Characters"))
        self.CboCharSuffix.setItemText(
            0, _translate("hcmgis_prefix_suffix_form", "Space"))
        self.CboCharSuffix.setItemText(
            1, _translate("hcmgis_prefix_suffix_form", "Tab"))
        self.CboCharSuffix.setItemText(
            2, _translate("hcmgis_prefix_suffix_form", ","))
        self.CboCharSuffix.setItemText(
            3, _translate("hcmgis_prefix_suffix_form", "_"))
        self.CboCharSuffix.setItemText(
            4, _translate("hcmgis_prefix_suffix_form", "-"))
        self.CboCharSuffix.setItemText(
            5, _translate("hcmgis_prefix_suffix_form", "/"))
        self.CboCharSuffix.setItemText(
            6, _translate("hcmgis_prefix_suffix_form", "|"))
        self.CboCharSuffix.setItemText(
            7, _translate("hcmgis_prefix_suffix_form", "\\"))
        self.CboCharSuffix.setItemText(
            8, _translate("hcmgis_prefix_suffix_form", "."))
        self.CboCharSuffix.setItemText(
            9, _translate("hcmgis_prefix_suffix_form", ":"))
        self.CboCharSuffix.setItemText(
            10, _translate("hcmgis_prefix_suffix_form", ";"))
        self.CboCharSuffix.setItemText(
            11, _translate("hcmgis_prefix_suffix_form", "~"))
        self.CboCharSuffix.setItemText(
            12, _translate("hcmgis_prefix_suffix_form", "`"))
        self.CboCharSuffix.setItemText(
            13, _translate("hcmgis_prefix_suffix_form", "!"))
        self.CboCharSuffix.setItemText(
            14, _translate("hcmgis_prefix_suffix_form", "@"))
        self.CboCharSuffix.setItemText(
            15, _translate("hcmgis_prefix_suffix_form", "#"))
        self.CboCharSuffix.setItemText(
            16, _translate("hcmgis_prefix_suffix_form", "$"))
        self.CboCharSuffix.setItemText(
            17, _translate("hcmgis_prefix_suffix_form", "%"))
        self.CboCharSuffix.setItemText(
            18, _translate("hcmgis_prefix_suffix_form", "&"))
        self.CboCharSuffix.setItemText(
            19, _translate("hcmgis_prefix_suffix_form", "*"))
        self.CboCharSuffix.setItemText(
            20, _translate("hcmgis_prefix_suffix_form", "("))
        self.CboCharSuffix.setItemText(
            21, _translate("hcmgis_prefix_suffix_form", ")"))
        self.CboCharSuffix.setItemText(
            22, _translate("hcmgis_prefix_suffix_form", "{"))
        self.CboCharSuffix.setItemText(
            23, _translate("hcmgis_prefix_suffix_form", "}"))
        self.CboCharSuffix.setItemText(
            24, _translate("hcmgis_prefix_suffix_form", "["))
        self.CboCharSuffix.setItemText(
            25, _translate("hcmgis_prefix_suffix_form", "]"))
        self.CboCharSuffix.setItemText(
            26, _translate("hcmgis_prefix_suffix_form", "\'"))
        self.CboCharSuffix.setItemText(
            27, _translate("hcmgis_prefix_suffix_form", "\""))
        self.CboCharSuffix.setItemText(
            28, _translate("hcmgis_prefix_suffix_form", "<"))
        self.CboCharSuffix.setItemText(
            29, _translate("hcmgis_prefix_suffix_form", ">"))
        self.ChkSelectedFeaturesOnly.setText(
            _translate("hcmgis_prefix_suffix_form", "Selected features only"))
コード例 #10
0
class SettingsDialog(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(500, 100)
        self.setWindowTitle("Settings")

        layout = QGridLayout(self)

        csTargetLayerName = getCSLayerName()
        bufferTargetLayerName = getRZLayerName()

        csLable = QLabel("Compressor staitions layer:")
        csLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        layout.addWidget(csLable, 0, 0)
        self.__csLayerName = QgsMapLayerComboBox()
        self.__csLayerName.setEditable(True)
        self.__csLayerName.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.__csLayerName.setEditText(csTargetLayerName)
        self.__csLayerName.layerChanged.connect(self.csLayerChooze)
        self.__csLayerName.editTextChanged.connect(self.csLayernameSave)
        self.__csLayerName.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        layout.addWidget(self.__csLayerName, 0, 1)

        self.__csIdField = QgsFieldComboBox()
        self.__csIdField.setEditable(True)
        self.__csIdField.fieldChanged.connect(self.csIdFiledChooze)
        self.__csIdField.editTextChanged.connect(self.csIdFieldSave)
        self.__csIdField.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.csIdFieldFill()
        layout.addWidget(self.__csIdField, 0, 2)

        bufferLable = QLabel("Buffer layer:")
        bufferLable.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        layout.addWidget(bufferLable, 1, 0)
        # self.__bufferLayerName = QLineEdit(bufferTargetLayerName, self)
        # self.__bufferLayerName.editingFinished.connect(self.bufferTargetLayernameSave)
        self.__bufferLayerName = QgsMapLayerComboBox()
        self.__bufferLayerName.setEditable(True)
        self.__bufferLayerName.setFilters(QgsMapLayerProxyModel.PolygonLayer)
        self.__bufferLayerName.setEditText(bufferTargetLayerName)
        self.__bufferLayerName.layerChanged.connect(self.bufferLayerChooze)
        self.__bufferLayerName.editTextChanged.connect(self.bufferLayernameSave)
        layout.addWidget(self.__bufferLayerName, 1, 1)

    def csLayerChooze(self, qgsMapLayer):
        self.__csLayerName.setEditText(qgsMapLayer.name())

    def csLayernameSave(self, csTargetLayerName):
        if csTargetLayerName == u"":
            return
        setCSLayerName(csTargetLayerName)
        self.csIdFieldFill()

    def csIdFieldFill(self):
        csIdField = getCSIdField()
        csTargetLayerName = getCSLayerName()
        layers = QgsMapLayerRegistry.instance().mapLayersByName(csTargetLayerName)
        if len(layers) > 0:
            self.__csIdField.setLayer(layers[0])
        else:
            self.__csIdField.setLayer(None)
        self.__csIdField.setEditText(csIdField)

    def csIdFiledChooze(self, fieldName):
        self.__csIdField.setEditText(fieldName)

    def csIdFieldSave(self, fieldName):
        settings = QSettings()
        if fieldName == u"":
            return
        setCSIdField(fieldName)

    def bufferLayerChooze(self, qgsMapLayer):
        self.__bufferLayerName.setEditText(qgsMapLayer.name())

    def bufferLayernameSave(self, bufferTargetLayerName):
        settings = QSettings()
        if bufferTargetLayerName == u"":
            return
        setRZLayerName(bufferTargetLayerName)
コード例 #11
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)
コード例 #12
0
    def setupUi(self, Composite_Index):
        Composite_Index.setObjectName(_fromUtf8("Composite_Index"))
        Composite_Index.resize(814, 754)
        self.verticalLayout = QtGui.QVBoxLayout(Composite_Index)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.formLayout = QtGui.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.label = QtGui.QLabel(Composite_Index)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
        self.cbx_aggregation_layer = QgsMapLayerComboBox(Composite_Index)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbx_aggregation_layer.sizePolicy().hasHeightForWidth())
        self.cbx_aggregation_layer.setSizePolicy(sizePolicy)
        self.cbx_aggregation_layer.setObjectName(_fromUtf8("cbx_aggregation_layer"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.cbx_aggregation_layer)
        self.label_4 = QtGui.QLabel(Composite_Index)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
        self.cbx_indicator_field = QgsFieldComboBox(Composite_Index)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cbx_indicator_field.sizePolicy().hasHeightForWidth())
        self.cbx_indicator_field.setSizePolicy(sizePolicy)
        self.cbx_indicator_field.setObjectName(_fromUtf8("cbx_indicator_field"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.cbx_indicator_field)
        self.label_3 = QtGui.QLabel(Composite_Index)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout.setWidget(11, QtGui.QFormLayout.LabelRole, self.label_3)
        self.label_8 = QtGui.QLabel(Composite_Index)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout.setWidget(12, QtGui.QFormLayout.LabelRole, self.label_8)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.le_output_filepath = QtGui.QLineEdit(Composite_Index)
        self.le_output_filepath.setObjectName(_fromUtf8("le_output_filepath"))
        self.horizontalLayout_6.addWidget(self.le_output_filepath)
        self.button_browse = QtGui.QPushButton(Composite_Index)
        self.button_browse.setObjectName(_fromUtf8("button_browse"))
        self.horizontalLayout_6.addWidget(self.button_browse)
        self.formLayout.setLayout(12, QtGui.QFormLayout.FieldRole, self.horizontalLayout_6)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.formLayout.setLayout(13, QtGui.QFormLayout.FieldRole, self.horizontalLayout)
        self.radioButton_vector_positive = QtGui.QRadioButton(Composite_Index)
        self.radioButton_vector_positive.setChecked(True)
        self.radioButton_vector_positive.setObjectName(_fromUtf8("radioButton_vector_positive"))
        self.buttonGroup_2 = QtGui.QButtonGroup(Composite_Index)
        self.buttonGroup_2.setObjectName(_fromUtf8("buttonGroup_2"))
        self.buttonGroup_2.addButton(self.radioButton_vector_positive)
        self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.radioButton_vector_positive)
        self.radioButton_vector_negative = QtGui.QRadioButton(Composite_Index)
        self.radioButton_vector_negative.setObjectName(_fromUtf8("radioButton_vector_negative"))
        self.buttonGroup_2.addButton(self.radioButton_vector_negative)
        self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.radioButton_vector_negative)
        self.le_new_column = QtGui.QLineEdit(Composite_Index)
        self.le_new_column.setMaxLength(10)
        self.le_new_column.setObjectName(_fromUtf8("le_new_column"))
        self.formLayout.setWidget(11, QtGui.QFormLayout.FieldRole, self.le_new_column)
        self.cbx_list_indicators = QtGui.QListWidget(Composite_Index)
        self.cbx_list_indicators.setObjectName(_fromUtf8("cbx_list_indicators"))
        self.formLayout.setWidget(10, QtGui.QFormLayout.FieldRole, self.cbx_list_indicators)
        self.command_link_button = QtGui.QCommandLinkButton(Composite_Index)
        self.command_link_button.setObjectName(_fromUtf8("command_link_button"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.command_link_button)
        self.label_2 = QtGui.QLabel(Composite_Index)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout.setWidget(9, QtGui.QFormLayout.FieldRole, self.label_2)
        self.verticalLayout.addLayout(self.formLayout)
        self.symbology = QgsCollapsibleGroupBox(Composite_Index)
        self.symbology.setCheckable(True)
        self.symbology.setProperty("collapsed", False)
        self.symbology.setObjectName(_fromUtf8("symbology"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.symbology)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.label_9 = QtGui.QLabel(self.symbology)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.horizontalLayout_3.addWidget(self.label_9)
        self.color_low_value = QgsColorButtonV2(self.symbology)
        self.color_low_value.setProperty("color", QtGui.QColor(50, 164, 46))
        self.color_low_value.setObjectName(_fromUtf8("color_low_value"))
        self.horizontalLayout_3.addWidget(self.color_low_value)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.label_10 = QtGui.QLabel(self.symbology)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.horizontalLayout_3.addWidget(self.label_10)
        self.color_high_value = QgsColorButtonV2(self.symbology)
        self.color_high_value.setProperty("color", QtGui.QColor(202, 33, 36))
        self.color_high_value.setObjectName(_fromUtf8("color_high_value"))
        self.horizontalLayout_3.addWidget(self.color_high_value)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_4 = QtGui.QHBoxLayout()
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.label_11 = QtGui.QLabel(self.symbology)
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.horizontalLayout_4.addWidget(self.label_11)
        self.spinBox_classes = QtGui.QSpinBox(self.symbology)
        self.spinBox_classes.setMinimum(1)
        self.spinBox_classes.setProperty("value", 5)
        self.spinBox_classes.setObjectName(_fromUtf8("spinBox_classes"))
        self.horizontalLayout_4.addWidget(self.spinBox_classes)
        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem1)
        self.label_12 = QtGui.QLabel(self.symbology)
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.horizontalLayout_4.addWidget(self.label_12)
        self.cbx_mode = QtGui.QComboBox(self.symbology)
        self.cbx_mode.setObjectName(_fromUtf8("cbx_mode"))
        self.horizontalLayout_4.addWidget(self.cbx_mode)
        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
        self.verticalLayout.addWidget(self.symbology)
        self.button_box_ok = QtGui.QDialogButtonBox(Composite_Index)
        self.button_box_ok.setOrientation(QtCore.Qt.Horizontal)
        self.button_box_ok.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.button_box_ok.setObjectName(_fromUtf8("button_box_ok"))
        self.verticalLayout.addWidget(self.button_box_ok)

        self.retranslateUi(Composite_Index)
        QtCore.QObject.connect(self.cbx_aggregation_layer, QtCore.SIGNAL(_fromUtf8("layerChanged(QgsMapLayer*)")), self.cbx_indicator_field.setLayer)
        QtCore.QMetaObject.connectSlotsByName(Composite_Index)
コード例 #13
0
class AddConnectorsDialog(QtWidgets.QDialog, FORM_CLASS):
    def __init__(self, iface, project):
        QtWidgets.QDialog.__init__(self)
        self.iface = iface
        self.setupUi(self)

        self.NewLinks = False
        self.NewNodes = False
        self.project = project
        if project is not None:
            self.conn = project.conn
            self.path_to_file = project.path_to_file

        self._run_layout = QGridLayout()
        spacer = QSpacerItem(5, 5, QSizePolicy.Expanding, QSizePolicy.Minimum)

        # Centroid layer
        frm1 = QHBoxLayout()
        frm1.addItem(spacer)
        self.CentroidLayer = QgsMapLayerComboBox()
        self.CentroidLayer.layerChanged.connect(self.set_fields)
        clabel = QLabel()
        clabel.setText("Centroids layer")
        frm1.addWidget(clabel)
        frm1.addWidget(self.CentroidLayer)
        self.CentroidLayer.setMinimumSize(450, 30)
        wdgt1 = QWidget()
        wdgt1.setLayout(frm1)

        self.CentroidField = QgsFieldComboBox()
        self.CentroidField.setMinimumSize(450, 30)
        frm2 = QHBoxLayout()
        frm2.addItem(spacer)
        flabel = QLabel()
        flabel.setText("Centroid ID field")
        frm2.addWidget(flabel)
        frm2.addWidget(self.CentroidField)
        wdgt2 = QWidget()
        wdgt2.setLayout(frm2)

        self.CentroidLayer.setFilters(QgsMapLayerProxyModel.PointLayer)

        frm3 = QHBoxLayout()
        self.IfMaxLength = QCheckBox()
        self.IfMaxLength.setChecked(True)
        self.IfMaxLength.setText("Connector maximum length")
        self.IfMaxLength.toggled.connect(self.allows_distance)
        frm3.addWidget(self.IfMaxLength)
        frm3.addItem(spacer)

        self.MaxLength = QLineEdit()
        frm3.addWidget(self.MaxLength)
        frm3.addItem(spacer)

        lblmeters = QLabel()
        lblmeters.setText(" meters")
        frm3.addWidget(lblmeters)
        frm3.addItem(spacer)

        lblnmbr = QLabel()
        lblnmbr.setText("Connectors per centroid")
        frm3.addWidget(lblnmbr)

        self.NumberConnectors = QComboBox()
        for i in range(1, 40):
            self.NumberConnectors.addItem(str(i))
        frm3.addWidget(self.NumberConnectors)

        wdgt3 = QWidget()
        wdgt3.setLayout(frm3)

        layer_frame = QVBoxLayout()
        layer_frame.addWidget(wdgt1)
        layer_frame.addWidget(wdgt2)
        layer_frame.addWidget(wdgt3)
        lyrfrm = QWidget()
        lyrfrm.setLayout(layer_frame)

        # action buttons
        self.but_process = QPushButton()
        if self.project is None:
            self.but_process.setText("Project not loaded")
            self.but_process.setEnabled(False)
        else:
            self.but_process.setText("Run!")
        self.but_process.clicked.connect(self.run)

        self.but_cancel = QPushButton()
        self.but_cancel.setText("Cancel")
        self.but_cancel.clicked.connect(self.exit_procedure)

        self.progressbar = QProgressBar()
        self.progress_label = QLabel()
        self.progress_label.setText("...")

        but_frame = QHBoxLayout()
        but_frame.addWidget(self.progressbar, 1)
        but_frame.addWidget(self.progress_label, 1)
        but_frame.addWidget(self.but_cancel, 1)
        but_frame.addItem(spacer)
        but_frame.addWidget(self.but_process, 1)
        self.but_widget = QWidget()
        self.but_widget.setLayout(but_frame)

        # Progress bars and messagers
        self.progress_frame = QVBoxLayout()
        self.status_bar_files = QProgressBar()
        self.progress_frame.addWidget(self.status_bar_files)

        self.status_label_file = QLabel()
        self.status_label_file.setText("Extracting: ")
        self.progress_frame.addWidget(self.status_label_file)

        self.status_bar_chunks = QProgressBar()
        self.progress_frame.addWidget(self.status_bar_chunks)

        self.progress_widget = QWidget()
        self.progress_widget.setLayout(self.progress_frame)
        self.progress_widget.setVisible(False)

        self._run_layout.addWidget(lyrfrm)
        self._run_layout.addWidget(self.but_widget)
        self._run_layout.addWidget(self.progress_widget)

        list = QWidget()
        listLayout = QVBoxLayout()
        self.list_types = QTableWidget()
        self.list_types.setMinimumSize(180, 80)

        lbl = QLabel()
        lbl.setText("Allowed link types")
        listLayout.addWidget(lbl)
        listLayout.addWidget(self.list_types)
        list.setLayout(listLayout)

        if self.project is not None:
            curr = self.conn.cursor()
            curr.execute(
                "SELECT DISTINCT link_type FROM links ORDER BY link_type")
            ltypes = curr.fetchall()
            self.list_types.setRowCount(len(ltypes))
            self.list_types.setColumnCount(1)
            for i, lt in enumerate(ltypes):
                self.list_types.setItem(i, 0, QTableWidgetItem(lt[0]))
            self.list_types.selectAll()

        allStuff = QWidget()
        allStuff.setLayout(self._run_layout)
        allLayout = QHBoxLayout()
        allLayout.addWidget(allStuff)
        allLayout.addWidget(list)

        self.setLayout(allLayout)
        self.resize(700, 135)

        # default directory
        self.path = standard_path()
        self.set_fields()
        self.IfMaxLength.setChecked(False)

    def allows_distance(self):
        self.MaxLength.setEnabled(False)
        if self.IfMaxLength.isChecked():
            self.MaxLength.setEnabled(True)

    def run_thread(self):
        self.worker_thread.ProgressValue.connect(
            self.progress_value_from_thread)
        self.worker_thread.ProgressText.connect(self.progress_text_from_thread)
        self.worker_thread.ProgressMaxValue.connect(
            self.progress_range_from_thread)
        self.worker_thread.jobFinished.connect(self.job_finished_from_thread)
        self.worker_thread.start()
        self.show()

    def progress_range_from_thread(self, val):
        self.progressbar.setRange(0, val)

    def progress_value_from_thread(self, value):
        self.progressbar.setValue(value)

    def progress_text_from_thread(self, value):
        self.progress_label.setText(value)

    def set_fields(self):
        self.CentroidField.setLayer(self.CentroidLayer.currentLayer())

    def job_finished_from_thread(self, success):
        self.but_process.setEnabled(True)
        if self.worker_thread.error is not None:
            qgis.utils.iface.messageBar().pushMessage(
                "Error during procedure: ",
                self.worker_thread.error,
                level=Qgis.Warning,
                duration=6)
        self.exit_procedure()

    def run(self):
        if self.MaxLength.isEnabled():
            max_length = float(self.MaxLength.text())
        else:
            max_length = 1000000000000

        self.link_types = []
        for i in range(self.list_types.rowCount()):
            if self.list_types.item(i, 0).isSelected():
                self.link_types.append(self.list_types.item(i, 0).text())

        # If we selected all, we don;t need to filter by it
        if len(self.link_types) == self.list_types.rowCount():
            self.link_types = []

        parameters = [
            self.project.path_to_file,
            self.CentroidLayer.currentText(),
            self.CentroidField.currentText(), max_length,
            int(self.NumberConnectors.currentText()), self.link_types
        ]

        self.but_process.setEnabled(False)
        self.worker_thread = AddsConnectorsProcedure(
            qgis.utils.iface.mainWindow(), *parameters)
        self.run_thread()

    def exit_procedure(self):
        self.close()
コード例 #14
0
class DSMGenerator:
    """QGIS Plugin Implementation."""
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'DSMGenerator_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = DSMGeneratorDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&DSM Generator')
        # TODO: We are going to let the user set this up in a future iteration
        # self.toolbar = self.iface.addToolBar(u'DSMGenerator')
        # self.toolbar.setObjectName(u'DSMGenerator')

        # Declare variables
        self.OSMoutputfile = None
        self.DSMoutputfile = None

        if not (os.path.isdir(self.plugin_dir + '/temp')):
            os.mkdir(self.plugin_dir + '/temp')

        # Access the raster layer
        self.layerComboManagerDEM = QgsMapLayerComboBox(self.dlg.widgetRaster)
        self.layerComboManagerDEM.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.layerComboManagerDEM.setFixedWidth(175)
        self.layerComboManagerDEM.setCurrentIndex(-1)

        # Access the vector layer and an attribute field
        self.layerComboManagerPolygon = QgsMapLayerComboBox(
            self.dlg.widgetPolygon)
        self.layerComboManagerPolygon.setCurrentIndex(-1)
        self.layerComboManagerPolygon.setFilters(
            QgsMapLayerProxyModel.PolygonLayer)
        self.layerComboManagerPolygon.setFixedWidth(175)
        self.layerComboManagerPolygonField = QgsFieldComboBox(
            self.dlg.widgetField)
        self.layerComboManagerPolygonField.setFilters(
            QgsFieldProxyModel.Numeric)
        self.layerComboManagerPolygonField.setFixedWidth(150)
        self.layerComboManagerPolygon.layerChanged.connect(
            self.layerComboManagerPolygonField.setLayer)

        # Set up of DSM file save dialog
        self.DSMfileDialog = QFileDialog()
        self.dlg.saveButton.clicked.connect(self.savedsmfile)

        # Set up of OSM polygon file save dialog
        self.OSMfileDialog = QFileDialog()
        self.dlg.savePolygon.clicked.connect(self.saveosmfile)

        # Set up for the Help button
        self.dlg.helpButton.clicked.connect(self.help)

        # Set up for the Close button
        self.dlg.closeButton.clicked.connect(self.resetPlugin)

        # Set up for the Run button
        self.dlg.runButton.clicked.connect(self.start_progress)

        # Set up extent
        self.dlg.canvasButton.toggled.connect(self.checkbox_canvas)
        # self.dlg.layerButton.toggled.connect(self.checkbox_layer)

        self.layerComboManagerExtent = QgsMapLayerComboBox(
            self.dlg.widgetLayerExtent)
        self.layerComboManagerExtent.setCurrentIndex(-1)
        self.layerComboManagerExtent.layerChanged.connect(self.checkbox_layer)
        self.layerComboManagerExtent.setFixedWidth(175)

    # noinspection PyMethodMayBeStatic
    def tr(self, message):
        return QCoreApplication.translate('DSMGenerator', message)

    def add_action(self,
                   icon_path,
                   text,
                   callback,
                   enabled_flag=True,
                   add_to_menu=True,
                   add_to_toolbar=True,
                   status_tip=None,
                   whats_this=None,
                   parent=None):

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(self.menu, action)

        self.actions.append(action)

        return action

    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        icon_path = ':/plugins/DSMGenerator/icon.png'
        self.add_action(icon_path,
                        text=self.tr(u'DSM Generator'),
                        callback=self.run,
                        parent=self.iface.mainWindow())

    def savedsmfile(self):
        self.DSMoutputfile = self.DSMfileDialog.getSaveFileName(
            None, "Save File As:", None, "Raster Files (*.tif)")
        self.dlg.DSMtextOutput.setText(self.DSMoutputfile)

    def saveosmfile(self):
        self.OSMoutputfile = self.OSMfileDialog.getSaveFileName(
            None, "Save File As:", None, "Shapefiles (*.shp)")
        self.dlg.OSMtextOutput.setText(self.OSMoutputfile)

    def checkbox_canvas(self):
        extent = self.iface.mapCanvas().extent()
        self.dlg.lineEditNorth.setText(str(extent.yMaximum()))
        self.dlg.lineEditSouth.setText(str(extent.yMinimum()))
        self.dlg.lineEditWest.setText(str(extent.xMinimum()))
        self.dlg.lineEditEast.setText(str(extent.xMaximum()))

    def checkbox_layer(self):
        dem_layer_extent = self.layerComboManagerExtent.currentLayer()
        if dem_layer_extent:
            extent = dem_layer_extent.extent()
            self.dlg.lineEditNorth.setText(str(extent.yMaximum()))
            self.dlg.lineEditSouth.setText(str(extent.yMinimum()))
            self.dlg.lineEditWest.setText(str(extent.xMinimum()))
            self.dlg.lineEditEast.setText(str(extent.xMaximum()))

    # Help button
    def help(self):
        url = "http://umep-docs.readthedocs.io/en/latest/pre-processor/Spatial%20Data%20DSM%20Generator.html"
        webbrowser.open_new_tab(url)

    def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        for action in self.actions:
            self.iface.removePluginMenu(self.tr(u'&DSM Generator'), action)
            # self.iface.removeToolBarIcon(action)
        # remove the toolbar
        # del self.toolbar

    def run(self):
        self.dlg.show()
        self.dlg.exec_()

    def start_progress(self):
        import datetime
        start = datetime.datetime.now()
        # Check OS and dep
        if sys.platform == 'darwin':
            gdal_os_dep = '/Library/Frameworks/GDAL.framework/Versions/Current/Programs/'
        else:
            gdal_os_dep = ''

        if self.dlg.canvasButton.isChecked():
            # Map Canvas
            extentCanvasCRS = self.iface.mapCanvas()
            srs = extentCanvasCRS.mapSettings().destinationCrs()
            crs = str(srs.authid())
            # old_crs = osr.SpatialReference()
            # old_crs.ImportFromEPSG(int(crs[5:]))
            can_crs = QgsCoordinateReferenceSystem(int(crs[5:]))
            # can_wkt = extentCanvasCRS.mapRenderer().destinationCrs().toWkt()
            # can_crs = osr.SpatialReference()
            # can_crs.ImportFromWkt(can_wkt)
            # Raster Layer
            dem_layer = self.layerComboManagerDEM.currentLayer()
            dem_prov = dem_layer.dataProvider()
            dem_path = str(dem_prov.dataSourceUri())
            dem_raster = gdal.Open(dem_path)
            projdsm = osr.SpatialReference(wkt=dem_raster.GetProjection())
            projdsm.AutoIdentifyEPSG()
            projdsmepsg = int(projdsm.GetAttrValue('AUTHORITY', 1))
            dem_crs = QgsCoordinateReferenceSystem(projdsmepsg)

            # dem_wkt = dem_raster.GetProjection()
            # dem_crs = osr.SpatialReference()
            # dem_crs.ImportFromWkt(dem_wkt)
            if can_crs != dem_crs:
                extentCanvas = self.iface.mapCanvas().extent()
                extentDEM = dem_layer.extent()

                transformExt = QgsCoordinateTransform(can_crs, dem_crs)
                # transformExt = osr.CoordinateTransformation(can_crs, dem_crs)

                canminx = extentCanvas.xMinimum()
                canmaxx = extentCanvas.xMaximum()
                canminy = extentCanvas.yMinimum()
                canmaxy = extentCanvas.yMaximum()

                canxymin = transformExt.TransformPoint(canminx, canminy)
                canxymax = transformExt.TransformPoint(canmaxx, canmaxy)

                extDiffminx = canxymin[0] - extentDEM.xMinimum(
                )  # If smaller than zero = warning
                extDiffminy = canxymin[1] - extentDEM.yMinimum(
                )  # If smaller than zero = warning
                extDiffmaxx = canxymax[0] - extentDEM.xMaximum(
                )  # If larger than zero = warning
                extDiffmaxy = canxymax[0] - extentDEM.yMaximum(
                )  # If larger than zero = warning

                if extDiffminx < 0 or extDiffminy < 0 or extDiffmaxx > 0 or extDiffmaxy > 0:
                    QMessageBox.warning(
                        None,
                        "Warning! Extent of map canvas is larger than raster extent.",
                        "Change to an extent equal to or smaller than the raster extent."
                    )
                    return

        # Extent
        self.yMax = self.dlg.lineEditNorth.text()
        self.yMin = self.dlg.lineEditSouth.text()
        self.xMin = self.dlg.lineEditWest.text()
        self.xMax = self.dlg.lineEditEast.text()

        if not self.DSMoutputfile:
            QMessageBox.critical(None, "Error", "Specify a raster output file")
            return

        if self.dlg.checkBoxPolygon.isChecked() and not self.OSMoutputfile:
            QMessageBox.critical(None, "Error",
                                 "Specify an output file for OSM data")
            return

        # Acquiring geodata and attributes
        dem_layer = self.layerComboManagerDEM.currentLayer()
        if dem_layer is None:
            QMessageBox.critical(None, "Error",
                                 "No valid raster layer is selected")
            return
        else:
            provider = dem_layer.dataProvider()
            filepath_dem = str(provider.dataSourceUri())
        demRaster = gdal.Open(filepath_dem)
        dem_layer_crs = osr.SpatialReference()
        dem_layer_crs.ImportFromWkt(demRaster.GetProjection())
        self.dem_layer_unit = dem_layer_crs.GetAttrValue("UNIT")
        posUnits = [
            'metre', 'US survey foot', 'meter', 'm', 'ft', 'feet', 'foot',
            'ftUS', 'International foot'
        ]  # Possible units
        if not self.dem_layer_unit in posUnits:
            QMessageBox.critical(
                None, "Error",
                "Raster projection is not in metre or foot. Please reproject.")
            return

        polygon_layer = self.layerComboManagerPolygon.currentLayer()
        osm_layer = self.dlg.checkBoxOSM.isChecked()
        if polygon_layer is None and osm_layer is False:
            QMessageBox.critical(None, "Error",
                                 "No valid building height layer is selected")
            return
        elif polygon_layer:
            vlayer = QgsVectorLayer(polygon_layer.source(), "buildings", "ogr")
            fileInfo = QFileInfo(polygon_layer.source())
            polygon_ln = fileInfo.baseName()

            polygon_field = self.layerComboManagerPolygonField.currentField()
            idx = vlayer.fieldNameIndex(polygon_field)
            flname = vlayer.attributeDisplayName(idx)

            if idx == -1:
                QMessageBox.critical(
                    None, "Error",
                    "An attribute with unique fields must be selected")
                return

        ### main code ###

        self.dlg.progressBar.setRange(0, 5)

        self.dlg.progressBar.setValue(1)

        if self.dlg.checkBoxOSM.isChecked():
            # TODO replace osr.CoordinateTransformation with QgsCoordinateTransform
            dem_original = gdal.Open(filepath_dem)
            dem_wkt = dem_original.GetProjection()
            ras_crs = osr.SpatialReference()
            ras_crs.ImportFromWkt(dem_wkt)
            rasEPSG = ras_crs.GetAttrValue("PROJCS|AUTHORITY", 1)
            if self.dlg.layerButton.isChecked():
                old_crs = ras_crs
            elif self.dlg.canvasButton.isChecked():
                canvasCRS = self.iface.mapCanvas()
                outputWkt = canvasCRS.mapRenderer().destinationCrs().toWkt()
                old_crs = osr.SpatialReference()
                old_crs.ImportFromWkt(outputWkt)

            wgs84_wkt = """
            GEOGCS["WGS 84",
                DATUM["WGS_1984",
                    SPHEROID["WGS 84",6378137,298.257223563,
                        AUTHORITY["EPSG","7030"]],
                    AUTHORITY["EPSG","6326"]],
                PRIMEM["Greenwich",0,
                    AUTHORITY["EPSG","8901"]],
                UNIT["degree",0.01745329251994328,
                    AUTHORITY["EPSG","9122"]],
                AUTHORITY["EPSG","4326"]]"""

            new_crs = osr.SpatialReference()
            new_crs.ImportFromWkt(wgs84_wkt)

            transform = osr.CoordinateTransformation(old_crs, new_crs)

            minx = float(self.xMin)
            miny = float(self.yMin)
            maxx = float(self.xMax)
            maxy = float(self.yMax)
            lonlatmin = transform.TransformPoint(minx, miny)
            lonlatmax = transform.TransformPoint(maxx, maxy)

            if ras_crs != old_crs:
                rasTrans = osr.CoordinateTransformation(old_crs, ras_crs)
                raslonlatmin = rasTrans.TransformPoint(float(self.xMin),
                                                       float(self.yMin))
                raslonlatmax = rasTrans.TransformPoint(float(self.xMax),
                                                       float(self.yMax))
                #else:
                #raslonlatmin = [float(self.xMin), float(self.yMin)]
                #raslonlatmax = [float(self.xMax), float(self.yMax)]

                self.xMin = raslonlatmin[0]
                self.yMin = raslonlatmin[1]
                self.xMax = raslonlatmax[0]
                self.yMax = raslonlatmax[1]

            # Make data queries to overpass-api
            urlStr = 'http://overpass-api.de/api/map?bbox=' + str(
                lonlatmin[0]) + ',' + str(lonlatmin[1]) + ',' + str(
                    lonlatmax[0]) + ',' + str(lonlatmax[1])
            osmXml = urllib.urlopen(urlStr).read()
            #print urlStr

            # Make OSM building file
            osmPath = self.plugin_dir + '/temp/OSM_building.osm'
            osmFile = open(osmPath, 'w')
            osmFile.write(osmXml)
            if os.fstat(osmFile.fileno()).st_size < 1:
                urlStr = 'http://api.openstreetmap.org/api/0.6/map?bbox=' + str(
                    lonlatmin[0]) + ',' + str(lonlatmin[1]) + ',' + str(
                        lonlatmax[0]) + ',' + str(lonlatmax[1])
                osmXml = urllib.urlopen(urlStr).read()
                osmFile.write(osmXml)
                #print 'Open Street Map'
                if os.fstat(osmFile.fileno()).st_size < 1:
                    QMessageBox.critical(None, "Error",
                                         "No OSM data available")
                    return

            osmFile.close()

            outputshp = self.plugin_dir + '/temp/'

            osmToShape = gdal_os_dep + 'ogr2ogr --config OSM_CONFIG_FILE "' + self.plugin_dir + '/osmconf.ini" -skipfailures -t_srs EPSG:' + str(
                rasEPSG
            ) + ' -overwrite -nlt POLYGON -f "ESRI Shapefile" "' + outputshp + '" "' + osmPath + '"'

            if sys.platform == 'win32':
                si = subprocess.STARTUPINFO()
                si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
                subprocess.call(osmToShape, startupinfo=si)
            else:
                os.system(osmToShape)

            driver = ogr.GetDriverByName('ESRI Shapefile')
            driver.DeleteDataSource(outputshp + 'lines.shp')
            driver.DeleteDataSource(outputshp + 'multilinestrings.shp')
            driver.DeleteDataSource(outputshp + 'other_relations.shp')
            driver.DeleteDataSource(outputshp + 'points.shp')

            osmPolygonPath = outputshp + 'multipolygons.shp'
            vlayer = QgsVectorLayer(osmPolygonPath, 'multipolygons', 'ogr')
            polygon_layer = vlayer
            fileInfo = QFileInfo(polygon_layer.source())
            polygon_ln = fileInfo.baseName()

            def renameField(srcLayer, oldFieldName, newFieldName):
                ds = gdal.OpenEx(srcLayer.source(),
                                 gdal.OF_VECTOR | gdal.OF_UPDATE)
                ds.ExecuteSQL('ALTER TABLE {} RENAME COLUMN {} TO {}'.format(
                    srcLayer.name(), oldFieldName, newFieldName))
                srcLayer.reload()

            vlayer.startEditing()
            renameField(vlayer, 'building_l', 'bld_levels')
            renameField(vlayer, 'building_h', 'bld_hght')
            renameField(vlayer, 'building_c', 'bld_colour')
            renameField(vlayer, 'building_m', 'bld_materi')
            renameField(vlayer, 'building_u', 'bld_use')
            vlayer.commitChanges()

            vlayer.startEditing()
            vlayer.dataProvider().addAttributes(
                [QgsField('bld_height', QVariant.Double, 'double', 3, 2)])
            vlayer.updateFields()
            bld_lvl = vlayer.fieldNameIndex('bld_levels')
            hght = vlayer.fieldNameIndex('height')
            bld_hght = vlayer.fieldNameIndex('bld_hght')
            bld_height = vlayer.fieldNameIndex('bld_height')

            bldLvlHght = float(self.dlg.doubleSpinBoxBldLvl.value())
            illegal_chars = string.ascii_letters + "!#$%&'*+^_`|~:" + " "
            counterNone = 0
            counter = 0
            #counterWeird = 0
            for feature in vlayer.getFeatures():
                if feature[hght]:
                    try:
                        #feature[bld_height] = float(re.sub("[^0-9]", ".", str(feature[hght])))
                        feature[bld_height] = float(
                            str(feature[hght]).translate(None, illegal_chars))
                    except:
                        counterNone += 1
                elif feature[bld_hght]:
                    try:
                        #feature[bld_height] = float(re.sub("[^0-9]", ".", str(feature[bld_hght])))
                        feature[bld_height] = float(
                            str(feature[bld_hght]).translate(
                                None, illegal_chars))
                    except:
                        counterNone += 1
                elif feature[bld_lvl]:
                    try:
                        #feature[bld_height] = float(re.sub("[^0-9]", "", str(feature[bld_lvl])))*bldLvlHght
                        feature[bld_height] = float(
                            str(feature[bld_lvl]).translate(
                                None, illegal_chars)) * bldLvlHght
                    except:
                        counterNone += 1
                else:
                    counterNone += 1
                vlayer.updateFeature(feature)
                counter += 1
            vlayer.commitChanges()
            flname = vlayer.attributeDisplayName(bld_height)
            counterDiff = counter - counterNone

        # Zonal statistics
        vlayer.startEditing()
        zoneStat = QgsZonalStatistics(vlayer, filepath_dem, "stat_", 1,
                                      QgsZonalStatistics.Mean)
        zoneStat.calculateStatistics(None)
        vlayer.dataProvider().addAttributes(
            [QgsField('height_asl', QVariant.Double)])
        vlayer.updateFields()
        e = QgsExpression('stat_mean + ' + flname)
        e.prepare(vlayer.pendingFields())
        idx = vlayer.fieldNameIndex('height_asl')

        for f in vlayer.getFeatures():
            f[idx] = e.evaluate(f)
            vlayer.updateFeature(f)

        vlayer.commitChanges()

        vlayer.startEditing()
        idx2 = vlayer.fieldNameIndex('stat_mean')
        vlayer.dataProvider().deleteAttributes([idx2])
        vlayer.updateFields()
        vlayer.commitChanges()

        self.dlg.progressBar.setValue(2)

        # Convert polygon layer to raster

        # Define pixel_size and NoData value of new raster
        pixel_size = self.dlg.spinBox.value()  # half picture size

        # Create the destination data source

        gdalrasterize = gdal_os_dep + 'gdal_rasterize -a ' + 'height_asl' + ' -te ' + str(self.xMin) + ' ' + str(self.yMin) + ' ' + str(self.xMax) + ' ' + str(self.yMax) +\
                        ' -tr ' + str(pixel_size) + ' ' + str(pixel_size) + ' -l "' + str(polygon_ln) + '" "' \
                         + str(polygon_layer.source()) + '" "' + self.plugin_dir + '/temp/clipdsm.tif"'

        # gdalclipdem = gdal_os_dep + 'gdalwarp -dstnodata -9999 -q -overwrite -te ' + str(self.xMin) + ' ' + str(self.yMin) + ' ' + str(self.xMax) + ' ' + str(self.yMax) +\
        #               ' -tr ' + str(pixel_size) + ' ' + str(pixel_size) + \
        #               ' -of GTiff ' + '"' + filepath_dem + '" "' + self.plugin_dir + '/temp/clipdem.tif"'

        # Rasterize
        if sys.platform == 'win32':
            si = subprocess.STARTUPINFO()
            si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
            subprocess.call(gdalrasterize, startupinfo=si)
            # subprocess.call(gdalclipdem, startupinfo=si)
            gdal.Warp(self.plugin_dir + '/temp/clipdem.tif',
                      filepath_dem,
                      xRes=pixel_size,
                      yRes=pixel_size)
        else:
            os.system(gdalrasterize)
            # os.system(gdalclipdem)
            gdal.Warp(self.plugin_dir + '/temp/clipdem.tif',
                      filepath_dem,
                      xRes=pixel_size,
                      yRes=pixel_size)

        # Remove gdalwarp with gdal.Translate
        # bigraster = gdal.Open(filepath_dem)
        # bbox = (self.xMin, self.yMax, self.xMax, self.yMin)
        # gdal.Translate(self.plugin_dir + '/data/clipdem.tif', bigraster, projWin=bbox)

        self.dlg.progressBar.setValue(3)

        # Adding DSM to DEM
        # Read DEM
        dem_raster = gdal.Open(self.plugin_dir + '/temp/clipdem.tif')
        dem_array = np.array(dem_raster.ReadAsArray().astype(np.float))
        dsm_raster = gdal.Open(self.plugin_dir + '/temp/clipdsm.tif')
        dsm_array = np.array(dsm_raster.ReadAsArray().astype(np.float))

        indx = dsm_array.shape
        for ix in range(0, int(indx[0])):
            for iy in range(0, int(indx[1])):
                if int(dsm_array[ix, iy]) == 0:
                    dsm_array[ix, iy] = dem_array[ix, iy]

        if self.dlg.checkBoxPolygon.isChecked():
            vlayer.startEditing()
            idxHght = vlayer.fieldNameIndex('height_asl')
            idxBld = vlayer.fieldNameIndex('building')
            features = vlayer.getFeatures()
            #for f in vlayer.getFeatures():
            for f in features:
                geom = f.geometry()
                posUnitsMetre = ['metre', 'meter', 'm']  # Possible metre units
                posUnitsFt = [
                    'US survey foot', 'ft', 'feet', 'foot', 'ftUS',
                    'International foot'
                ]  # Possible foot units
                if self.dem_layer_unit in posUnitsMetre:
                    sqUnit = 1
                elif self.dem_layer_unit in posUnitsFt:
                    sqUnit = 10.76
                if int(geom.area()) > 50000 * sqUnit:
                    vlayer.deleteFeature(f.id())

                #if not f[idxHght]:
                #vlayer.deleteFeature(f.id())
                #elif not f[idxBld]:
                #vlayer.deleteFeature(f.id())
            vlayer.updateFields()
            vlayer.commitChanges()
            QgsVectorFileWriter.writeAsVectorFormat(vlayer,
                                                    str(self.OSMoutputfile),
                                                    "UTF-8", None,
                                                    "ESRI Shapefile")

        else:
            vlayer.startEditing()
            idx3 = vlayer.fieldNameIndex('height_asl')
            vlayer.dataProvider().deleteAttributes([idx3])
            vlayer.updateFields()
            vlayer.commitChanges()

        self.dlg.progressBar.setValue(4)

        # Save raster
        def saveraster(
            gdal_data, filename, raster
        ):  # gdal_data = raster extent, filename = output filename, raster = numpy array (raster to be saved)
            rows = gdal_data.RasterYSize
            cols = gdal_data.RasterXSize

            outDs = gdal.GetDriverByName("GTiff").Create(
                filename, cols, rows, int(1), gdal.GDT_Float32)
            outBand = outDs.GetRasterBand(1)

            # write the data
            outBand.WriteArray(raster, 0, 0)
            # flush data to disk, set the NoData value and calculate stats
            outBand.FlushCache()
            outBand.SetNoDataValue(-9999)

            # georeference the image and set the projection
            outDs.SetGeoTransform(gdal_data.GetGeoTransform())
            outDs.SetProjection(gdal_data.GetProjection())

        saveraster(dsm_raster, self.DSMoutputfile, dsm_array)

        # Load result into canvas
        rlayer = self.iface.addRasterLayer(self.DSMoutputfile)

        # Trigger a repaint
        if hasattr(rlayer, "setCacheImage"):
            rlayer.setCacheImage(None)
        rlayer.triggerRepaint()

        self.dlg.progressBar.setValue(5)

        #runTime = datetime.datetime.now() - start

        if self.dlg.checkBoxOSM.isChecked():
            QMessageBox.information(
                self.dlg, 'DSM Generator', 'Operation successful! ' +
                str(counterDiff) + ' building polygons out of ' +
                str(counter) + ' contained height values.')
            #self.iface.messageBar().pushMessage("DSM Generator. Operation successful! " + str(counterDiff) + " buildings out of " + str(counter) + " contained height values.", level=QgsMessageBar.INFO, duration=5)
        else:
            #self.iface.messageBar().pushMessage("DSM Generator. Operation successful!", level=QgsMessageBar.INFO, duration=5)
            QMessageBox.information(self.dlg, 'DSM Generator',
                                    'Operation successful!')

        self.resetPlugin()

        #print "finished run: %s\n\n" % (datetime.datetime.now() - start)

    def resetPlugin(self):  # Reset plugin
        self.dlg.canvasButton.setAutoExclusive(False)
        self.dlg.canvasButton.setChecked(False)
        self.dlg.layerButton.setAutoExclusive(False)
        self.dlg.layerButton.setChecked(False)
        self.dlg.checkBoxOSM.setCheckState(0)
        self.dlg.checkBoxPolygon.setCheckState(0)

        # Extent
        self.layerComboManagerExtent.setCurrentIndex(-1)
        self.dlg.lineEditNorth.setText("")
        self.dlg.lineEditSouth.setText("")
        self.dlg.lineEditWest.setText("")
        self.dlg.lineEditEast.setText("")

        # Output boxes
        self.dlg.OSMtextOutput.setText("")
        self.dlg.DSMtextOutput.setText("")

        # Input raster
        self.layerComboManagerDEM.setCurrentIndex(-1)

        # Input polygon
        self.layerComboManagerPolygon.setCurrentIndex(-1)

        # Progress bar
        self.dlg.progressBar.setValue(0)

        # Spin boxes
        self.dlg.spinBox.setValue(2)
        self.dlg.doubleSpinBoxBldLvl.setValue(2.5)
コード例 #15
0
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'DSMGenerator_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = DSMGeneratorDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&DSM Generator')
        # TODO: We are going to let the user set this up in a future iteration
        # self.toolbar = self.iface.addToolBar(u'DSMGenerator')
        # self.toolbar.setObjectName(u'DSMGenerator')

        # Declare variables
        self.OSMoutputfile = None
        self.DSMoutputfile = None

        if not (os.path.isdir(self.plugin_dir + '/temp')):
            os.mkdir(self.plugin_dir + '/temp')

        # Access the raster layer
        self.layerComboManagerDEM = QgsMapLayerComboBox(self.dlg.widgetRaster)
        self.layerComboManagerDEM.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.layerComboManagerDEM.setFixedWidth(175)
        self.layerComboManagerDEM.setCurrentIndex(-1)

        # Access the vector layer and an attribute field
        self.layerComboManagerPolygon = QgsMapLayerComboBox(
            self.dlg.widgetPolygon)
        self.layerComboManagerPolygon.setCurrentIndex(-1)
        self.layerComboManagerPolygon.setFilters(
            QgsMapLayerProxyModel.PolygonLayer)
        self.layerComboManagerPolygon.setFixedWidth(175)
        self.layerComboManagerPolygonField = QgsFieldComboBox(
            self.dlg.widgetField)
        self.layerComboManagerPolygonField.setFilters(
            QgsFieldProxyModel.Numeric)
        self.layerComboManagerPolygonField.setFixedWidth(150)
        self.layerComboManagerPolygon.layerChanged.connect(
            self.layerComboManagerPolygonField.setLayer)

        # Set up of DSM file save dialog
        self.DSMfileDialog = QFileDialog()
        self.dlg.saveButton.clicked.connect(self.savedsmfile)

        # Set up of OSM polygon file save dialog
        self.OSMfileDialog = QFileDialog()
        self.dlg.savePolygon.clicked.connect(self.saveosmfile)

        # Set up for the Help button
        self.dlg.helpButton.clicked.connect(self.help)

        # Set up for the Close button
        self.dlg.closeButton.clicked.connect(self.resetPlugin)

        # Set up for the Run button
        self.dlg.runButton.clicked.connect(self.start_progress)

        # Set up extent
        self.dlg.canvasButton.toggled.connect(self.checkbox_canvas)
        # self.dlg.layerButton.toggled.connect(self.checkbox_layer)

        self.layerComboManagerExtent = QgsMapLayerComboBox(
            self.dlg.widgetLayerExtent)
        self.layerComboManagerExtent.setCurrentIndex(-1)
        self.layerComboManagerExtent.layerChanged.connect(self.checkbox_layer)
        self.layerComboManagerExtent.setFixedWidth(175)
コード例 #16
0
    def setupUi(self, Biorec):
        Biorec.setObjectName(_fromUtf8("Biorec"))
        Biorec.resize(395, 573)
        self.verticalLayout = QtGui.QVBoxLayout(Biorec)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(Biorec)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab = QtGui.QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.formLayout = QtGui.QFormLayout(self.tab)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.butBrowse = QtGui.QPushButton(self.tab)
        self.butBrowse.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butBrowse.sizePolicy().hasHeightForWidth())
        self.butBrowse.setSizePolicy(sizePolicy)
        self.butBrowse.setObjectName(_fromUtf8("butBrowse"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.butBrowse)
        self.lblLayer = QtGui.QLabel(self.tab)
        self.lblLayer.setObjectName(_fromUtf8("lblLayer"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.lblLayer)
        self.mlcbSourceLayer = QgsMapLayerComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mlcbSourceLayer.sizePolicy().hasHeightForWidth())
        self.mlcbSourceLayer.setSizePolicy(sizePolicy)
        self.mlcbSourceLayer.setObjectName(_fromUtf8("mlcbSourceLayer"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mlcbSourceLayer)
        self.lblGridRefCol = QtGui.QLabel(self.tab)
        self.lblGridRefCol.setObjectName(_fromUtf8("lblGridRefCol"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lblGridRefCol)
        self.fcbGridRefCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbGridRefCol.sizePolicy().hasHeightForWidth())
        self.fcbGridRefCol.setSizePolicy(sizePolicy)
        self.fcbGridRefCol.setObjectName(_fromUtf8("fcbGridRefCol"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fcbGridRefCol)
        self.lblXCol = QtGui.QLabel(self.tab)
        self.lblXCol.setObjectName(_fromUtf8("lblXCol"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lblXCol)
        self.fcbXCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbXCol.sizePolicy().hasHeightForWidth())
        self.fcbXCol.setSizePolicy(sizePolicy)
        self.fcbXCol.setObjectName(_fromUtf8("fcbXCol"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.fcbXCol)
        self.lblYCol = QtGui.QLabel(self.tab)
        self.lblYCol.setObjectName(_fromUtf8("lblYCol"))
        self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.lblYCol)
        self.fcbYCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbYCol.sizePolicy().hasHeightForWidth())
        self.fcbYCol.setSizePolicy(sizePolicy)
        self.fcbYCol.setObjectName(_fromUtf8("fcbYCol"))
        self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.fcbYCol)
        self.lblAbundanceColumn = QtGui.QLabel(self.tab)
        self.lblAbundanceColumn.setObjectName(_fromUtf8("lblAbundanceColumn"))
        self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.lblAbundanceColumn)
        self.cboAbundanceCol = QtGui.QComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboAbundanceCol.sizePolicy().hasHeightForWidth())
        self.cboAbundanceCol.setSizePolicy(sizePolicy)
        self.cboAbundanceCol.setObjectName(_fromUtf8("cboAbundanceCol"))
        self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.cboAbundanceCol)
        self.lblTaxonCol = QtGui.QLabel(self.tab)
        self.lblTaxonCol.setObjectName(_fromUtf8("lblTaxonCol"))
        self.formLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.lblTaxonCol)
        self.cboTaxonCol = QtGui.QComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboTaxonCol.sizePolicy().hasHeightForWidth())
        self.cboTaxonCol.setSizePolicy(sizePolicy)
        self.cboTaxonCol.setObjectName(_fromUtf8("cboTaxonCol"))
        self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.cboTaxonCol)
        self.cbIsScientific = QtGui.QCheckBox(self.tab)
        self.cbIsScientific.setEnabled(False)
        self.cbIsScientific.setChecked(False)
        self.cbIsScientific.setObjectName(_fromUtf8("cbIsScientific"))
        self.formLayout.setWidget(7, QtGui.QFormLayout.FieldRole, self.cbIsScientific)
        self.lblGroupingCol = QtGui.QLabel(self.tab)
        self.lblGroupingCol.setEnabled(False)
        self.lblGroupingCol.setObjectName(_fromUtf8("lblGroupingCol"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.lblGroupingCol)
        self.cboGroupingCol = QtGui.QComboBox(self.tab)
        self.cboGroupingCol.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboGroupingCol.sizePolicy().hasHeightForWidth())
        self.cboGroupingCol.setSizePolicy(sizePolicy)
        self.cboGroupingCol.setObjectName(_fromUtf8("cboGroupingCol"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.cboGroupingCol)
        self.lblInputCRS = QtGui.QLabel(self.tab)
        self.lblInputCRS.setObjectName(_fromUtf8("lblInputCRS"))
        self.formLayout.setWidget(9, QtGui.QFormLayout.LabelRole, self.lblInputCRS)
        self.pswInputCRS = QgsProjectionSelectionWidget(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pswInputCRS.sizePolicy().hasHeightForWidth())
        self.pswInputCRS.setSizePolicy(sizePolicy)
        self.pswInputCRS.setObjectName(_fromUtf8("pswInputCRS"))
        self.formLayout.setWidget(9, QtGui.QFormLayout.FieldRole, self.pswInputCRS)
        self.lblOutputCRS = QtGui.QLabel(self.tab)
        self.lblOutputCRS.setObjectName(_fromUtf8("lblOutputCRS"))
        self.formLayout.setWidget(10, QtGui.QFormLayout.LabelRole, self.lblOutputCRS)
        self.pswOutputCRS = QgsProjectionSelectionWidget(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pswOutputCRS.sizePolicy().hasHeightForWidth())
        self.pswOutputCRS.setSizePolicy(sizePolicy)
        self.pswOutputCRS.setObjectName(_fromUtf8("pswOutputCRS"))
        self.formLayout.setWidget(10, QtGui.QFormLayout.FieldRole, self.pswOutputCRS)
        self.cbMatchCRS = QtGui.QCheckBox(self.tab)
        self.cbMatchCRS.setEnabled(True)
        self.cbMatchCRS.setChecked(False)
        self.cbMatchCRS.setObjectName(_fromUtf8("cbMatchCRS"))
        self.formLayout.setWidget(11, QtGui.QFormLayout.FieldRole, self.cbMatchCRS)
        spacerItem = QtGui.QSpacerItem(20, 84, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.formLayout.setItem(12, QtGui.QFormLayout.LabelRole, spacerItem)
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName(_fromUtf8("tab_3"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.tab_3)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.tvTaxa = QtGui.QTreeView(self.tab_3)
        self.tvTaxa.setToolTip(_fromUtf8(""))
        self.tvTaxa.setObjectName(_fromUtf8("tvTaxa"))
        self.tvTaxa.header().setVisible(False)
        self.verticalLayout_3.addWidget(self.tvTaxa)
        self.frame_2 = QtGui.QFrame(self.tab_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_2.sizePolicy().hasHeightForWidth())
        self.frame_2.setSizePolicy(sizePolicy)
        self.frame_2.setFrameShape(QtGui.QFrame.NoFrame)
        self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_2.setObjectName(_fromUtf8("frame_2"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame_2)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.butContract = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butContract.sizePolicy().hasHeightForWidth())
        self.butContract.setSizePolicy(sizePolicy)
        self.butContract.setMinimumSize(QtCore.QSize(25, 0))
        self.butContract.setMaximumSize(QtCore.QSize(25, 16777215))
        self.butContract.setObjectName(_fromUtf8("butContract"))
        self.horizontalLayout.addWidget(self.butContract)
        self.butExpand = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butExpand.sizePolicy().hasHeightForWidth())
        self.butExpand.setSizePolicy(sizePolicy)
        self.butExpand.setMinimumSize(QtCore.QSize(25, 0))
        self.butExpand.setMaximumSize(QtCore.QSize(25, 16777215))
        self.butExpand.setObjectName(_fromUtf8("butExpand"))
        self.horizontalLayout.addWidget(self.butExpand)
        self.butCheckAll = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butCheckAll.sizePolicy().hasHeightForWidth())
        self.butCheckAll.setSizePolicy(sizePolicy)
        self.butCheckAll.setMinimumSize(QtCore.QSize(55, 0))
        self.butCheckAll.setMaximumSize(QtCore.QSize(55, 16777215))
        self.butCheckAll.setObjectName(_fromUtf8("butCheckAll"))
        self.horizontalLayout.addWidget(self.butCheckAll)
        self.butUncheckAll = QtGui.QPushButton(self.frame_2)
        self.butUncheckAll.setMinimumSize(QtCore.QSize(65, 0))
        self.butUncheckAll.setMaximumSize(QtCore.QSize(65, 16777215))
        self.butUncheckAll.setObjectName(_fromUtf8("butUncheckAll"))
        self.horizontalLayout.addWidget(self.butUncheckAll)
        spacerItem1 = QtGui.QSpacerItem(200, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.butGenTree = QtGui.QPushButton(self.frame_2)
        self.butGenTree.setObjectName(_fromUtf8("butGenTree"))
        self.horizontalLayout.addWidget(self.butGenTree)
        self.verticalLayout_3.addWidget(self.frame_2)
        self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
        self.tab_5 = QtGui.QWidget()
        self.tab_5.setObjectName(_fromUtf8("tab_5"))
        self.verticalLayout_5 = QtGui.QVBoxLayout(self.tab_5)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.cboBatchMode = QtGui.QComboBox(self.tab_5)
        self.cboBatchMode.setMinimumSize(QtCore.QSize(130, 0))
        self.cboBatchMode.setMaximumSize(QtCore.QSize(130, 16777215))
        self.cboBatchMode.setObjectName(_fromUtf8("cboBatchMode"))
        self.cboBatchMode.addItem(_fromUtf8(""))
        self.cboBatchMode.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.cboBatchMode)
        self.horizontalLayout_4 = QtGui.QHBoxLayout()
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.leStyleFile = QtGui.QLineEdit(self.tab_5)
        self.leStyleFile.setObjectName(_fromUtf8("leStyleFile"))
        self.horizontalLayout_4.addWidget(self.leStyleFile)
        self.pbBrowseStyleFile = QtGui.QPushButton(self.tab_5)
        self.pbBrowseStyleFile.setMinimumSize(QtCore.QSize(105, 0))
        self.pbBrowseStyleFile.setObjectName(_fromUtf8("pbBrowseStyleFile"))
        self.horizontalLayout_4.addWidget(self.pbBrowseStyleFile)
        self.verticalLayout_5.addLayout(self.horizontalLayout_4)
        self.cbApplyStyle = QtGui.QCheckBox(self.tab_5)
        self.cbApplyStyle.setObjectName(_fromUtf8("cbApplyStyle"))
        self.verticalLayout_5.addWidget(self.cbApplyStyle)
        self.horizontalLayout_8 = QtGui.QHBoxLayout()
        self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
        self.label_2 = QtGui.QLabel(self.tab_5)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout_8.addWidget(self.label_2)
        self.hsLayerTransparency = QtGui.QSlider(self.tab_5)
        self.hsLayerTransparency.setOrientation(QtCore.Qt.Horizontal)
        self.hsLayerTransparency.setTickPosition(QtGui.QSlider.TicksBelow)
        self.hsLayerTransparency.setTickInterval(10)
        self.hsLayerTransparency.setObjectName(_fromUtf8("hsLayerTransparency"))
        self.horizontalLayout_8.addWidget(self.hsLayerTransparency)
        self.verticalLayout_5.addLayout(self.horizontalLayout_8)
        self.mGroupBox = QgsCollapsibleGroupBox(self.tab_5)
        self.mGroupBox.setObjectName(_fromUtf8("mGroupBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.mGroupBox)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout_9 = QtGui.QHBoxLayout()
        self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9"))
        self.label = QtGui.QLabel(self.mGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)
        self.label.setMinimumSize(QtCore.QSize(34, 0))
        self.label.setMaximumSize(QtCore.QSize(34, 16777215))
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout_9.addWidget(self.label)
        self.cboOutputFormat = QtGui.QComboBox(self.mGroupBox)
        self.cboOutputFormat.setEditable(False)
        self.cboOutputFormat.setObjectName(_fromUtf8("cboOutputFormat"))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.horizontalLayout_9.addWidget(self.cboOutputFormat)
        self.verticalLayout_2.addLayout(self.horizontalLayout_9)
        self.qgsOutputCRS = QgsProjectionSelectionWidget(self.mGroupBox)
        self.qgsOutputCRS.setObjectName(_fromUtf8("qgsOutputCRS"))
        self.verticalLayout_2.addWidget(self.qgsOutputCRS)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.leImageFolder = QtGui.QLineEdit(self.mGroupBox)
        self.leImageFolder.setObjectName(_fromUtf8("leImageFolder"))
        self.horizontalLayout_3.addWidget(self.leImageFolder)
        self.pbBrowseImageFolder = QtGui.QPushButton(self.mGroupBox)
        self.pbBrowseImageFolder.setObjectName(_fromUtf8("pbBrowseImageFolder"))
        self.horizontalLayout_3.addWidget(self.pbBrowseImageFolder)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_10 = QtGui.QHBoxLayout()
        self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10"))
        self.cbTaxonMetaData = QtGui.QCheckBox(self.mGroupBox)
        self.cbTaxonMetaData.setMinimumSize(QtCore.QSize(131, 0))
        self.cbTaxonMetaData.setMaximumSize(QtCore.QSize(131, 16777215))
        self.cbTaxonMetaData.setObjectName(_fromUtf8("cbTaxonMetaData"))
        self.horizontalLayout_10.addWidget(self.cbTaxonMetaData)
        self.mlcbTaxonMetaDataLayer = QgsMapLayerComboBox(self.mGroupBox)
        self.mlcbTaxonMetaDataLayer.setObjectName(_fromUtf8("mlcbTaxonMetaDataLayer"))
        self.horizontalLayout_10.addWidget(self.mlcbTaxonMetaDataLayer)
        self.verticalLayout_2.addLayout(self.horizontalLayout_10)
        self.verticalLayout_5.addWidget(self.mGroupBox)
        self.horizontalLayout_7 = QtGui.QHBoxLayout()
        self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
        self.butHelp = QtGui.QPushButton(self.tab_5)
        self.butHelp.setMinimumSize(QtCore.QSize(32, 32))
        self.butHelp.setMaximumSize(QtCore.QSize(32, 32))
        self.butHelp.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("images/bang.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butHelp.setIcon(icon)
        self.butHelp.setIconSize(QtCore.QSize(26, 26))
        self.butHelp.setObjectName(_fromUtf8("butHelp"))
        self.horizontalLayout_7.addWidget(self.butHelp)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem2)
        self.verticalLayout_5.addLayout(self.horizontalLayout_7)
        spacerItem3 = QtGui.QSpacerItem(20, 52, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout_5.addItem(spacerItem3)
        self.tabWidget.addTab(self.tab_5, _fromUtf8(""))
        self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName(_fromUtf8("tab_4"))
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.tab_4)
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.pteLog = QtGui.QPlainTextEdit(self.tab_4)
        self.pteLog.setObjectName(_fromUtf8("pteLog"))
        self.verticalLayout_4.addWidget(self.pteLog)
        self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.progBatch = QtGui.QProgressBar(Biorec)
        self.progBatch.setProperty("value", 0)
        self.progBatch.setObjectName(_fromUtf8("progBatch"))
        self.horizontalLayout_6.addWidget(self.progBatch)
        self.pbCancel = QtGui.QPushButton(Biorec)
        self.pbCancel.setObjectName(_fromUtf8("pbCancel"))
        self.horizontalLayout_6.addWidget(self.pbCancel)
        self.verticalLayout.addLayout(self.horizontalLayout_6)
        self.horizontalLayout_5 = QtGui.QHBoxLayout()
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.cboSymbol = QtGui.QComboBox(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboSymbol.sizePolicy().hasHeightForWidth())
        self.cboSymbol.setSizePolicy(sizePolicy)
        self.cboSymbol.setMinimumSize(QtCore.QSize(90, 0))
        self.cboSymbol.setMaximumSize(QtCore.QSize(90, 16777215))
        self.cboSymbol.setObjectName(_fromUtf8("cboSymbol"))
        self.cboSymbol.addItem(_fromUtf8(""))
        self.cboSymbol.addItem(_fromUtf8(""))
        self.horizontalLayout_5.addWidget(self.cboSymbol)
        self.cboMapType = QtGui.QComboBox(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboMapType.sizePolicy().hasHeightForWidth())
        self.cboMapType.setSizePolicy(sizePolicy)
        self.cboMapType.setObjectName(_fromUtf8("cboMapType"))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.horizontalLayout_5.addWidget(self.cboMapType)
        self.dsbGridSize = QtGui.QDoubleSpinBox(Biorec)
        self.dsbGridSize.setDecimals(3)
        self.dsbGridSize.setMaximum(100000000.0)
        self.dsbGridSize.setSingleStep(100.0)
        self.dsbGridSize.setObjectName(_fromUtf8("dsbGridSize"))
        self.horizontalLayout_5.addWidget(self.dsbGridSize)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.butMap = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butMap.sizePolicy().hasHeightForWidth())
        self.butMap.setSizePolicy(sizePolicy)
        self.butMap.setMinimumSize(QtCore.QSize(32, 32))
        self.butMap.setMaximumSize(QtCore.QSize(32, 32))
        self.butMap.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8("images/maptaxa.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butMap.setIcon(icon1)
        self.butMap.setIconSize(QtCore.QSize(30, 30))
        self.butMap.setObjectName(_fromUtf8("butMap"))
        self.horizontalLayout_2.addWidget(self.butMap)
        self.butSaveImage = QtGui.QPushButton(Biorec)
        self.butSaveImage.setMinimumSize(QtCore.QSize(32, 32))
        self.butSaveImage.setMaximumSize(QtCore.QSize(32, 32))
        self.butSaveImage.setText(_fromUtf8(""))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8("images/saveimage.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butSaveImage.setIcon(icon2)
        self.butSaveImage.setIconSize(QtCore.QSize(28, 28))
        self.butSaveImage.setObjectName(_fromUtf8("butSaveImage"))
        self.horizontalLayout_2.addWidget(self.butSaveImage)
        self.butShowAll = QtGui.QPushButton(Biorec)
        self.butShowAll.setMinimumSize(QtCore.QSize(32, 32))
        self.butShowAll.setMaximumSize(QtCore.QSize(32, 32))
        self.butShowAll.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8("images/layershow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butShowAll.setIcon(icon3)
        self.butShowAll.setIconSize(QtCore.QSize(26, 26))
        self.butShowAll.setObjectName(_fromUtf8("butShowAll"))
        self.horizontalLayout_2.addWidget(self.butShowAll)
        self.butHideAll = QtGui.QPushButton(Biorec)
        self.butHideAll.setMinimumSize(QtCore.QSize(32, 32))
        self.butHideAll.setMaximumSize(QtCore.QSize(32, 32))
        self.butHideAll.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(_fromUtf8("images/layerhide.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butHideAll.setIcon(icon4)
        self.butHideAll.setIconSize(QtCore.QSize(26, 26))
        self.butHideAll.setObjectName(_fromUtf8("butHideAll"))
        self.horizontalLayout_2.addWidget(self.butHideAll)
        self.butRemoveMap = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butRemoveMap.sizePolicy().hasHeightForWidth())
        self.butRemoveMap.setSizePolicy(sizePolicy)
        self.butRemoveMap.setMinimumSize(QtCore.QSize(32, 32))
        self.butRemoveMap.setMaximumSize(QtCore.QSize(32, 32))
        self.butRemoveMap.setText(_fromUtf8(""))
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(_fromUtf8("images/removelayer.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butRemoveMap.setIcon(icon5)
        self.butRemoveMap.setIconSize(QtCore.QSize(30, 30))
        self.butRemoveMap.setObjectName(_fromUtf8("butRemoveMap"))
        self.horizontalLayout_2.addWidget(self.butRemoveMap)
        self.butRemoveMaps = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butRemoveMaps.sizePolicy().hasHeightForWidth())
        self.butRemoveMaps.setSizePolicy(sizePolicy)
        self.butRemoveMaps.setMinimumSize(QtCore.QSize(32, 32))
        self.butRemoveMaps.setMaximumSize(QtCore.QSize(32, 32))
        self.butRemoveMaps.setText(_fromUtf8(""))
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(_fromUtf8("images/removelayers.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butRemoveMaps.setIcon(icon6)
        self.butRemoveMaps.setIconSize(QtCore.QSize(30, 30))
        self.butRemoveMaps.setObjectName(_fromUtf8("butRemoveMaps"))
        self.horizontalLayout_2.addWidget(self.butRemoveMaps)
        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Biorec)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Biorec)
コード例 #17
0
class Ui_Biorec(object):
    def setupUi(self, Biorec):
        Biorec.setObjectName(_fromUtf8("Biorec"))
        Biorec.resize(395, 573)
        self.verticalLayout = QtGui.QVBoxLayout(Biorec)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(Biorec)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab = QtGui.QWidget()
        self.tab.setObjectName(_fromUtf8("tab"))
        self.formLayout = QtGui.QFormLayout(self.tab)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.butBrowse = QtGui.QPushButton(self.tab)
        self.butBrowse.setEnabled(True)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butBrowse.sizePolicy().hasHeightForWidth())
        self.butBrowse.setSizePolicy(sizePolicy)
        self.butBrowse.setObjectName(_fromUtf8("butBrowse"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.butBrowse)
        self.lblLayer = QtGui.QLabel(self.tab)
        self.lblLayer.setObjectName(_fromUtf8("lblLayer"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.lblLayer)
        self.mlcbSourceLayer = QgsMapLayerComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mlcbSourceLayer.sizePolicy().hasHeightForWidth())
        self.mlcbSourceLayer.setSizePolicy(sizePolicy)
        self.mlcbSourceLayer.setObjectName(_fromUtf8("mlcbSourceLayer"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.mlcbSourceLayer)
        self.lblGridRefCol = QtGui.QLabel(self.tab)
        self.lblGridRefCol.setObjectName(_fromUtf8("lblGridRefCol"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lblGridRefCol)
        self.fcbGridRefCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbGridRefCol.sizePolicy().hasHeightForWidth())
        self.fcbGridRefCol.setSizePolicy(sizePolicy)
        self.fcbGridRefCol.setObjectName(_fromUtf8("fcbGridRefCol"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fcbGridRefCol)
        self.lblXCol = QtGui.QLabel(self.tab)
        self.lblXCol.setObjectName(_fromUtf8("lblXCol"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lblXCol)
        self.fcbXCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbXCol.sizePolicy().hasHeightForWidth())
        self.fcbXCol.setSizePolicy(sizePolicy)
        self.fcbXCol.setObjectName(_fromUtf8("fcbXCol"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.fcbXCol)
        self.lblYCol = QtGui.QLabel(self.tab)
        self.lblYCol.setObjectName(_fromUtf8("lblYCol"))
        self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.lblYCol)
        self.fcbYCol = QgsFieldComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.fcbYCol.sizePolicy().hasHeightForWidth())
        self.fcbYCol.setSizePolicy(sizePolicy)
        self.fcbYCol.setObjectName(_fromUtf8("fcbYCol"))
        self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.fcbYCol)
        self.lblAbundanceColumn = QtGui.QLabel(self.tab)
        self.lblAbundanceColumn.setObjectName(_fromUtf8("lblAbundanceColumn"))
        self.formLayout.setWidget(5, QtGui.QFormLayout.LabelRole, self.lblAbundanceColumn)
        self.cboAbundanceCol = QtGui.QComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboAbundanceCol.sizePolicy().hasHeightForWidth())
        self.cboAbundanceCol.setSizePolicy(sizePolicy)
        self.cboAbundanceCol.setObjectName(_fromUtf8("cboAbundanceCol"))
        self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.cboAbundanceCol)
        self.lblTaxonCol = QtGui.QLabel(self.tab)
        self.lblTaxonCol.setObjectName(_fromUtf8("lblTaxonCol"))
        self.formLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.lblTaxonCol)
        self.cboTaxonCol = QtGui.QComboBox(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboTaxonCol.sizePolicy().hasHeightForWidth())
        self.cboTaxonCol.setSizePolicy(sizePolicy)
        self.cboTaxonCol.setObjectName(_fromUtf8("cboTaxonCol"))
        self.formLayout.setWidget(6, QtGui.QFormLayout.FieldRole, self.cboTaxonCol)
        self.cbIsScientific = QtGui.QCheckBox(self.tab)
        self.cbIsScientific.setEnabled(False)
        self.cbIsScientific.setChecked(False)
        self.cbIsScientific.setObjectName(_fromUtf8("cbIsScientific"))
        self.formLayout.setWidget(7, QtGui.QFormLayout.FieldRole, self.cbIsScientific)
        self.lblGroupingCol = QtGui.QLabel(self.tab)
        self.lblGroupingCol.setEnabled(False)
        self.lblGroupingCol.setObjectName(_fromUtf8("lblGroupingCol"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.lblGroupingCol)
        self.cboGroupingCol = QtGui.QComboBox(self.tab)
        self.cboGroupingCol.setEnabled(False)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboGroupingCol.sizePolicy().hasHeightForWidth())
        self.cboGroupingCol.setSizePolicy(sizePolicy)
        self.cboGroupingCol.setObjectName(_fromUtf8("cboGroupingCol"))
        self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.cboGroupingCol)
        self.lblInputCRS = QtGui.QLabel(self.tab)
        self.lblInputCRS.setObjectName(_fromUtf8("lblInputCRS"))
        self.formLayout.setWidget(9, QtGui.QFormLayout.LabelRole, self.lblInputCRS)
        self.pswInputCRS = QgsProjectionSelectionWidget(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pswInputCRS.sizePolicy().hasHeightForWidth())
        self.pswInputCRS.setSizePolicy(sizePolicy)
        self.pswInputCRS.setObjectName(_fromUtf8("pswInputCRS"))
        self.formLayout.setWidget(9, QtGui.QFormLayout.FieldRole, self.pswInputCRS)
        self.lblOutputCRS = QtGui.QLabel(self.tab)
        self.lblOutputCRS.setObjectName(_fromUtf8("lblOutputCRS"))
        self.formLayout.setWidget(10, QtGui.QFormLayout.LabelRole, self.lblOutputCRS)
        self.pswOutputCRS = QgsProjectionSelectionWidget(self.tab)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pswOutputCRS.sizePolicy().hasHeightForWidth())
        self.pswOutputCRS.setSizePolicy(sizePolicy)
        self.pswOutputCRS.setObjectName(_fromUtf8("pswOutputCRS"))
        self.formLayout.setWidget(10, QtGui.QFormLayout.FieldRole, self.pswOutputCRS)
        self.cbMatchCRS = QtGui.QCheckBox(self.tab)
        self.cbMatchCRS.setEnabled(True)
        self.cbMatchCRS.setChecked(False)
        self.cbMatchCRS.setObjectName(_fromUtf8("cbMatchCRS"))
        self.formLayout.setWidget(11, QtGui.QFormLayout.FieldRole, self.cbMatchCRS)
        spacerItem = QtGui.QSpacerItem(20, 84, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.formLayout.setItem(12, QtGui.QFormLayout.LabelRole, spacerItem)
        self.tabWidget.addTab(self.tab, _fromUtf8(""))
        self.tab_3 = QtGui.QWidget()
        self.tab_3.setObjectName(_fromUtf8("tab_3"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.tab_3)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.tvTaxa = QtGui.QTreeView(self.tab_3)
        self.tvTaxa.setToolTip(_fromUtf8(""))
        self.tvTaxa.setObjectName(_fromUtf8("tvTaxa"))
        self.tvTaxa.header().setVisible(False)
        self.verticalLayout_3.addWidget(self.tvTaxa)
        self.frame_2 = QtGui.QFrame(self.tab_3)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_2.sizePolicy().hasHeightForWidth())
        self.frame_2.setSizePolicy(sizePolicy)
        self.frame_2.setFrameShape(QtGui.QFrame.NoFrame)
        self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_2.setObjectName(_fromUtf8("frame_2"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.frame_2)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setMargin(0)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.butContract = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butContract.sizePolicy().hasHeightForWidth())
        self.butContract.setSizePolicy(sizePolicy)
        self.butContract.setMinimumSize(QtCore.QSize(25, 0))
        self.butContract.setMaximumSize(QtCore.QSize(25, 16777215))
        self.butContract.setObjectName(_fromUtf8("butContract"))
        self.horizontalLayout.addWidget(self.butContract)
        self.butExpand = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butExpand.sizePolicy().hasHeightForWidth())
        self.butExpand.setSizePolicy(sizePolicy)
        self.butExpand.setMinimumSize(QtCore.QSize(25, 0))
        self.butExpand.setMaximumSize(QtCore.QSize(25, 16777215))
        self.butExpand.setObjectName(_fromUtf8("butExpand"))
        self.horizontalLayout.addWidget(self.butExpand)
        self.butCheckAll = QtGui.QPushButton(self.frame_2)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butCheckAll.sizePolicy().hasHeightForWidth())
        self.butCheckAll.setSizePolicy(sizePolicy)
        self.butCheckAll.setMinimumSize(QtCore.QSize(55, 0))
        self.butCheckAll.setMaximumSize(QtCore.QSize(55, 16777215))
        self.butCheckAll.setObjectName(_fromUtf8("butCheckAll"))
        self.horizontalLayout.addWidget(self.butCheckAll)
        self.butUncheckAll = QtGui.QPushButton(self.frame_2)
        self.butUncheckAll.setMinimumSize(QtCore.QSize(65, 0))
        self.butUncheckAll.setMaximumSize(QtCore.QSize(65, 16777215))
        self.butUncheckAll.setObjectName(_fromUtf8("butUncheckAll"))
        self.horizontalLayout.addWidget(self.butUncheckAll)
        spacerItem1 = QtGui.QSpacerItem(200, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem1)
        self.butGenTree = QtGui.QPushButton(self.frame_2)
        self.butGenTree.setObjectName(_fromUtf8("butGenTree"))
        self.horizontalLayout.addWidget(self.butGenTree)
        self.verticalLayout_3.addWidget(self.frame_2)
        self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
        self.tab_5 = QtGui.QWidget()
        self.tab_5.setObjectName(_fromUtf8("tab_5"))
        self.verticalLayout_5 = QtGui.QVBoxLayout(self.tab_5)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.cboBatchMode = QtGui.QComboBox(self.tab_5)
        self.cboBatchMode.setMinimumSize(QtCore.QSize(130, 0))
        self.cboBatchMode.setMaximumSize(QtCore.QSize(130, 16777215))
        self.cboBatchMode.setObjectName(_fromUtf8("cboBatchMode"))
        self.cboBatchMode.addItem(_fromUtf8(""))
        self.cboBatchMode.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.cboBatchMode)
        self.horizontalLayout_4 = QtGui.QHBoxLayout()
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.leStyleFile = QtGui.QLineEdit(self.tab_5)
        self.leStyleFile.setObjectName(_fromUtf8("leStyleFile"))
        self.horizontalLayout_4.addWidget(self.leStyleFile)
        self.pbBrowseStyleFile = QtGui.QPushButton(self.tab_5)
        self.pbBrowseStyleFile.setMinimumSize(QtCore.QSize(105, 0))
        self.pbBrowseStyleFile.setObjectName(_fromUtf8("pbBrowseStyleFile"))
        self.horizontalLayout_4.addWidget(self.pbBrowseStyleFile)
        self.verticalLayout_5.addLayout(self.horizontalLayout_4)
        self.cbApplyStyle = QtGui.QCheckBox(self.tab_5)
        self.cbApplyStyle.setObjectName(_fromUtf8("cbApplyStyle"))
        self.verticalLayout_5.addWidget(self.cbApplyStyle)
        self.horizontalLayout_8 = QtGui.QHBoxLayout()
        self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
        self.label_2 = QtGui.QLabel(self.tab_5)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout_8.addWidget(self.label_2)
        self.hsLayerTransparency = QtGui.QSlider(self.tab_5)
        self.hsLayerTransparency.setOrientation(QtCore.Qt.Horizontal)
        self.hsLayerTransparency.setTickPosition(QtGui.QSlider.TicksBelow)
        self.hsLayerTransparency.setTickInterval(10)
        self.hsLayerTransparency.setObjectName(_fromUtf8("hsLayerTransparency"))
        self.horizontalLayout_8.addWidget(self.hsLayerTransparency)
        self.verticalLayout_5.addLayout(self.horizontalLayout_8)
        self.mGroupBox = QgsCollapsibleGroupBox(self.tab_5)
        self.mGroupBox.setObjectName(_fromUtf8("mGroupBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.mGroupBox)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout_9 = QtGui.QHBoxLayout()
        self.horizontalLayout_9.setObjectName(_fromUtf8("horizontalLayout_9"))
        self.label = QtGui.QLabel(self.mGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)
        self.label.setMinimumSize(QtCore.QSize(34, 0))
        self.label.setMaximumSize(QtCore.QSize(34, 16777215))
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout_9.addWidget(self.label)
        self.cboOutputFormat = QtGui.QComboBox(self.mGroupBox)
        self.cboOutputFormat.setEditable(False)
        self.cboOutputFormat.setObjectName(_fromUtf8("cboOutputFormat"))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.cboOutputFormat.addItem(_fromUtf8(""))
        self.horizontalLayout_9.addWidget(self.cboOutputFormat)
        self.verticalLayout_2.addLayout(self.horizontalLayout_9)
        self.qgsOutputCRS = QgsProjectionSelectionWidget(self.mGroupBox)
        self.qgsOutputCRS.setObjectName(_fromUtf8("qgsOutputCRS"))
        self.verticalLayout_2.addWidget(self.qgsOutputCRS)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.leImageFolder = QtGui.QLineEdit(self.mGroupBox)
        self.leImageFolder.setObjectName(_fromUtf8("leImageFolder"))
        self.horizontalLayout_3.addWidget(self.leImageFolder)
        self.pbBrowseImageFolder = QtGui.QPushButton(self.mGroupBox)
        self.pbBrowseImageFolder.setObjectName(_fromUtf8("pbBrowseImageFolder"))
        self.horizontalLayout_3.addWidget(self.pbBrowseImageFolder)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_10 = QtGui.QHBoxLayout()
        self.horizontalLayout_10.setObjectName(_fromUtf8("horizontalLayout_10"))
        self.cbTaxonMetaData = QtGui.QCheckBox(self.mGroupBox)
        self.cbTaxonMetaData.setMinimumSize(QtCore.QSize(131, 0))
        self.cbTaxonMetaData.setMaximumSize(QtCore.QSize(131, 16777215))
        self.cbTaxonMetaData.setObjectName(_fromUtf8("cbTaxonMetaData"))
        self.horizontalLayout_10.addWidget(self.cbTaxonMetaData)
        self.mlcbTaxonMetaDataLayer = QgsMapLayerComboBox(self.mGroupBox)
        self.mlcbTaxonMetaDataLayer.setObjectName(_fromUtf8("mlcbTaxonMetaDataLayer"))
        self.horizontalLayout_10.addWidget(self.mlcbTaxonMetaDataLayer)
        self.verticalLayout_2.addLayout(self.horizontalLayout_10)
        self.verticalLayout_5.addWidget(self.mGroupBox)
        self.horizontalLayout_7 = QtGui.QHBoxLayout()
        self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
        self.butHelp = QtGui.QPushButton(self.tab_5)
        self.butHelp.setMinimumSize(QtCore.QSize(32, 32))
        self.butHelp.setMaximumSize(QtCore.QSize(32, 32))
        self.butHelp.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("images/bang.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butHelp.setIcon(icon)
        self.butHelp.setIconSize(QtCore.QSize(26, 26))
        self.butHelp.setObjectName(_fromUtf8("butHelp"))
        self.horizontalLayout_7.addWidget(self.butHelp)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem2)
        self.verticalLayout_5.addLayout(self.horizontalLayout_7)
        spacerItem3 = QtGui.QSpacerItem(20, 52, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout_5.addItem(spacerItem3)
        self.tabWidget.addTab(self.tab_5, _fromUtf8(""))
        self.tab_4 = QtGui.QWidget()
        self.tab_4.setObjectName(_fromUtf8("tab_4"))
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.tab_4)
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.pteLog = QtGui.QPlainTextEdit(self.tab_4)
        self.pteLog.setObjectName(_fromUtf8("pteLog"))
        self.verticalLayout_4.addWidget(self.pteLog)
        self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.progBatch = QtGui.QProgressBar(Biorec)
        self.progBatch.setProperty("value", 0)
        self.progBatch.setObjectName(_fromUtf8("progBatch"))
        self.horizontalLayout_6.addWidget(self.progBatch)
        self.pbCancel = QtGui.QPushButton(Biorec)
        self.pbCancel.setObjectName(_fromUtf8("pbCancel"))
        self.horizontalLayout_6.addWidget(self.pbCancel)
        self.verticalLayout.addLayout(self.horizontalLayout_6)
        self.horizontalLayout_5 = QtGui.QHBoxLayout()
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.cboSymbol = QtGui.QComboBox(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboSymbol.sizePolicy().hasHeightForWidth())
        self.cboSymbol.setSizePolicy(sizePolicy)
        self.cboSymbol.setMinimumSize(QtCore.QSize(90, 0))
        self.cboSymbol.setMaximumSize(QtCore.QSize(90, 16777215))
        self.cboSymbol.setObjectName(_fromUtf8("cboSymbol"))
        self.cboSymbol.addItem(_fromUtf8(""))
        self.cboSymbol.addItem(_fromUtf8(""))
        self.horizontalLayout_5.addWidget(self.cboSymbol)
        self.cboMapType = QtGui.QComboBox(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cboMapType.sizePolicy().hasHeightForWidth())
        self.cboMapType.setSizePolicy(sizePolicy)
        self.cboMapType.setObjectName(_fromUtf8("cboMapType"))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.cboMapType.addItem(_fromUtf8(""))
        self.horizontalLayout_5.addWidget(self.cboMapType)
        self.dsbGridSize = QtGui.QDoubleSpinBox(Biorec)
        self.dsbGridSize.setDecimals(3)
        self.dsbGridSize.setMaximum(100000000.0)
        self.dsbGridSize.setSingleStep(100.0)
        self.dsbGridSize.setObjectName(_fromUtf8("dsbGridSize"))
        self.horizontalLayout_5.addWidget(self.dsbGridSize)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.butMap = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butMap.sizePolicy().hasHeightForWidth())
        self.butMap.setSizePolicy(sizePolicy)
        self.butMap.setMinimumSize(QtCore.QSize(32, 32))
        self.butMap.setMaximumSize(QtCore.QSize(32, 32))
        self.butMap.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8("images/maptaxa.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butMap.setIcon(icon1)
        self.butMap.setIconSize(QtCore.QSize(30, 30))
        self.butMap.setObjectName(_fromUtf8("butMap"))
        self.horizontalLayout_2.addWidget(self.butMap)
        self.butSaveImage = QtGui.QPushButton(Biorec)
        self.butSaveImage.setMinimumSize(QtCore.QSize(32, 32))
        self.butSaveImage.setMaximumSize(QtCore.QSize(32, 32))
        self.butSaveImage.setText(_fromUtf8(""))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8("images/saveimage.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butSaveImage.setIcon(icon2)
        self.butSaveImage.setIconSize(QtCore.QSize(28, 28))
        self.butSaveImage.setObjectName(_fromUtf8("butSaveImage"))
        self.horizontalLayout_2.addWidget(self.butSaveImage)
        self.butShowAll = QtGui.QPushButton(Biorec)
        self.butShowAll.setMinimumSize(QtCore.QSize(32, 32))
        self.butShowAll.setMaximumSize(QtCore.QSize(32, 32))
        self.butShowAll.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8("images/layershow.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butShowAll.setIcon(icon3)
        self.butShowAll.setIconSize(QtCore.QSize(26, 26))
        self.butShowAll.setObjectName(_fromUtf8("butShowAll"))
        self.horizontalLayout_2.addWidget(self.butShowAll)
        self.butHideAll = QtGui.QPushButton(Biorec)
        self.butHideAll.setMinimumSize(QtCore.QSize(32, 32))
        self.butHideAll.setMaximumSize(QtCore.QSize(32, 32))
        self.butHideAll.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(_fromUtf8("images/layerhide.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butHideAll.setIcon(icon4)
        self.butHideAll.setIconSize(QtCore.QSize(26, 26))
        self.butHideAll.setObjectName(_fromUtf8("butHideAll"))
        self.horizontalLayout_2.addWidget(self.butHideAll)
        self.butRemoveMap = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butRemoveMap.sizePolicy().hasHeightForWidth())
        self.butRemoveMap.setSizePolicy(sizePolicy)
        self.butRemoveMap.setMinimumSize(QtCore.QSize(32, 32))
        self.butRemoveMap.setMaximumSize(QtCore.QSize(32, 32))
        self.butRemoveMap.setText(_fromUtf8(""))
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(_fromUtf8("images/removelayer.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butRemoveMap.setIcon(icon5)
        self.butRemoveMap.setIconSize(QtCore.QSize(30, 30))
        self.butRemoveMap.setObjectName(_fromUtf8("butRemoveMap"))
        self.horizontalLayout_2.addWidget(self.butRemoveMap)
        self.butRemoveMaps = QtGui.QPushButton(Biorec)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.butRemoveMaps.sizePolicy().hasHeightForWidth())
        self.butRemoveMaps.setSizePolicy(sizePolicy)
        self.butRemoveMaps.setMinimumSize(QtCore.QSize(32, 32))
        self.butRemoveMaps.setMaximumSize(QtCore.QSize(32, 32))
        self.butRemoveMaps.setText(_fromUtf8(""))
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap(_fromUtf8("images/removelayers.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.butRemoveMaps.setIcon(icon6)
        self.butRemoveMaps.setIconSize(QtCore.QSize(30, 30))
        self.butRemoveMaps.setObjectName(_fromUtf8("butRemoveMaps"))
        self.horizontalLayout_2.addWidget(self.butRemoveMaps)
        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem4)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Biorec)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Biorec)

    def retranslateUi(self, Biorec):
        Biorec.setWindowTitle(_translate("Biorec", "TomBio", None))
        self.butBrowse.setToolTip(_translate("Biorec", "Browse for CSV file", None))
        self.butBrowse.setText(_translate("Biorec", "Create new source layer from CSV", None))
        self.lblLayer.setText(_translate("Biorec", "Source layer", None))
        self.lblGridRefCol.setText(_translate("Biorec", "OS Grid Ref Column", None))
        self.lblXCol.setText(_translate("Biorec", "X Column", None))
        self.lblYCol.setText(_translate("Biorec", "Y Column", None))
        self.lblAbundanceColumn.setText(_translate("Biorec", "Abundance Column", None))
        self.cboAbundanceCol.setToolTip(_translate("Biorec", "Optional column with abundance data", None))
        self.lblTaxonCol.setText(_translate("Biorec", "Taxon Column", None))
        self.cboTaxonCol.setToolTip(_translate("Biorec", "Select column with species names", None))
        self.cbIsScientific.setToolTip(_translate("Biorec", "Select if taxon column contains scientific binomials", None))
        self.cbIsScientific.setText(_translate("Biorec", "Scientific names", None))
        self.lblGroupingCol.setText(_translate("Biorec", "Grouping Column", None))
        self.cboGroupingCol.setToolTip(_translate("Biorec", "Optionally select a grouping column", None))
        self.lblInputCRS.setText(_translate("Biorec", "Input CRS", None))
        self.lblOutputCRS.setText(_translate("Biorec", "Output CRS", None))
        self.cbMatchCRS.setToolTip(_translate("Biorec", "Select if taxon column contains scientific binomials", None))
        self.cbMatchCRS.setText(_translate("Biorec", "Match to input CRS", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Biorec", "Data specification", None))
        self.butContract.setToolTip(_translate("Biorec", "Contract all items", None))
        self.butContract.setText(_translate("Biorec", "-", None))
        self.butExpand.setToolTip(_translate("Biorec", "Expand all items", None))
        self.butExpand.setText(_translate("Biorec", "+", None))
        self.butCheckAll.setToolTip(_translate("Biorec", "Check all items", None))
        self.butCheckAll.setText(_translate("Biorec", "Check all", None))
        self.butUncheckAll.setToolTip(_translate("Biorec", "Uncheck all items", None))
        self.butUncheckAll.setText(_translate("Biorec", "Uncheck all", None))
        self.butGenTree.setToolTip(_translate("Biorec", "Create/recreate species tree", None))
        self.butGenTree.setText(_translate("Biorec", "Load taxa", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("Biorec", "Taxa", None))
        self.cboBatchMode.setToolTip(_translate("Biorec", "Single or batch mode?", None))
        self.cboBatchMode.setItemText(0, _translate("Biorec", "Single map mode", None))
        self.cboBatchMode.setItemText(1, _translate("Biorec", "Batch map mode", None))
        self.leStyleFile.setToolTip(_translate("Biorec", "Path of style file to apply to created maps", None))
        self.pbBrowseStyleFile.setText(_translate("Biorec", "Browse style file", None))
        self.cbApplyStyle.setText(_translate("Biorec", "Apply style", None))
        self.label_2.setText(_translate("Biorec", "Transparency", None))
        self.mGroupBox.setTitle(_translate("Biorec", "Output options", None))
        self.label.setText(_translate("Biorec", "Format", None))
        self.cboOutputFormat.setItemText(0, _translate("Biorec", "Image", None))
        self.cboOutputFormat.setItemText(1, _translate("Biorec", "Shapefile", None))
        self.cboOutputFormat.setItemText(2, _translate("Biorec", "GeoJSON", None))
        self.cboOutputFormat.setItemText(3, _translate("Biorec", "Composer image", None))
        self.cboOutputFormat.setItemText(4, _translate("Biorec", "Composer PDF", None))
        self.leImageFolder.setToolTip(_translate("Biorec", "Folder for atlas images", None))
        self.pbBrowseImageFolder.setText(_translate("Biorec", "Browse output folder", None))
        self.cbTaxonMetaData.setText(_translate("Biorec", "Taxon Metadata Layer", None))
        self.butHelp.setToolTip(_translate("Biorec", "Tips and help", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("Biorec", "Options", None))
        self.pteLog.setToolTip(_translate("Biorec", "Information messages generated during map layer creation", None))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("Biorec", "Log", None))
        self.progBatch.setToolTip(_translate("Biorec", "Shows progress in batch mode", None))
        self.pbCancel.setToolTip(_translate("Biorec", "Cancel batch process", None))
        self.pbCancel.setText(_translate("Biorec", "Cancel", None))
        self.cboSymbol.setToolTip(_translate("Biorec", "Squares or circles?", None))
        self.cboSymbol.setItemText(0, _translate("Biorec", "Atlas squares", None))
        self.cboSymbol.setItemText(1, _translate("Biorec", "Atlas circles", None))
        self.cboMapType.setToolTip(_translate("Biorec", "Type of map", None))
        self.cboMapType.setItemText(0, _translate("Biorec", "Records as points", None))
        self.cboMapType.setItemText(1, _translate("Biorec", "Records as grid squares", None))
        self.cboMapType.setItemText(2, _translate("Biorec", "10 m atlas (8 fig gr)", None))
        self.cboMapType.setItemText(3, _translate("Biorec", "100 m atlas (6 fig gr)", None))
        self.cboMapType.setItemText(4, _translate("Biorec", "1 km atlas (monads)", None))
        self.cboMapType.setItemText(5, _translate("Biorec", "2 km atlas (tetrads)", None))
        self.cboMapType.setItemText(6, _translate("Biorec", "5 km atlas (quadrants)", None))
        self.cboMapType.setItemText(7, _translate("Biorec", "10 km atlas (hectads)", None))
        self.cboMapType.setItemText(8, _translate("Biorec", "User-defined atlas size:", None))
        self.dsbGridSize.setToolTip(_translate("Biorec", "<html><head/><body><p>Grid size for atlas - specify in units used by output CRS</p></body></html>", None))
        self.butMap.setToolTip(_translate("Biorec", "Create map layer", None))
        self.butSaveImage.setToolTip(_translate("Biorec", "Save temporary map layers as images or permanent layers", None))
        self.butShowAll.setToolTip(_translate("Biorec", "Show all generated map layers", None))
        self.butHideAll.setToolTip(_translate("Biorec", "Hide all generated map layers", None))
        self.butRemoveMap.setToolTip(_translate("Biorec", "Remove last map layer", None))
        self.butRemoveMaps.setToolTip(_translate("Biorec", "Remove all map layers", None))
コード例 #18
0
class Ui_hcmgis_find_replace_form(object):
    def setupUi(self, hcmgis_find_replace_form):
        hcmgis_find_replace_form.setObjectName("hcmgis_find_replace_form")
        hcmgis_find_replace_form.setWindowModality(QtCore.Qt.ApplicationModal)
        hcmgis_find_replace_form.setEnabled(True)
        hcmgis_find_replace_form.resize(341, 235)
        hcmgis_find_replace_form.setMouseTracking(False)
        self.verticalLayout = QtWidgets.QVBoxLayout(hcmgis_find_replace_form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.LblInput = QtWidgets.QLabel(hcmgis_find_replace_form)
        self.LblInput.setObjectName("LblInput")
        self.verticalLayout.addWidget(self.LblInput)
        self.CboInput = QgsMapLayerComboBox(hcmgis_find_replace_form)
        self.CboInput.setObjectName("CboInput")
        self.verticalLayout.addWidget(self.CboInput)
        self.LblOutput_2 = QtWidgets.QLabel(hcmgis_find_replace_form)
        self.LblOutput_2.setObjectName("LblOutput_2")
        self.verticalLayout.addWidget(self.LblOutput_2)
        self.CboField = QgsFieldComboBox(hcmgis_find_replace_form)
        self.CboField.setObjectName("CboField")
        self.verticalLayout.addWidget(self.CboField)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.LblChar = QtWidgets.QLabel(hcmgis_find_replace_form)
        self.LblChar.setObjectName("LblChar")
        self.gridLayout.addWidget(self.LblChar, 0, 0, 1, 1)
        self.LblChar_2 = QtWidgets.QLabel(hcmgis_find_replace_form)
        self.LblChar_2.setObjectName("LblChar_2")
        self.gridLayout.addWidget(self.LblChar_2, 0, 1, 1, 1)
        self.LinFind = QtWidgets.QLineEdit(hcmgis_find_replace_form)
        self.LinFind.setObjectName("LinFind")
        self.gridLayout.addWidget(self.LinFind, 1, 0, 1, 1)
        self.LinReplace = QtWidgets.QLineEdit(hcmgis_find_replace_form)
        self.LinReplace.setObjectName("LinReplace")
        self.gridLayout.addWidget(self.LinReplace, 1, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.ChkSelectedFeaturesOnly = QtWidgets.QCheckBox(
            hcmgis_find_replace_form)
        self.ChkSelectedFeaturesOnly.setObjectName("ChkSelectedFeaturesOnly")
        self.verticalLayout.addWidget(self.ChkSelectedFeaturesOnly)
        self.BtnOKCancel = QtWidgets.QDialogButtonBox(hcmgis_find_replace_form)
        self.BtnOKCancel.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                            | QtWidgets.QDialogButtonBox.Ok)
        self.BtnOKCancel.setObjectName("BtnOKCancel")
        self.verticalLayout.addWidget(self.BtnOKCancel)

        self.retranslateUi(hcmgis_find_replace_form)
        self.BtnOKCancel.accepted.connect(hcmgis_find_replace_form.accept)
        self.BtnOKCancel.rejected.connect(hcmgis_find_replace_form.reject)
        QtCore.QMetaObject.connectSlotsByName(hcmgis_find_replace_form)

    def retranslateUi(self, hcmgis_find_replace_form):
        _translate = QtCore.QCoreApplication.translate
        hcmgis_find_replace_form.setWindowTitle(
            _translate("hcmgis_find_replace_form", "Find and Replace"))
        self.LblInput.setText(
            _translate("hcmgis_find_replace_form", "Input Layer"))
        self.LblOutput_2.setText(
            _translate("hcmgis_find_replace_form", "Field"))
        self.LblChar.setText(_translate("hcmgis_find_replace_form", "Find"))
        self.LblChar_2.setText(
            _translate("hcmgis_find_replace_form", "Replace"))
        self.ChkSelectedFeaturesOnly.setText(
            _translate("hcmgis_find_replace_form", "Selected features only"))
コード例 #19
0
ファイル: dialog.py プロジェクト: nextgis/qgis.connect_points
class Dialog(QtGui.QDialog):
    def __init__(
            self,
            curPointsLayerFrom,
            curPointsLayerTo,
            curFNIdFrom,
            curFNLink,
            curFNIdTo,
            curResultLayerName,
            parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.resize(500, 200)

        self.setWindowTitle(QgisPlugin().pluginName)
        self.__mainLayout = QtGui.QVBoxLayout(self)
        self.__layout = QtGui.QGridLayout(self)

        l1 = QtGui.QLabel(self.tr(u"Point layer 'FROM'") + ":")
        l1.setSizePolicy(
            QtGui.QSizePolicy.Preferred,
            QtGui.QSizePolicy.Fixed
        )
        self.__layout.addWidget(l1, 0, 0)
        self.pointsLayerFrom = QgsMapLayerComboBox()
        self.pointsLayerFrom.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.pointsLayerFrom.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.pointsLayerFrom.setEditable(True)
        # self.pointsLayerFrom.setEditText(curPointsLayerFrom)
        self.pointsLayerFrom.layerChanged.connect(self.choozeLayerFrom)
        self.__layout.addWidget(self.pointsLayerFrom, 0, 1)

        l2 = QtGui.QLabel(self.tr(u"Point layer 'TO'") + ":")
        l2.setSizePolicy(
            QtGui.QSizePolicy.Preferred,
            QtGui.QSizePolicy.Fixed
        )
        self.__layout.addWidget(l2, 1, 0)
        self.pointsLayerTo = QgsMapLayerComboBox()
        self.pointsLayerTo.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.pointsLayerTo.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.pointsLayerTo.setEditable(True)
        # self.pointsLayerTo.setEditText(curPointsLayerTo)
        self.pointsLayerTo.layerChanged.connect(self.choozeLayerTo)
        self.__layout.addWidget(self.pointsLayerTo, 1, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Point 'FROM' id field") + ":"),
            2, 0
        )
        self.fnIdFrom = QgsFieldComboBox()
        self.fnIdFrom.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnIdFrom.setEditable(True)
        # self.fnIdFrom.setEditText(curFNIdFrom)
        self.fnIdFrom.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnIdFrom, 2, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Link field") + ":"),
            3, 0
        )
        self.fnLink = QgsFieldComboBox()
        self.fnLink.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnLink.setEditable(True)
        # self.fnLink.setEditText(curFNLink)
        self.fnLink.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnLink, 3, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Point 'TO' id field") + ":"), 4, 0)
        self.fnIdTo = QgsFieldComboBox()
        self.fnIdTo.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnIdTo.setEditable(True)
        # self.fnIdTo.setEditText(curFNIdTo)
        self.fnIdTo.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnIdTo, 4, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Save result in layer") + ":"),
            5, 0
        )
        self.linesLayer = QgsMapLayerComboBox()
        self.linesLayer.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.linesLayer.setFilters(QgsMapLayerProxyModel.LineLayer)
        self.linesLayer.setEditable(True)
        self.linesLayer.layerChanged.connect(self.choozeResultLayer)
        self.__layout.addWidget(self.linesLayer, 5, 1)

        # self.__layout4resultFileChoose = QtGui.QHBoxLayout()
        # self.leResultFilename = QtGui.QLineEdit(curResultFilename)
        # self.__layout4resultFileChoose.addWidget(self.leResultFilename)
        # self.pbChooseResultFilename = QtGui.QPushButton(u"Выбрать")
        # self.pbChooseResultFilename.released.connect(self.chooseResultFilename)
        # self.__layout4resultFileChoose.addWidget(self.pbChooseResultFilename)
        # self.__layout.addLayout(self.__layout4resultFileChoose, 6, 0, 2, 0)

        self.pointsLayerFrom.layerChanged.connect(self.fnIdFrom.setLayer)
        self.pointsLayerFrom.layerChanged.connect(self.fnLink.setLayer)

        self.pointsLayerTo.layerChanged.connect(self.fnIdTo.setLayer)

        self.__mainLayout.addLayout(self.__layout)

        self.__bbox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
        self.__bbox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        self.__bbox.accepted.connect(self.accept)
        self.__mainLayout.addWidget(self.__bbox)

        self.fillControls(
            curPointsLayerFrom,
            curPointsLayerTo,
            curFNIdFrom,
            curFNLink,
            curFNIdTo,
            curResultLayerName
        )

    def fillControls(
        self,
        curPointsLayerFrom,
        curPointsLayerTo,
        curFNIdFrom,
        curFNLink,
        curFNIdTo,
        curResultLayerName
    ):
        QgisPlugin().plPrint("curPointsLayerFrom: " + curPointsLayerFrom)
        QgisPlugin().plPrint("curPointsLayerTo: " + curPointsLayerTo)
        QgisPlugin().plPrint("curFNIdFrom: " + curPointsLayerFrom)
        QgisPlugin().plPrint("curFNLink: " + curFNIdFrom)
        QgisPlugin().plPrint("curPointsLayerFrom: " + curFNLink)
        QgisPlugin().plPrint("curFNIdTo: " + curFNIdTo)
        QgisPlugin().plPrint("curResultLayerName: " + curResultLayerName)

        layerFrom = self.getQGISLayer(curPointsLayerFrom)
        layerTo = self.getQGISLayer(curPointsLayerTo)
        layerResult = self.getQGISLayer(curResultLayerName, True)

        if layerFrom is None:
            self.pointsLayerFrom.setCurrentIndex(-1)
            self.pointsLayerFrom.setEditText(curPointsLayerFrom)
        else:
            self.pointsLayerFrom.setLayer(layerFrom)

        if layerTo is None:
            self.pointsLayerTo.setCurrentIndex(-1)
            self.pointsLayerTo.setEditText(curPointsLayerTo)
        else:
            self.pointsLayerTo.setLayer(layerTo)

        if layerResult is None:
            self.linesLayer.setCurrentIndex(-1)
            self.linesLayer.setEditText(curResultLayerName)
        else:
            self.linesLayer.setLayer(layerResult)

        # self.fnIdFrom.clear()
        # self.fnLink.clear()
        # self.fnIdTo.clear()

        # self.fnIdFrom.setField(curFNIdFrom)
        self.fnIdFrom.setCurrentIndex(-1)
        self.fnIdFrom.setEditText(curFNIdFrom)
        # self.fnLink.setField(curFNLink)
        self.fnLink.setCurrentIndex(-1)
        self.fnLink.setEditText(curFNLink)
        # self.fnIdTo.setField(curFNIdTo)
        self.fnIdTo.setCurrentIndex(-1)
        self.fnIdTo.setEditText(curFNIdTo)

    def getQGISLayer(self, layerName, silent=False):
        if layerName is None:
            return
        if layerName == "":
            return

        layers = QgsMapLayerRegistry.instance().mapLayersByName(layerName)
        if len(layers) == 0:
            if silent is False:
                QgisPlugin().showMessageForUser(
                    self.tr(u"Layer with name '%s' not found!") % layerName,
                    QgsMessageBar.CRITICAL,
                    0
                )
            return None
        return layers[0]

    def choozeLayerFrom(self, qgsMapLayer):
        self.pointsLayerFrom.setEditText(qgsMapLayer.name())

    def choozeLayerTo(self, qgsMapLayer):
        self.pointsLayerTo.setEditText(qgsMapLayer.name())

    def choozeResultLayer(self, qgsMapLayer):
        self.linesLayer.setEditText(qgsMapLayer.name())

    def filedChooze(self, fieldName):
        self.sender().setEditText(fieldName)

    def chooseResultFilename(self):
        filename = QtGui.QFileDialog.getSaveFileName(
            self,
            self.tr(u"Choose file for save result"),
            self.curResultFilename
            # QtCore.QFileInfo(self.curResultFilename).absolutePath()
        )
        self.leResultFilename.setText(filename)

    def getSettings(self):
        return [
            self.pointsLayerFrom.currentText(),
            self.pointsLayerTo.currentText(),
            self.fnIdFrom.currentText(),
            self.fnLink.currentText(),
            self.fnIdTo.currentText(),
            self.linesLayer.currentText(),
        ]
    def testGettersSetters(self):
        """ test combobox getters/setters """
        l = create_layer()
        w = QgsFieldComboBox()
        w.setLayer(l)
        self.assertEqual(w.layer(), l)

        w.setField('fldint')
        self.assertEqual(w.currentField(), 'fldint')

        fields = QgsFields()
        fields.append(QgsField('test1', QVariant.String))
        fields.append(QgsField('test2', QVariant.String))
        w.setFields(fields)
        self.assertIsNone(w.layer())
        self.assertEqual(w.fields(), fields)
コード例 #21
0
ファイル: dialog.py プロジェクト: nextgis/qgis.connect_points
    def __init__(
            self,
            curPointsLayerFrom,
            curPointsLayerTo,
            curFNIdFrom,
            curFNLink,
            curFNIdTo,
            curResultLayerName,
            parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.resize(500, 200)

        self.setWindowTitle(QgisPlugin().pluginName)
        self.__mainLayout = QtGui.QVBoxLayout(self)
        self.__layout = QtGui.QGridLayout(self)

        l1 = QtGui.QLabel(self.tr(u"Point layer 'FROM'") + ":")
        l1.setSizePolicy(
            QtGui.QSizePolicy.Preferred,
            QtGui.QSizePolicy.Fixed
        )
        self.__layout.addWidget(l1, 0, 0)
        self.pointsLayerFrom = QgsMapLayerComboBox()
        self.pointsLayerFrom.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.pointsLayerFrom.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.pointsLayerFrom.setEditable(True)
        # self.pointsLayerFrom.setEditText(curPointsLayerFrom)
        self.pointsLayerFrom.layerChanged.connect(self.choozeLayerFrom)
        self.__layout.addWidget(self.pointsLayerFrom, 0, 1)

        l2 = QtGui.QLabel(self.tr(u"Point layer 'TO'") + ":")
        l2.setSizePolicy(
            QtGui.QSizePolicy.Preferred,
            QtGui.QSizePolicy.Fixed
        )
        self.__layout.addWidget(l2, 1, 0)
        self.pointsLayerTo = QgsMapLayerComboBox()
        self.pointsLayerTo.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.pointsLayerTo.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.pointsLayerTo.setEditable(True)
        # self.pointsLayerTo.setEditText(curPointsLayerTo)
        self.pointsLayerTo.layerChanged.connect(self.choozeLayerTo)
        self.__layout.addWidget(self.pointsLayerTo, 1, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Point 'FROM' id field") + ":"),
            2, 0
        )
        self.fnIdFrom = QgsFieldComboBox()
        self.fnIdFrom.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnIdFrom.setEditable(True)
        # self.fnIdFrom.setEditText(curFNIdFrom)
        self.fnIdFrom.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnIdFrom, 2, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Link field") + ":"),
            3, 0
        )
        self.fnLink = QgsFieldComboBox()
        self.fnLink.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnLink.setEditable(True)
        # self.fnLink.setEditText(curFNLink)
        self.fnLink.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnLink, 3, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Point 'TO' id field") + ":"), 4, 0)
        self.fnIdTo = QgsFieldComboBox()
        self.fnIdTo.setFilters(QgsFieldProxyModel.Int | QgsFieldProxyModel.LongLong)
        self.fnIdTo.setEditable(True)
        # self.fnIdTo.setEditText(curFNIdTo)
        self.fnIdTo.fieldChanged.connect(self.filedChooze)
        self.__layout.addWidget(self.fnIdTo, 4, 1)

        self.__layout.addWidget(
            QtGui.QLabel(self.tr(u"Save result in layer") + ":"),
            5, 0
        )
        self.linesLayer = QgsMapLayerComboBox()
        self.linesLayer.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Fixed
        )
        self.linesLayer.setFilters(QgsMapLayerProxyModel.LineLayer)
        self.linesLayer.setEditable(True)
        self.linesLayer.layerChanged.connect(self.choozeResultLayer)
        self.__layout.addWidget(self.linesLayer, 5, 1)

        # self.__layout4resultFileChoose = QtGui.QHBoxLayout()
        # self.leResultFilename = QtGui.QLineEdit(curResultFilename)
        # self.__layout4resultFileChoose.addWidget(self.leResultFilename)
        # self.pbChooseResultFilename = QtGui.QPushButton(u"Выбрать")
        # self.pbChooseResultFilename.released.connect(self.chooseResultFilename)
        # self.__layout4resultFileChoose.addWidget(self.pbChooseResultFilename)
        # self.__layout.addLayout(self.__layout4resultFileChoose, 6, 0, 2, 0)

        self.pointsLayerFrom.layerChanged.connect(self.fnIdFrom.setLayer)
        self.pointsLayerFrom.layerChanged.connect(self.fnLink.setLayer)

        self.pointsLayerTo.layerChanged.connect(self.fnIdTo.setLayer)

        self.__mainLayout.addLayout(self.__layout)

        self.__bbox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
        self.__bbox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        self.__bbox.accepted.connect(self.accept)
        self.__mainLayout.addWidget(self.__bbox)

        self.fillControls(
            curPointsLayerFrom,
            curPointsLayerTo,
            curFNIdFrom,
            curFNLink,
            curFNIdTo,
            curResultLayerName
        )
コード例 #22
0
ファイル: uav_preparer.py プロジェクト: biglimp/UAVPreparer
class UAVPreparer:
    """QGIS Plugin Implementation."""
    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(self.plugin_dir, 'i18n',
                                   'UAVPreparer_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)
            QCoreApplication.installTranslator(self.translator)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&UAV Preparer')

        # Check if plugin was started the first time in current QGIS session
        # Must be set in initGui() to survive plugin reloads
        self.first_start = None

        # Declare variables
        self.outputfile = None

    # noinspection PyMethodMayBeStatic
    def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('UAVPreparer', message)

    def add_action(self,
                   icon_path,
                   text,
                   callback,
                   enabled_flag=True,
                   add_to_menu=True,
                   add_to_toolbar=True,
                   status_tip=None,
                   whats_this=None,
                   parent=None):
        """Add a toolbar icon to the toolbar.

        :param icon_path: Path to the icon for this action. Can be a resource
            path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
        :type icon_path: str

        :param text: Text that should be shown in menu items for this action.
        :type text: str

        :param callback: Function to be called when the action is triggered.
        :type callback: function

        :param enabled_flag: A flag indicating if the action should be enabled
            by default. Defaults to True.
        :type enabled_flag: bool

        :param add_to_menu: Flag indicating whether the action should also
            be added to the menu. Defaults to True.
        :type add_to_menu: bool

        :param add_to_toolbar: Flag indicating whether the action should also
            be added to the toolbar. Defaults to True.
        :type add_to_toolbar: bool

        :param status_tip: Optional text to show in a popup when mouse pointer
            hovers over the action.
        :type status_tip: str

        :param parent: Parent widget for the new action. Defaults None.
        :type parent: QWidget

        :param whats_this: Optional text to show in the status bar when the
            mouse pointer hovers over the action.

        :returns: The action that was created. Note that the action is also
            added to self.actions list.
        :rtype: QAction
        """

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            # Adds plugin icon to Plugins toolbar
            self.iface.addToolBarIcon(action)

        if add_to_menu:
            self.iface.addPluginToMenu(self.menu, action)

        self.actions.append(action)

        return action

    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        icon_path = ':/plugins/uav_preparer/icon.png'
        self.add_action(icon_path,
                        text=self.tr(u'UAV Preparer'),
                        callback=self.run,
                        parent=self.iface.mainWindow())

        # will be set False in run()
        self.first_start = True

    def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        for action in self.actions:
            self.iface.removePluginMenu(self.tr(u'&UAV Preparer'), action)
            self.iface.removeToolBarIcon(action)

    def run(self):
        """Run method that performs all the real work"""
        # Create the dialog with elements (after translation) and keep reference
        # Only create GUI ONCE in callback, so that it will only load when the plugin is started
        if self.first_start == True:
            self.first_start = False
            self.dlg = UAVPreparerDialog()

        # Access the raster layer
        self.layerComboManagerDSM = QgsMapLayerComboBox(self.dlg.widgetDSM)
        self.layerComboManagerDSM.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.layerComboManagerDSM.setFixedWidth(175)
        self.layerComboManagerDSM.setCurrentIndex(-1)

        # Access the vector layer and an attribute field
        self.layerComboManagerPoint = QgsMapLayerComboBox(
            self.dlg.widgetPointLayer)
        self.layerComboManagerPoint.setCurrentIndex(-1)
        self.layerComboManagerPoint.setFilters(
            QgsMapLayerProxyModel.PointLayer)
        self.layerComboManagerPoint.setFixedWidth(175)
        self.layerComboManagerPointField = QgsFieldComboBox(
            self.dlg.widgetField)
        self.layerComboManagerPointField.setFilters(QgsFieldProxyModel.Numeric)
        self.layerComboManagerPoint.layerChanged.connect(
            self.layerComboManagerPointField.setLayer)

        # Set up of file save dialog
        self.fileDialog = QFileDialog()
        self.dlg.pushButtonSave.clicked.connect(self.savefile)

        # Set up for the Help button
        self.dlg.helpButton.clicked.connect(self.help)

        # Set up for the Run button
        self.dlg.runButton.clicked.connect(self.start_progress)

        # show the dialog
        self.dlg.show()
        # Run the dialog event loop
        result = self.dlg.exec_()
        # See if OK was pressed
        if result:
            # Do something useful here - delete the line containing pass and
            # substitute with your code.
            pass

    def savefile(self):
        self.outputfile = self.fileDialog.getSaveFileName(
            None, "Save File As:", None, "Text Files (*.txt)")
        self.dlg.textOutput.setText(self.outputfile[0])

    def help(self):
        url = "https://github.com/biglimp/UAVPreparer"
        webbrowser.open_new_tab(url)

    def start_progress(self):
        if not self.outputfile:
            QMessageBox.critical(None, "Error", "Specify an output file")
            return

        # Acquiring geodata and attributes
        dsm_layer = self.layerComboManagerDSM.currentLayer()
        if dsm_layer is None:
            QMessageBox.critical(None, "Error",
                                 "No valid raster layer is selected")
            return
        else:
            provider = dsm_layer.dataProvider()
            filepath_dsm = str(provider.dataSourceUri())

        point_layer = self.layerComboManagerPoint.currentLayer()
        if point_layer is None:
            QMessageBox.critical(None, "Error",
                                 "No valid vector point layer is selected")
            return
        else:
            vlayer = QgsVectorLayer(point_layer.source(), "polygon", "ogr")

        point_field = self.layerComboManagerPointField.currentField()
        idx = vlayer.fields().indexFromName(point_field)
        if idx == -1:
            QMessageBox.critical(
                None, "Error",
                "An attribute with unique fields must be selected")
            return

        ### main code ###

        #  set radius
        r = 100  # half picture size

        numfeat = vlayer.featureCount()
        result = np.zeros([numfeat, 4])

        # load big raster
        bigraster = gdal.Open(filepath_dsm)
        filepath_tempdsm = self.plugin_dir + '/clipdsm.tif'

        self.dlg.progressBar.setRange(0, numfeat)
        i = 0
        for f in vlayer.getFeatures():
            self.dlg.progressBar.setValue(i + 1)
            # get the coordinate for the point
            y = f.geometry().centroid().asPoint().y()
            x = f.geometry().centroid().asPoint().x()

            bbox = (x - r, y + r, x + r, y - r)
            gdal.Translate(filepath_tempdsm, bigraster, projWin=bbox)
            data = gdal.Open(filepath_tempdsm)
            mat = np.array(data.ReadAsArray())

            result[i, 0] = int(f.attributes()[idx])
            result[i, 1] = np.mean(mat)
            result[i, 2] = np.max(mat)
            result[i, 3] = np.min(mat)

            i = i + 1

        # Saving to file
        numformat = '%d ' + '%6.2f ' * 3
        headertext = 'id mean max min'
        np.savetxt(self.outputfile[0],
                   result,
                   fmt=numformat,
                   delimiter=' ',
                   header=headertext)

        self.iface.messageBar().pushMessage(
            'UAV Preparer. Operation successful!',
            level=Qgis.Success,
            duration=5)
コード例 #23
0
class UAVPreparer:
    """QGIS Plugin Implementation."""

    def __init__(self, iface):
        """Constructor.

        :param iface: An interface instance that will be passed to this class
            which provides the hook by which you can manipulate the QGIS
            application at run time.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'UAVPreparer_{}.qm'.format(locale))

        if os.path.exists(locale_path):
            self.translator = QTranslator()
            self.translator.load(locale_path)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)


        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&UAV Preparer')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'UAVPreparer')
        self.toolbar.setObjectName(u'UAVPreparer')

        # Declare variables
        self.outputfile = None

    # noinspection PyMethodMayBeStatic
    def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('UAVPreparer', message)


    def add_action(
        self,
        icon_path,
        text,
        callback,
        enabled_flag=True,
        add_to_menu=True,
        add_to_toolbar=True,
        status_tip=None,
        whats_this=None,
        parent=None):
        """Add a toolbar icon to the toolbar.

        :param icon_path: Path to the icon for this action. Can be a resource
            path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
        :type icon_path: str

        :param text: Text that should be shown in menu items for this action.
        :type text: str

        :param callback: Function to be called when the action is triggered.
        :type callback: function

        :param enabled_flag: A flag indicating if the action should be enabled
            by default. Defaults to True.
        :type enabled_flag: bool

        :param add_to_menu: Flag indicating whether the action should also
            be added to the menu. Defaults to True.
        :type add_to_menu: bool

        :param add_to_toolbar: Flag indicating whether the action should also
            be added to the toolbar. Defaults to True.
        :type add_to_toolbar: bool

        :param status_tip: Optional text to show in a popup when mouse pointer
            hovers over the action.
        :type status_tip: str

        :param parent: Parent widget for the new action. Defaults None.
        :type parent: QWidget

        :param whats_this: Optional text to show in the status bar when the
            mouse pointer hovers over the action.

        :returns: The action that was created. Note that the action is also
            added to self.actions list.
        :rtype: QAction
        """

        # Create the dialog (after translation) and keep reference
        self.dlg = UAVPreparerDialog()

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(
                self.menu,
                action)

        self.actions.append(action)

        return action

    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        icon_path = ':/plugins/UAVPreparer/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(self.tr(u'Unmanned Aerial Vehicle Preparer')),
            callback=self.run,
            parent=self.iface.mainWindow())

        # Access the raster layer
        self.layerComboManagerDSM = QgsMapLayerComboBox(self.dlg.widgetDSM)
        self.layerComboManagerDSM.setFilters(QgsMapLayerProxyModel.RasterLayer)
        self.layerComboManagerDSM.setFixedWidth(175)
        self.layerComboManagerDSM.setCurrentIndex(-1)

        # Access the vector layer and an attribute field
        self.layerComboManagerPoint = QgsMapLayerComboBox(self.dlg.widgetPoint)
        self.layerComboManagerPoint.setCurrentIndex(-1)
        self.layerComboManagerPoint.setFilters(QgsMapLayerProxyModel.PointLayer)
        self.layerComboManagerPoint.setFixedWidth(175)
        self.layerComboManagerPointField = QgsFieldComboBox(self.dlg.widgetField)
        self.layerComboManagerPointField.setFilters(QgsFieldProxyModel.Numeric)
        self.layerComboManagerPoint.layerChanged.connect(self.layerComboManagerPointField.setLayer)

        # Set up of file save dialog
        self.fileDialog = QFileDialog()
        self.dlg.selectButton.clicked.connect(self.savefile)

        # Set up for the Help button
        self.dlg.helpButton.clicked.connect(self.help)

        # Set up for the Run button
        self.dlg.runButton.clicked.connect(self.start_progress)

    def unload(self):
        """Removes the plugin menu item and icon from QGIS GUI."""
        for action in self.actions:
            self.iface.removePluginMenu(
                self.tr(u'&UAV Preparer'),
                action)
            self.iface.removeToolBarIcon(action)
        # remove the toolbar
        del self.toolbar


    def run(self):
        """Run method that performs all the real work"""
        # show the dialog
        self.dlg.show()
        # Run the dialog event loop
        result = self.dlg.exec_()
        # See if OK was pressed
        if result:
            # Do something useful here - delete the line containing pass and
            # substitute with your code.
            pass

    def savefile(self):
        self.outputfile = self.fileDialog.getSaveFileName(None, "Save File As:", None, "Text Files (*.txt)")
        self.dlg.textOutput.setText(self.outputfile)

    def help(self):
        url = "https://github.com/nilswallenberg/UAVPreparer"
        webbrowser.open_new_tab(url)

    def start_progress(self):

        if not self.outputfile:
            QMessageBox.critical(None, "Error", "Specify an output file")
            return

        # Acquiring geodata and attributes
        dsm_layer = self.layerComboManagerDSM.currentLayer()
        if dsm_layer is None:
            QMessageBox.critical(None, "Error", "No valid raster layer is selected")
            return
        else:
            provider = dsm_layer.dataProvider()
            filepath_dsm = str(provider.dataSourceUri())

        point_layer = self.layerComboManagerPoint.currentLayer()
        if point_layer is None:
            QMessageBox.critical(None, "Error", "No valid vector point layer is selected")
            return
        else:
            vlayer = QgsVectorLayer(point_layer.source(), "point", "ogr")

        point_field = self.layerComboManagerPointField.currentField()
        idx = vlayer.fieldNameIndex(point_field)
        if idx == -1:
            QMessageBox.critical(None, "Error", "An attribute with unique fields must be selected")
            return


        ### main code ###

        # set radius
        rSquare = int(self.dlg.spinBox.value()) # half picture size

        # finding ID column
        idx = vlayer.fieldNameIndex(point_field)

        numfeat = vlayer.featureCount()
        result = np.zeros([numfeat, 4])

        self.dlg.progressBar.setRange(0, numfeat)
        counter = 0
        for feature in vlayer.getFeatures():
            self.dlg.progressBar.setValue (counter + 1)
            geom = feature.geometry()
            pp = geom.asPoint()
            x = pp[0]
            y = pp[1]
            gdalclipdsm = "gdalwarp -dstnodata -9999 -q -overwrite -te " + str(x - rSquare) + " " + str(y - rSquare) + \
                          " " + str(x + rSquare) + " " + str(y + rSquare) + " -of GTiff " + filepath_dsm + " " + self.plugin_dir + "/clipdsm.tif"

            #QMessageBox.critical(None, "Bla", gdalclipdsm)

            # call the gdal function
            si = subprocess.STARTUPINFO() # used to suppress cmd window
            si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
            subprocess.call(gdalclipdsm, startupinfo=si)
            #subprocess.call(gdalclipdsm)

            dataset = gdal.Open(self.plugin_dir + "/clipdsm.tif")
            dsm_array = dataset.ReadAsArray().astype(np.float)

            result[counter, 0] = int(feature.attributes()[idx])
            result[counter, 1] = np.mean(dsm_array)
            result[counter, 2] = np.max(dsm_array)
            result[counter, 3] = np.min(dsm_array)
            counter += 1

        numformat = "%d " + "%6.2f " * 3
        headertext = "id mean max min"
        np.savetxt(self.outputfile, result, fmt=numformat, header=headertext, comments="", delimiter="/t")

        self.iface.messageBar().pushMessage("UAV Preparer. Operation successful!", level=QgsMessageBar.INFO, duration=5)
コード例 #24
0
    def __init__(self, iface, project):
        QtWidgets.QDialog.__init__(self)
        self.iface = iface
        self.setupUi(self)

        self.NewLinks = False
        self.NewNodes = False
        self.project = project
        if project is not None:
            self.conn = project.conn
            self.path_to_file = project.path_to_file

        self._run_layout = QGridLayout()
        spacer = QSpacerItem(5, 5, QSizePolicy.Expanding, QSizePolicy.Minimum)

        # Centroid layer
        frm1 = QHBoxLayout()
        frm1.addItem(spacer)
        self.CentroidLayer = QgsMapLayerComboBox()
        self.CentroidLayer.layerChanged.connect(self.set_fields)
        clabel = QLabel()
        clabel.setText("Centroids layer")
        frm1.addWidget(clabel)
        frm1.addWidget(self.CentroidLayer)
        self.CentroidLayer.setMinimumSize(450, 30)
        wdgt1 = QWidget()
        wdgt1.setLayout(frm1)

        self.CentroidField = QgsFieldComboBox()
        self.CentroidField.setMinimumSize(450, 30)
        frm2 = QHBoxLayout()
        frm2.addItem(spacer)
        flabel = QLabel()
        flabel.setText("Centroid ID field")
        frm2.addWidget(flabel)
        frm2.addWidget(self.CentroidField)
        wdgt2 = QWidget()
        wdgt2.setLayout(frm2)

        self.CentroidLayer.setFilters(QgsMapLayerProxyModel.PointLayer)

        frm3 = QHBoxLayout()
        self.IfMaxLength = QCheckBox()
        self.IfMaxLength.setChecked(True)
        self.IfMaxLength.setText("Connector maximum length")
        self.IfMaxLength.toggled.connect(self.allows_distance)
        frm3.addWidget(self.IfMaxLength)
        frm3.addItem(spacer)

        self.MaxLength = QLineEdit()
        frm3.addWidget(self.MaxLength)
        frm3.addItem(spacer)

        lblmeters = QLabel()
        lblmeters.setText(" meters")
        frm3.addWidget(lblmeters)
        frm3.addItem(spacer)

        lblnmbr = QLabel()
        lblnmbr.setText("Connectors per centroid")
        frm3.addWidget(lblnmbr)

        self.NumberConnectors = QComboBox()
        for i in range(1, 40):
            self.NumberConnectors.addItem(str(i))
        frm3.addWidget(self.NumberConnectors)

        wdgt3 = QWidget()
        wdgt3.setLayout(frm3)

        layer_frame = QVBoxLayout()
        layer_frame.addWidget(wdgt1)
        layer_frame.addWidget(wdgt2)
        layer_frame.addWidget(wdgt3)
        lyrfrm = QWidget()
        lyrfrm.setLayout(layer_frame)

        # action buttons
        self.but_process = QPushButton()
        if self.project is None:
            self.but_process.setText("Project not loaded")
            self.but_process.setEnabled(False)
        else:
            self.but_process.setText("Run!")
        self.but_process.clicked.connect(self.run)

        self.but_cancel = QPushButton()
        self.but_cancel.setText("Cancel")
        self.but_cancel.clicked.connect(self.exit_procedure)

        self.progressbar = QProgressBar()
        self.progress_label = QLabel()
        self.progress_label.setText("...")

        but_frame = QHBoxLayout()
        but_frame.addWidget(self.progressbar, 1)
        but_frame.addWidget(self.progress_label, 1)
        but_frame.addWidget(self.but_cancel, 1)
        but_frame.addItem(spacer)
        but_frame.addWidget(self.but_process, 1)
        self.but_widget = QWidget()
        self.but_widget.setLayout(but_frame)

        # Progress bars and messagers
        self.progress_frame = QVBoxLayout()
        self.status_bar_files = QProgressBar()
        self.progress_frame.addWidget(self.status_bar_files)

        self.status_label_file = QLabel()
        self.status_label_file.setText("Extracting: ")
        self.progress_frame.addWidget(self.status_label_file)

        self.status_bar_chunks = QProgressBar()
        self.progress_frame.addWidget(self.status_bar_chunks)

        self.progress_widget = QWidget()
        self.progress_widget.setLayout(self.progress_frame)
        self.progress_widget.setVisible(False)

        self._run_layout.addWidget(lyrfrm)
        self._run_layout.addWidget(self.but_widget)
        self._run_layout.addWidget(self.progress_widget)

        list = QWidget()
        listLayout = QVBoxLayout()
        self.list_types = QTableWidget()
        self.list_types.setMinimumSize(180, 80)

        lbl = QLabel()
        lbl.setText("Allowed link types")
        listLayout.addWidget(lbl)
        listLayout.addWidget(self.list_types)
        list.setLayout(listLayout)

        if self.project is not None:
            curr = self.conn.cursor()
            curr.execute(
                "SELECT DISTINCT link_type FROM links ORDER BY link_type")
            ltypes = curr.fetchall()
            self.list_types.setRowCount(len(ltypes))
            self.list_types.setColumnCount(1)
            for i, lt in enumerate(ltypes):
                self.list_types.setItem(i, 0, QTableWidgetItem(lt[0]))
            self.list_types.selectAll()

        allStuff = QWidget()
        allStuff.setLayout(self._run_layout)
        allLayout = QHBoxLayout()
        allLayout.addWidget(allStuff)
        allLayout.addWidget(list)

        self.setLayout(allLayout)
        self.resize(700, 135)

        # default directory
        self.path = standard_path()
        self.set_fields()
        self.IfMaxLength.setChecked(False)
コード例 #25
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(740, 479)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(740, 0))
        MainWindow.setTabShape(QtGui.QTabWidget.Rounded)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.titleGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.titleGroupBox.sizePolicy().hasHeightForWidth())
        self.titleGroupBox.setSizePolicy(sizePolicy)
        self.titleGroupBox.setMinimumSize(QtCore.QSize(360, 140))
        self.titleGroupBox.setMaximumSize(QtCore.QSize(16777215, 140))
        self.titleGroupBox.setTitle(_fromUtf8(""))
        self.titleGroupBox.setObjectName(_fromUtf8("titleGroupBox"))
        self.verticalLayout_5 = QtGui.QVBoxLayout(self.titleGroupBox)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.titleLabel = QtGui.QLabel(self.titleGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.titleLabel.sizePolicy().hasHeightForWidth())
        self.titleLabel.setSizePolicy(sizePolicy)
        self.titleLabel.setMinimumSize(QtCore.QSize(360, 0))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial Black"))
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(False)
        font.setUnderline(False)
        font.setWeight(75)
        font.setStrikeOut(False)
        font.setKerning(True)
        self.titleLabel.setFont(font)
        self.titleLabel.setFrameShadow(QtGui.QFrame.Sunken)
        self.titleLabel.setTextFormat(QtCore.Qt.AutoText)
        self.titleLabel.setIndent(6)
        self.titleLabel.setObjectName(_fromUtf8("titleLabel"))
        self.verticalLayout_5.addWidget(self.titleLabel)
        self.horizontalLayout.addWidget(self.titleGroupBox)
        self.buttonGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.buttonGroupBox.sizePolicy().hasHeightForWidth())
        self.buttonGroupBox.setSizePolicy(sizePolicy)
        self.buttonGroupBox.setMinimumSize(QtCore.QSize(360, 140))
        self.buttonGroupBox.setMaximumSize(QtCore.QSize(360, 140))
        self.buttonGroupBox.setBaseSize(QtCore.QSize(360, 0))
        self.buttonGroupBox.setTitle(_fromUtf8(""))
        self.buttonGroupBox.setObjectName(_fromUtf8("buttonGroupBox"))
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.buttonGroupBox)
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.mBtnZoomIn = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnZoomIn.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("./images/zoomIn.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnZoomIn.setIcon(icon)
        self.mBtnZoomIn.setIconSize(QtCore.QSize(50, 50))
        self.mBtnZoomIn.setObjectName(_fromUtf8("mBtnZoomIn"))
        self.horizontalLayout_3.addWidget(self.mBtnZoomIn)
        self.mBtnZoomOut = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnZoomOut.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8("./images/zomOut.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnZoomOut.setIcon(icon1)
        self.mBtnZoomOut.setIconSize(QtCore.QSize(50, 50))
        self.mBtnZoomOut.setObjectName(_fromUtf8("mBtnZoomOut"))
        self.horizontalLayout_3.addWidget(self.mBtnZoomOut)
        self.mBtnAddRaster = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnAddRaster.setText(_fromUtf8(""))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8("./images/addRaster.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnAddRaster.setIcon(icon2)
        self.mBtnAddRaster.setIconSize(QtCore.QSize(50, 50))
        self.mBtnAddRaster.setObjectName(_fromUtf8("mBtnAddRaster"))
        self.horizontalLayout_3.addWidget(self.mBtnAddRaster)
        self.mBtnAddVector = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnAddVector.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8("./images/addLayer.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnAddVector.setIcon(icon3)
        self.mBtnAddVector.setIconSize(QtCore.QSize(50, 50))
        self.mBtnAddVector.setObjectName(_fromUtf8("mBtnAddVector"))
        self.horizontalLayout_3.addWidget(self.mBtnAddVector)
        self.mBtnSelection = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnSelection.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(_fromUtf8("./images/select.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnSelection.setIcon(icon4)
        self.mBtnSelection.setIconSize(QtCore.QSize(50, 50))
        self.mBtnSelection.setObjectName(_fromUtf8("mBtnSelection"))
        self.horizontalLayout_3.addWidget(self.mBtnSelection)
        self.mBtnZoomIn.raise_()
        self.mBtnZoomOut.raise_()
        self.mBtnAddRaster.raise_()
        self.mBtnAddVector.raise_()
        self.mBtnSelection.raise_()
        self.titleGroupBox.raise_()
        self.horizontalLayout.addWidget(self.buttonGroupBox)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.canvasGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
                                       QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.canvasGroupBox.sizePolicy().hasHeightForWidth())
        self.canvasGroupBox.setSizePolicy(sizePolicy)
        self.canvasGroupBox.setMinimumSize(QtCore.QSize(0, 0))
        self.canvasGroupBox.setTitle(_fromUtf8(""))
        self.canvasGroupBox.setObjectName(_fromUtf8("canvasGroupBox"))
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.canvasGroupBox)
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.canvasFrame = QtGui.QFrame(self.canvasGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.canvasFrame.sizePolicy().hasHeightForWidth())
        self.canvasFrame.setSizePolicy(sizePolicy)
        self.canvasFrame.setMinimumSize(QtCore.QSize(0, 0))
        self.canvasFrame.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.canvasFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.canvasFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.canvasFrame.setObjectName(_fromUtf8("canvasFrame"))
        self.verticalLayout_4.addWidget(self.canvasFrame)
        self.horizontalLayout_2.addWidget(self.canvasGroupBox)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.dropDownGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dropDownGroupBox.sizePolicy().hasHeightForWidth())
        self.dropDownGroupBox.setSizePolicy(sizePolicy)
        self.dropDownGroupBox.setMinimumSize(QtCore.QSize(100, 60))
        self.dropDownGroupBox.setObjectName(_fromUtf8("dropDownGroupBox"))
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.dropDownGroupBox)
        self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
        self.mFieldComboBox = QgsFieldComboBox(self.dropDownGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mFieldComboBox.sizePolicy().hasHeightForWidth())
        self.mFieldComboBox.setSizePolicy(sizePolicy)
        self.mFieldComboBox.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.mFieldComboBox.setMaxVisibleItems(25)
        self.mFieldComboBox.setObjectName(_fromUtf8("mFieldComboBox"))
        self.verticalLayout_6.addWidget(self.mFieldComboBox)
        self.verticalLayout_6.setAlignment(QtCore.Qt.AlignTop)
        self.mFieldComboBox.raise_()
        self.verticalLayout_2.addWidget(self.dropDownGroupBox,
                                        QtCore.Qt.AlignTop)
        self.legendGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.legendGroupBox.sizePolicy().hasHeightForWidth())
        self.legendGroupBox.setSizePolicy(sizePolicy)
        self.legendGroupBox.setMinimumSize(QtCore.QSize(100, 200))
        self.legendGroupBox.setAutoFillBackground(False)
        self.legendGroupBox.setFlat(False)
        self.legendGroupBox.setCheckable(False)
        self.legendGroupBox.setObjectName(_fromUtf8("legendGroupBox"))
        self.gridLayout = QtGui.QGridLayout(self.legendGroupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.colorBox_1 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_1.sizePolicy().hasHeightForWidth())
        self.colorBox_1.setSizePolicy(sizePolicy)
        self.colorBox_1.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_1.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_1.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_1.setAutoFillBackground(False)
        self.colorBox_1.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 0, 0);"))
        self.colorBox_1.setObjectName(_fromUtf8("colorBox_1"))
        self.gridLayout.addWidget(self.colorBox_1, 0, 0, 1, 1)
        self.legendHorizontalLayout_6 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_6.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_6.setContentsMargins(8, -1, 0, -1)
        self.legendHorizontalLayout_6.setSpacing(6)
        self.legendHorizontalLayout_6.setObjectName(
            _fromUtf8("legendHorizontalLayout_6"))
        self.label_11 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_11.sizePolicy().hasHeightForWidth())
        self.label_11.setSizePolicy(sizePolicy)
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.legendHorizontalLayout_6.addWidget(self.label_11)
        self.dashLabel_6 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_6.sizePolicy().hasHeightForWidth())
        self.dashLabel_6.setSizePolicy(sizePolicy)
        self.dashLabel_6.setObjectName(_fromUtf8("dashLabel_6"))
        self.legendHorizontalLayout_6.addWidget(self.dashLabel_6)
        self.label_13 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_13.sizePolicy().hasHeightForWidth())
        self.label_13.setSizePolicy(sizePolicy)
        self.label_13.setObjectName(_fromUtf8("label_13"))
        self.legendHorizontalLayout_6.addWidget(self.label_13)
        self.gridLayout.addLayout(self.legendHorizontalLayout_6, 0, 1, 1, 1)
        self.colorBox_2 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_2.sizePolicy().hasHeightForWidth())
        self.colorBox_2.setSizePolicy(sizePolicy)
        self.colorBox_2.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_2.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_2.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_2.setAutoFillBackground(False)
        self.colorBox_2.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 95, 0);"))
        self.colorBox_2.setObjectName(_fromUtf8("colorBox_2"))
        self.gridLayout.addWidget(self.colorBox_2, 1, 0, 1, 1)
        self.legendHorizontalLayout_5 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_5.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_5.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_5.setSpacing(6)
        self.legendHorizontalLayout_5.setObjectName(
            _fromUtf8("legendHorizontalLayout_5"))
        self.label_10 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_10.sizePolicy().hasHeightForWidth())
        self.label_10.setSizePolicy(sizePolicy)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.legendHorizontalLayout_5.addWidget(self.label_10)
        self.dashLabel_5 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_5.sizePolicy().hasHeightForWidth())
        self.dashLabel_5.setSizePolicy(sizePolicy)
        self.dashLabel_5.setObjectName(_fromUtf8("dashLabel_5"))
        self.legendHorizontalLayout_5.addWidget(self.dashLabel_5)
        self.label_12 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_12.sizePolicy().hasHeightForWidth())
        self.label_12.setSizePolicy(sizePolicy)
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.legendHorizontalLayout_5.addWidget(self.label_12)
        self.gridLayout.addLayout(self.legendHorizontalLayout_5, 1, 1, 1, 1)
        self.colorBox_3 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_3.sizePolicy().hasHeightForWidth())
        self.colorBox_3.setSizePolicy(sizePolicy)
        self.colorBox_3.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_3.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_3.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_3.setAutoFillBackground(False)
        self.colorBox_3.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 135, 0);"))
        self.colorBox_3.setObjectName(_fromUtf8("colorBox_3"))
        self.gridLayout.addWidget(self.colorBox_3, 2, 0, 1, 1)
        self.legendHorizontalLayout_4 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_4.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_4.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_4.setSpacing(6)
        self.legendHorizontalLayout_4.setObjectName(
            _fromUtf8("legendHorizontalLayout_4"))
        self.label_7 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_7.sizePolicy().hasHeightForWidth())
        self.label_7.setSizePolicy(sizePolicy)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.legendHorizontalLayout_4.addWidget(self.label_7)
        self.dashLabel_4 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_4.sizePolicy().hasHeightForWidth())
        self.dashLabel_4.setSizePolicy(sizePolicy)
        self.dashLabel_4.setObjectName(_fromUtf8("dashLabel_4"))
        self.legendHorizontalLayout_4.addWidget(self.dashLabel_4)
        self.label_8 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_8.sizePolicy().hasHeightForWidth())
        self.label_8.setSizePolicy(sizePolicy)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.legendHorizontalLayout_4.addWidget(self.label_8)
        self.gridLayout.addLayout(self.legendHorizontalLayout_4, 2, 1, 1, 1)
        self.colorBox_4 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_4.sizePolicy().hasHeightForWidth())
        self.colorBox_4.setSizePolicy(sizePolicy)
        self.colorBox_4.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_4.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_4.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_4.setAutoFillBackground(False)
        self.colorBox_4.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 175, 0);"))
        self.colorBox_4.setObjectName(_fromUtf8("colorBox_4"))
        self.gridLayout.addWidget(self.colorBox_4, 3, 0, 1, 1)
        self.legendHorizontalLayout_3 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_3.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_3.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_3.setSpacing(6)
        self.legendHorizontalLayout_3.setObjectName(
            _fromUtf8("legendHorizontalLayout_3"))
        self.label_5 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_5.sizePolicy().hasHeightForWidth())
        self.label_5.setSizePolicy(sizePolicy)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.legendHorizontalLayout_3.addWidget(self.label_5)
        self.dashLabel_3 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_3.sizePolicy().hasHeightForWidth())
        self.dashLabel_3.setSizePolicy(sizePolicy)
        self.dashLabel_3.setObjectName(_fromUtf8("dashLabel_3"))
        self.legendHorizontalLayout_3.addWidget(self.dashLabel_3)
        self.label_6 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_6.sizePolicy().hasHeightForWidth())
        self.label_6.setSizePolicy(sizePolicy)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.legendHorizontalLayout_3.addWidget(self.label_6)
        self.gridLayout.addLayout(self.legendHorizontalLayout_3, 3, 1, 1, 1)
        self.colorBox_5 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_5.sizePolicy().hasHeightForWidth())
        self.colorBox_5.setSizePolicy(sizePolicy)
        self.colorBox_5.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_5.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_5.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_5.setAutoFillBackground(False)
        self.colorBox_5.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 215, 0);"))
        self.colorBox_5.setObjectName(_fromUtf8("colorBox_5"))
        self.gridLayout.addWidget(self.colorBox_5, 4, 0, 1, 1)
        self.legendHorizontalLayout_2 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_2.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_2.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_2.setSpacing(6)
        self.legendHorizontalLayout_2.setObjectName(
            _fromUtf8("legendHorizontalLayout_2"))
        self.label_3 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_3.sizePolicy().hasHeightForWidth())
        self.label_3.setSizePolicy(sizePolicy)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.legendHorizontalLayout_2.addWidget(self.label_3)
        self.dashLabel_2 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_2.sizePolicy().hasHeightForWidth())
        self.dashLabel_2.setSizePolicy(sizePolicy)
        self.dashLabel_2.setObjectName(_fromUtf8("dashLabel_2"))
        self.legendHorizontalLayout_2.addWidget(self.dashLabel_2)
        self.label_4 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_4.sizePolicy().hasHeightForWidth())
        self.label_4.setSizePolicy(sizePolicy)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.legendHorizontalLayout_2.addWidget(self.label_4)
        self.gridLayout.addLayout(self.legendHorizontalLayout_2, 4, 1, 1, 1)
        self.colorBox_6 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_6.sizePolicy().hasHeightForWidth())
        self.colorBox_6.setSizePolicy(sizePolicy)
        self.colorBox_6.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_6.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_6.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_6.setAutoFillBackground(False)
        self.colorBox_6.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 255, 0);"))
        self.colorBox_6.setObjectName(_fromUtf8("colorBox_6"))
        self.gridLayout.addWidget(self.colorBox_6, 5, 0, 1, 1)
        self.legendHorizontalLayout_1 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_1.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_1.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_1.setSpacing(6)
        self.legendHorizontalLayout_1.setObjectName(
            _fromUtf8("legendHorizontalLayout_1"))
        self.label_1 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_1.sizePolicy().hasHeightForWidth())
        self.label_1.setSizePolicy(sizePolicy)
        self.label_1.setObjectName(_fromUtf8("label_1"))
        self.legendHorizontalLayout_1.addWidget(self.label_1)
        self.dashLabel_1 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_1.sizePolicy().hasHeightForWidth())
        self.dashLabel_1.setSizePolicy(sizePolicy)
        self.dashLabel_1.setObjectName(_fromUtf8("dashLabel_1"))
        self.legendHorizontalLayout_1.addWidget(self.dashLabel_1)
        self.label_2 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.legendHorizontalLayout_1.addWidget(self.label_2)
        self.gridLayout.addLayout(self.legendHorizontalLayout_1, 5, 1, 1, 1)
        self.verticalLayout_2.addWidget(self.legendGroupBox)
        self.horizontalLayout_2.addLayout(self.verticalLayout_2)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_3.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 740, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName(_fromUtf8("menuFile"))
        self.menuMap_View = QtGui.QMenu(self.menubar)
        self.menuMap_View.setObjectName(_fromUtf8("menuMap_View"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuMap_View.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(
            _translate("MainWindow", "Gis Viewer Application", None))
        self.titleLabel.setText(
            _translate(
                "MainWindow",
                "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'Arial Black\'; font-size:14pt; font-weight:600; font-style:normal;\">\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:18pt; color:#0055ff;\">Land Development Model</span></p></body></html>",
                None))
        self.dropDownGroupBox.setTitle(
            _translate("MainWindow", "Model Results", None))
        self.legendGroupBox.setTitle(_translate("MainWindow", "Legend", None))
        self.label_11.setText(_translate("MainWindow", "0", None))
        self.dashLabel_6.setText(_translate("MainWindow", "-", None))
        self.label_13.setText(_translate("MainWindow", "0", None))
        self.label_10.setText(_translate("MainWindow", "0", None))
        self.dashLabel_5.setText(_translate("MainWindow", "-", None))
        self.label_12.setText(_translate("MainWindow", "0", None))
        self.label_7.setText(_translate("MainWindow", "0", None))
        self.dashLabel_4.setText(_translate("MainWindow", "-", None))
        self.label_8.setText(_translate("MainWindow", "0", None))
        self.label_5.setText(_translate("MainWindow", "0", None))
        self.dashLabel_3.setText(_translate("MainWindow", "-", None))
        self.label_6.setText(_translate("MainWindow", "0", None))
        self.label_3.setText(_translate("MainWindow", "0", None))
        self.dashLabel_2.setText(_translate("MainWindow", "-", None))
        self.label_4.setText(_translate("MainWindow", "0", None))
        self.label_1.setText(_translate("MainWindow", "0", None))
        self.dashLabel_1.setText(_translate("MainWindow", "-", None))
        self.label_2.setText(_translate("MainWindow", "0", None))
        self.menuFile.setTitle(_translate("MainWindow", "File", None))
        self.menuMap_View.setTitle(_translate("MainWindow", "Map View", None))
コード例 #26
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(740, 479)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(740, 0))
        MainWindow.setTabShape(QtGui.QTabWidget.Rounded)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.centralwidget)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.titleGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.titleGroupBox.sizePolicy().hasHeightForWidth())
        self.titleGroupBox.setSizePolicy(sizePolicy)
        self.titleGroupBox.setMinimumSize(QtCore.QSize(360, 140))
        self.titleGroupBox.setMaximumSize(QtCore.QSize(16777215, 140))
        self.titleGroupBox.setTitle(_fromUtf8(""))
        self.titleGroupBox.setObjectName(_fromUtf8("titleGroupBox"))
        self.verticalLayout_5 = QtGui.QVBoxLayout(self.titleGroupBox)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.titleLabel = QtGui.QLabel(self.titleGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.titleLabel.sizePolicy().hasHeightForWidth())
        self.titleLabel.setSizePolicy(sizePolicy)
        self.titleLabel.setMinimumSize(QtCore.QSize(360, 0))
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Arial Black"))
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(False)
        font.setUnderline(False)
        font.setWeight(75)
        font.setStrikeOut(False)
        font.setKerning(True)
        self.titleLabel.setFont(font)
        self.titleLabel.setFrameShadow(QtGui.QFrame.Sunken)
        self.titleLabel.setTextFormat(QtCore.Qt.AutoText)
        self.titleLabel.setIndent(6)
        self.titleLabel.setObjectName(_fromUtf8("titleLabel"))
        self.verticalLayout_5.addWidget(self.titleLabel)
        self.horizontalLayout.addWidget(self.titleGroupBox)
        self.buttonGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.buttonGroupBox.sizePolicy().hasHeightForWidth())
        self.buttonGroupBox.setSizePolicy(sizePolicy)
        self.buttonGroupBox.setMinimumSize(QtCore.QSize(360, 140))
        self.buttonGroupBox.setMaximumSize(QtCore.QSize(360, 140))
        self.buttonGroupBox.setBaseSize(QtCore.QSize(360, 0))
        self.buttonGroupBox.setTitle(_fromUtf8(""))
        self.buttonGroupBox.setObjectName(_fromUtf8("buttonGroupBox"))
        self.horizontalLayout_3 = QtGui.QHBoxLayout(self.buttonGroupBox)
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.mBtnZoomIn = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnZoomIn.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("./images/zoomIn.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnZoomIn.setIcon(icon)
        self.mBtnZoomIn.setIconSize(QtCore.QSize(50, 50))
        self.mBtnZoomIn.setObjectName(_fromUtf8("mBtnZoomIn"))
        self.horizontalLayout_3.addWidget(self.mBtnZoomIn)
        self.mBtnZoomOut = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnZoomOut.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8("./images/zomOut.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnZoomOut.setIcon(icon1)
        self.mBtnZoomOut.setIconSize(QtCore.QSize(50, 50))
        self.mBtnZoomOut.setObjectName(_fromUtf8("mBtnZoomOut"))
        self.horizontalLayout_3.addWidget(self.mBtnZoomOut)
        self.mBtnAddRaster = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnAddRaster.setText(_fromUtf8(""))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8("./images/addRaster.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnAddRaster.setIcon(icon2)
        self.mBtnAddRaster.setIconSize(QtCore.QSize(50, 50))
        self.mBtnAddRaster.setObjectName(_fromUtf8("mBtnAddRaster"))
        self.horizontalLayout_3.addWidget(self.mBtnAddRaster)
        self.mBtnAddVector = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnAddVector.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8("./images/addLayer.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnAddVector.setIcon(icon3)
        self.mBtnAddVector.setIconSize(QtCore.QSize(50, 50))
        self.mBtnAddVector.setObjectName(_fromUtf8("mBtnAddVector"))
        self.horizontalLayout_3.addWidget(self.mBtnAddVector)
        self.mBtnSelection = QtGui.QPushButton(self.buttonGroupBox)
        self.mBtnSelection.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(_fromUtf8("./images/select.png")),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mBtnSelection.setIcon(icon4)
        self.mBtnSelection.setIconSize(QtCore.QSize(50, 50))
        self.mBtnSelection.setObjectName(_fromUtf8("mBtnSelection"))
        self.horizontalLayout_3.addWidget(self.mBtnSelection)
        self.mBtnZoomIn.raise_()
        self.mBtnZoomOut.raise_()
        self.mBtnAddRaster.raise_()
        self.mBtnAddVector.raise_()
        self.mBtnSelection.raise_()
        self.titleGroupBox.raise_()
        self.horizontalLayout.addWidget(self.buttonGroupBox)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.canvasGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
                                       QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.canvasGroupBox.sizePolicy().hasHeightForWidth())
        self.canvasGroupBox.setSizePolicy(sizePolicy)
        self.canvasGroupBox.setMinimumSize(QtCore.QSize(0, 0))
        self.canvasGroupBox.setTitle(_fromUtf8(""))
        self.canvasGroupBox.setObjectName(_fromUtf8("canvasGroupBox"))
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.canvasGroupBox)
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.canvasFrame = QtGui.QFrame(self.canvasGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.canvasFrame.sizePolicy().hasHeightForWidth())
        self.canvasFrame.setSizePolicy(sizePolicy)
        self.canvasFrame.setMinimumSize(QtCore.QSize(0, 0))
        self.canvasFrame.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.canvasFrame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.canvasFrame.setFrameShadow(QtGui.QFrame.Raised)
        self.canvasFrame.setObjectName(_fromUtf8("canvasFrame"))
        self.verticalLayout_4.addWidget(self.canvasFrame)
        self.horizontalLayout_2.addWidget(self.canvasGroupBox)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.dropDownGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dropDownGroupBox.sizePolicy().hasHeightForWidth())
        self.dropDownGroupBox.setSizePolicy(sizePolicy)
        self.dropDownGroupBox.setMinimumSize(QtCore.QSize(100, 60))
        self.dropDownGroupBox.setObjectName(_fromUtf8("dropDownGroupBox"))
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.dropDownGroupBox)
        self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
        self.mFieldComboBox = QgsFieldComboBox(self.dropDownGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mFieldComboBox.sizePolicy().hasHeightForWidth())
        self.mFieldComboBox.setSizePolicy(sizePolicy)
        self.mFieldComboBox.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.mFieldComboBox.setMaxVisibleItems(25)
        self.mFieldComboBox.setObjectName(_fromUtf8("mFieldComboBox"))
        self.verticalLayout_6.addWidget(self.mFieldComboBox)
        self.verticalLayout_6.setAlignment(QtCore.Qt.AlignTop)
        self.mFieldComboBox.raise_()
        self.verticalLayout_2.addWidget(self.dropDownGroupBox,
                                        QtCore.Qt.AlignTop)
        self.legendGroupBox = QtGui.QGroupBox(self.centralwidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.legendGroupBox.sizePolicy().hasHeightForWidth())
        self.legendGroupBox.setSizePolicy(sizePolicy)
        self.legendGroupBox.setMinimumSize(QtCore.QSize(100, 200))
        self.legendGroupBox.setAutoFillBackground(False)
        self.legendGroupBox.setFlat(False)
        self.legendGroupBox.setCheckable(False)
        self.legendGroupBox.setObjectName(_fromUtf8("legendGroupBox"))
        self.gridLayout = QtGui.QGridLayout(self.legendGroupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.colorBox_1 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_1.sizePolicy().hasHeightForWidth())
        self.colorBox_1.setSizePolicy(sizePolicy)
        self.colorBox_1.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_1.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_1.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_1.setAutoFillBackground(False)
        self.colorBox_1.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 0, 0);"))
        self.colorBox_1.setObjectName(_fromUtf8("colorBox_1"))
        self.gridLayout.addWidget(self.colorBox_1, 0, 0, 1, 1)
        self.legendHorizontalLayout_6 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_6.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_6.setContentsMargins(8, -1, 0, -1)
        self.legendHorizontalLayout_6.setSpacing(6)
        self.legendHorizontalLayout_6.setObjectName(
            _fromUtf8("legendHorizontalLayout_6"))
        self.label_11 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_11.sizePolicy().hasHeightForWidth())
        self.label_11.setSizePolicy(sizePolicy)
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.legendHorizontalLayout_6.addWidget(self.label_11)
        self.dashLabel_6 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_6.sizePolicy().hasHeightForWidth())
        self.dashLabel_6.setSizePolicy(sizePolicy)
        self.dashLabel_6.setObjectName(_fromUtf8("dashLabel_6"))
        self.legendHorizontalLayout_6.addWidget(self.dashLabel_6)
        self.label_13 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_13.sizePolicy().hasHeightForWidth())
        self.label_13.setSizePolicy(sizePolicy)
        self.label_13.setObjectName(_fromUtf8("label_13"))
        self.legendHorizontalLayout_6.addWidget(self.label_13)
        self.gridLayout.addLayout(self.legendHorizontalLayout_6, 0, 1, 1, 1)
        self.colorBox_2 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_2.sizePolicy().hasHeightForWidth())
        self.colorBox_2.setSizePolicy(sizePolicy)
        self.colorBox_2.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_2.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_2.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_2.setAutoFillBackground(False)
        self.colorBox_2.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 95, 0);"))
        self.colorBox_2.setObjectName(_fromUtf8("colorBox_2"))
        self.gridLayout.addWidget(self.colorBox_2, 1, 0, 1, 1)
        self.legendHorizontalLayout_5 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_5.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_5.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_5.setSpacing(6)
        self.legendHorizontalLayout_5.setObjectName(
            _fromUtf8("legendHorizontalLayout_5"))
        self.label_10 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_10.sizePolicy().hasHeightForWidth())
        self.label_10.setSizePolicy(sizePolicy)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.legendHorizontalLayout_5.addWidget(self.label_10)
        self.dashLabel_5 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_5.sizePolicy().hasHeightForWidth())
        self.dashLabel_5.setSizePolicy(sizePolicy)
        self.dashLabel_5.setObjectName(_fromUtf8("dashLabel_5"))
        self.legendHorizontalLayout_5.addWidget(self.dashLabel_5)
        self.label_12 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_12.sizePolicy().hasHeightForWidth())
        self.label_12.setSizePolicy(sizePolicy)
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.legendHorizontalLayout_5.addWidget(self.label_12)
        self.gridLayout.addLayout(self.legendHorizontalLayout_5, 1, 1, 1, 1)
        self.colorBox_3 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_3.sizePolicy().hasHeightForWidth())
        self.colorBox_3.setSizePolicy(sizePolicy)
        self.colorBox_3.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_3.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_3.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_3.setAutoFillBackground(False)
        self.colorBox_3.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 135, 0);"))
        self.colorBox_3.setObjectName(_fromUtf8("colorBox_3"))
        self.gridLayout.addWidget(self.colorBox_3, 2, 0, 1, 1)
        self.legendHorizontalLayout_4 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_4.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_4.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_4.setSpacing(6)
        self.legendHorizontalLayout_4.setObjectName(
            _fromUtf8("legendHorizontalLayout_4"))
        self.label_7 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_7.sizePolicy().hasHeightForWidth())
        self.label_7.setSizePolicy(sizePolicy)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.legendHorizontalLayout_4.addWidget(self.label_7)
        self.dashLabel_4 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_4.sizePolicy().hasHeightForWidth())
        self.dashLabel_4.setSizePolicy(sizePolicy)
        self.dashLabel_4.setObjectName(_fromUtf8("dashLabel_4"))
        self.legendHorizontalLayout_4.addWidget(self.dashLabel_4)
        self.label_8 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_8.sizePolicy().hasHeightForWidth())
        self.label_8.setSizePolicy(sizePolicy)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.legendHorizontalLayout_4.addWidget(self.label_8)
        self.gridLayout.addLayout(self.legendHorizontalLayout_4, 2, 1, 1, 1)
        self.colorBox_4 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_4.sizePolicy().hasHeightForWidth())
        self.colorBox_4.setSizePolicy(sizePolicy)
        self.colorBox_4.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_4.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_4.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_4.setAutoFillBackground(False)
        self.colorBox_4.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 175, 0);"))
        self.colorBox_4.setObjectName(_fromUtf8("colorBox_4"))
        self.gridLayout.addWidget(self.colorBox_4, 3, 0, 1, 1)
        self.legendHorizontalLayout_3 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_3.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_3.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_3.setSpacing(6)
        self.legendHorizontalLayout_3.setObjectName(
            _fromUtf8("legendHorizontalLayout_3"))
        self.label_5 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_5.sizePolicy().hasHeightForWidth())
        self.label_5.setSizePolicy(sizePolicy)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.legendHorizontalLayout_3.addWidget(self.label_5)
        self.dashLabel_3 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_3.sizePolicy().hasHeightForWidth())
        self.dashLabel_3.setSizePolicy(sizePolicy)
        self.dashLabel_3.setObjectName(_fromUtf8("dashLabel_3"))
        self.legendHorizontalLayout_3.addWidget(self.dashLabel_3)
        self.label_6 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_6.sizePolicy().hasHeightForWidth())
        self.label_6.setSizePolicy(sizePolicy)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.legendHorizontalLayout_3.addWidget(self.label_6)
        self.gridLayout.addLayout(self.legendHorizontalLayout_3, 3, 1, 1, 1)
        self.colorBox_5 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_5.sizePolicy().hasHeightForWidth())
        self.colorBox_5.setSizePolicy(sizePolicy)
        self.colorBox_5.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_5.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_5.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_5.setAutoFillBackground(False)
        self.colorBox_5.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 215, 0);"))
        self.colorBox_5.setObjectName(_fromUtf8("colorBox_5"))
        self.gridLayout.addWidget(self.colorBox_5, 4, 0, 1, 1)
        self.legendHorizontalLayout_2 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_2.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_2.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_2.setSpacing(6)
        self.legendHorizontalLayout_2.setObjectName(
            _fromUtf8("legendHorizontalLayout_2"))
        self.label_3 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_3.sizePolicy().hasHeightForWidth())
        self.label_3.setSizePolicy(sizePolicy)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.legendHorizontalLayout_2.addWidget(self.label_3)
        self.dashLabel_2 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_2.sizePolicy().hasHeightForWidth())
        self.dashLabel_2.setSizePolicy(sizePolicy)
        self.dashLabel_2.setObjectName(_fromUtf8("dashLabel_2"))
        self.legendHorizontalLayout_2.addWidget(self.dashLabel_2)
        self.label_4 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_4.sizePolicy().hasHeightForWidth())
        self.label_4.setSizePolicy(sizePolicy)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.legendHorizontalLayout_2.addWidget(self.label_4)
        self.gridLayout.addLayout(self.legendHorizontalLayout_2, 4, 1, 1, 1)
        self.colorBox_6 = QtGui.QWidget(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.colorBox_6.sizePolicy().hasHeightForWidth())
        self.colorBox_6.setSizePolicy(sizePolicy)
        self.colorBox_6.setMinimumSize(QtCore.QSize(22, 22))
        self.colorBox_6.setMaximumSize(QtCore.QSize(22, 22))
        self.colorBox_6.setBaseSize(QtCore.QSize(22, 22))
        self.colorBox_6.setAutoFillBackground(False)
        self.colorBox_6.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 255, 0);"))
        self.colorBox_6.setObjectName(_fromUtf8("colorBox_6"))
        self.gridLayout.addWidget(self.colorBox_6, 5, 0, 1, 1)
        self.legendHorizontalLayout_1 = QtGui.QHBoxLayout()
        self.legendHorizontalLayout_1.setSizeConstraint(
            QtGui.QLayout.SetFixedSize)
        self.legendHorizontalLayout_1.setContentsMargins(8, -1, -1, -1)
        self.legendHorizontalLayout_1.setSpacing(6)
        self.legendHorizontalLayout_1.setObjectName(
            _fromUtf8("legendHorizontalLayout_1"))
        self.label_1 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_1.sizePolicy().hasHeightForWidth())
        self.label_1.setSizePolicy(sizePolicy)
        self.label_1.setObjectName(_fromUtf8("label_1"))
        self.legendHorizontalLayout_1.addWidget(self.label_1)
        self.dashLabel_1 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dashLabel_1.sizePolicy().hasHeightForWidth())
        self.dashLabel_1.setSizePolicy(sizePolicy)
        self.dashLabel_1.setObjectName(_fromUtf8("dashLabel_1"))
        self.legendHorizontalLayout_1.addWidget(self.dashLabel_1)
        self.label_2 = QtGui.QLabel(self.legendGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
                                       QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.legendHorizontalLayout_1.addWidget(self.label_2)
        self.gridLayout.addLayout(self.legendHorizontalLayout_1, 5, 1, 1, 1)
        self.verticalLayout_2.addWidget(self.legendGroupBox)
        self.horizontalLayout_2.addLayout(self.verticalLayout_2)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.verticalLayout_3.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 740, 21))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName(_fromUtf8("menuFile"))
        self.menuMap_View = QtGui.QMenu(self.menubar)
        self.menuMap_View.setObjectName(_fromUtf8("menuMap_View"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuMap_View.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
コード例 #27
0
    def createWidget(self):
        self._layer = None

        if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
            if self.param.multiple:
                return MultipleInputPanel(options=[])
            else:
                widget = QgsFieldComboBox()
                widget.setAllowEmptyFieldName(self.param.optional)
                widget.fieldChanged.connect(lambda: self.widgetValueHasChanged.emit(self))
                if self.param.datatype == ParameterTableField.DATA_TYPE_NUMBER:
                    widget.setFilters(QgsFieldProxyModel.Numeric)
                elif self.param.datatype == ParameterTableField.DATA_TYPE_STRING:
                    widget.setFilters(QgsFieldProxyModel.String)
                elif self.param.datatype == ParameterTableField.DATA_TYPE_DATETIME:
                    widget.setFilters(QgsFieldProxyModel.Date | QgsFieldProxyModel.Time)
                return widget
        else:
            widget = QComboBox()
            widget.setEditable(True)
            fields = self.dialog.getAvailableValuesOfType(ParameterTableField, None)
            if self.param.optional:
                widget.addItem(self.NOT_SET, None)
            for f in fields:
                widget.addItem(self.dialog.resolveValueDescription(f), f)
            return widget
コード例 #28
0
    def setupUi(self, BandwidthColorRamps):
        BandwidthColorRamps.setObjectName(_fromUtf8("BandwidthColorRamps"))
        BandwidthColorRamps.resize(589, 238)
        self.chk_dual_fields = QtGui.QCheckBox(BandwidthColorRamps)
        self.chk_dual_fields.setGeometry(QtCore.QRect(10, 10, 88, 22))
        self.chk_dual_fields.setChecked(True)
        self.chk_dual_fields.setObjectName(_fromUtf8("chk_dual_fields"))
        self.txt_ab_min = QtGui.QLineEdit(BandwidthColorRamps)
        self.txt_ab_min.setGeometry(QtCore.QRect(115, 130, 80, 28))
        self.txt_ab_min.setObjectName(_fromUtf8("txt_ab_min"))
        self.txt_ab_max = QtGui.QLineEdit(BandwidthColorRamps)
        self.txt_ab_max.setGeometry(QtCore.QRect(239, 130, 80, 28))
        self.txt_ab_max.setObjectName(_fromUtf8("txt_ab_max"))
        self.label = QtGui.QLabel(BandwidthColorRamps)
        self.label.setGeometry(QtCore.QRect(210, 135, 31, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))
        self.label_2 = QtGui.QLabel(BandwidthColorRamps)
        self.label_2.setGeometry(QtCore.QRect(86, 136, 31, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_3 = QtGui.QLabel(BandwidthColorRamps)
        self.label_3.setEnabled(False)
        self.label_3.setGeometry(QtCore.QRect(348, 135, 31, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label_3.setFont(font)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.txt_ba_min = QtGui.QLineEdit(BandwidthColorRamps)
        self.txt_ba_min.setEnabled(False)
        self.txt_ba_min.setGeometry(QtCore.QRect(380, 130, 80, 28))
        self.txt_ba_min.setObjectName(_fromUtf8("txt_ba_min"))
        self.label_4 = QtGui.QLabel(BandwidthColorRamps)
        self.label_4.setEnabled(False)
        self.label_4.setGeometry(QtCore.QRect(470, 135, 31, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.txt_ba_max = QtGui.QLineEdit(BandwidthColorRamps)
        self.txt_ba_max.setEnabled(False)
        self.txt_ba_max.setGeometry(QtCore.QRect(500, 130, 80, 28))
        self.txt_ba_max.setObjectName(_fromUtf8("txt_ba_max"))
        self.cbb_ab_color = QtGui.QComboBox(BandwidthColorRamps)
        self.cbb_ab_color.setGeometry(QtCore.QRect(80, 90, 238, 28))
        self.cbb_ab_color.setObjectName(_fromUtf8("cbb_ab_color"))
        self.cbb_ba_color = QtGui.QComboBox(BandwidthColorRamps)
        self.cbb_ba_color.setEnabled(False)
        self.cbb_ba_color.setGeometry(QtCore.QRect(344, 90, 238, 28))
        self.cbb_ba_color.setObjectName(_fromUtf8("cbb_ba_color"))
        self.label_5 = QtGui.QLabel(BandwidthColorRamps)
        self.label_5.setGeometry(QtCore.QRect(45, 55, 31, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label_5.setFont(font)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.label_6 = QtGui.QLabel(BandwidthColorRamps)
        self.label_6.setGeometry(QtCore.QRect(8, 94, 81, 17))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label_6.setFont(font)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.but_cancel = QtGui.QPushButton(BandwidthColorRamps)
        self.but_cancel.setGeometry(QtCore.QRect(145, 200, 85, 27))
        self.but_cancel.setObjectName(_fromUtf8("but_cancel"))
        self.but_done = QtGui.QPushButton(BandwidthColorRamps)
        self.but_done.setGeometry(QtCore.QRect(45, 200, 85, 27))
        self.but_done.setObjectName(_fromUtf8("but_done"))
        self.cbb_ba_field = QgsFieldComboBox(BandwidthColorRamps)
        self.cbb_ba_field.setGeometry(QtCore.QRect(344, 50, 238, 28))
        self.cbb_ba_field.setObjectName(_fromUtf8("cbb_ba_field"))
        self.cbb_ab_field = QtGui.QComboBox(BandwidthColorRamps)
        self.cbb_ab_field.setGeometry(QtCore.QRect(80, 50, 238, 28))
        self.cbb_ab_field.setObjectName(_fromUtf8("cbb_ab_field"))

        self.retranslateUi(BandwidthColorRamps)
        QtCore.QMetaObject.connectSlotsByName(BandwidthColorRamps)