|
1 |
| -# -*- coding: utf-8 -*- |
2 |
| -""" |
3 |
| -/*************************************************************************** |
4 |
| - AttributeAssignment |
5 |
| - A QGIS plugin |
6 |
| - Easy to assign an attribute on QGIS |
7 |
| - ------------------- |
8 |
| - begin : 2018-03-14 |
9 |
| - git sha : $Format:%H$ |
10 |
| - copyright : (C) 2018 by Yasunori Kirimoto |
11 |
| - |
12 |
| - license : GNU General Public License v2.0 |
13 |
| - ***************************************************************************/ |
14 |
| -""" |
15 |
| - |
16 |
| -from PyQt5 import QtCore, QtGui, QtWidgets |
17 |
| - |
18 |
| -try: |
19 |
| - _fromUtf8 = QtCore.QString.fromUtf8 |
20 |
| -except AttributeError: |
21 |
| - def _fromUtf8(s): |
22 |
| - return s |
23 |
| - |
24 |
| -try: |
25 |
| - _encoding = QtWidgets.QApplication.UnicodeUTF8 |
26 |
| - def _translate(context, text, disambig): |
27 |
| - return QtWidgets.QApplication.translate(context, text, disambig, _encoding) |
28 |
| -except AttributeError: |
29 |
| - def _translate(context, text, disambig): |
30 |
| - return QtWidgets.QApplication.translate(context, text, disambig) |
31 |
| - |
32 |
| -class Ui_AttributeAssignment(object): |
33 |
| - def setupUi(self, AttributeAssignment): |
34 |
| - AttributeAssignment.setObjectName(_fromUtf8("AttributeAssignment")) |
35 |
| - AttributeAssignment.resize(240, 220) |
36 |
| - AttributeAssignment.move(50, 125) |
37 |
| - self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) |
38 |
| - self.label_layer = QtWidgets.QLabel(AttributeAssignment) |
39 |
| - self.label_layer.setGeometry(QtCore.QRect(20, 15, 201, 21)) |
40 |
| - font = QtGui.QFont() |
41 |
| - font.setPointSize(10) |
42 |
| - self.label_layer.setFont(font) |
43 |
| - self.label_layer.setObjectName(_fromUtf8("label_layer")) |
44 |
| - self.mMapLayerComboBox = QgsMapLayerComboBox(AttributeAssignment) |
45 |
| - self.mMapLayerComboBox.setGeometry(QtCore.QRect(20, 35, 200, 25)) |
46 |
| - font = QtGui.QFont() |
47 |
| - font.setPointSize(10) |
48 |
| - self.mMapLayerComboBox.setFont(font) |
49 |
| - self.mMapLayerComboBox.setObjectName(_fromUtf8("mMapLayerComboBox")) |
50 |
| - self.label_field = QtWidgets.QLabel(AttributeAssignment) |
51 |
| - self.label_field.setGeometry(QtCore.QRect(20, 75, 201, 21)) |
52 |
| - font = QtGui.QFont() |
53 |
| - font.setPointSize(10) |
54 |
| - self.label_field.setFont(font) |
55 |
| - self.label_field.setObjectName(_fromUtf8("label_field")) |
56 |
| - self.mFieldComboBox = QgsFieldComboBox(AttributeAssignment) |
57 |
| - self.mFieldComboBox.setGeometry(QtCore.QRect(20, 95, 200, 25)) |
58 |
| - font = QtGui.QFont() |
59 |
| - font.setPointSize(10) |
60 |
| - self.mFieldComboBox.setFont(font) |
61 |
| - self.mFieldComboBox.setObjectName(_fromUtf8("mFieldComboBox")) |
62 |
| - self.label_text = QtWidgets.QLabel(AttributeAssignment) |
63 |
| - self.label_text.setGeometry(QtCore.QRect(20, 140, 201, 21)) |
64 |
| - font = QtGui.QFont() |
65 |
| - font.setPointSize(10) |
66 |
| - self.label_text.setFont(font) |
67 |
| - self.label_text.setObjectName(_fromUtf8("label_text")) |
68 |
| - self.lineEdit_text = QtWidgets.QLineEdit(AttributeAssignment) |
69 |
| - self.lineEdit_text.setGeometry(QtCore.QRect(20, 160, 200, 25)) |
70 |
| - font = QtGui.QFont() |
71 |
| - font.setPointSize(10) |
72 |
| - self.lineEdit_text.setFont(font) |
73 |
| - self.lineEdit_text.setObjectName(_fromUtf8("lineEdit_text")) |
74 |
| - self.retranslateUi(AttributeAssignment) |
75 |
| - # QtCore.QObject.connect(self.mMapLayerComboBox, QtCore.SIGNAL(_fromUtf8("layerChanged(QgsMapLayer*)")), self.mFieldComboBox.setLayer) |
76 |
| - self.mMapLayerComboBox.layerChanged.connect(self.mFieldComboBox.setLayer) |
77 |
| - QtCore.QMetaObject.connectSlotsByName(AttributeAssignment) |
78 |
| - |
79 |
| - def retranslateUi(self, AttributeAssignment): |
80 |
| - AttributeAssignment.setWindowTitle(_translate("AttributeAssignment", u"AttributeAssignment", None)) |
81 |
| - self.label_layer.setText(_translate("AttributeAssignment", u"Layer", None)) |
82 |
| - self.label_field.setText(_translate("AttributeAssignment", u"Field", None)) |
83 |
| - self.label_text.setText(_translate("AttributeAssignment", u"Value", None)) |
84 |
| - |
85 |
| -from qgis.gui import QgsFieldComboBox, QgsMapLayerComboBox |
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +""" |
| 3 | +/*************************************************************************** |
| 4 | + AttributeAssignment |
| 5 | + A QGIS plugin |
| 6 | + Easy to assign an attribute on QGIS |
| 7 | + ------------------- |
| 8 | + begin : 2018-03-14 |
| 9 | + git sha : $Format:%H$ |
| 10 | + copyright : (C) 2018 by Yasunori Kirimoto |
| 11 | + |
| 12 | + license : GNU General Public License v2.0 |
| 13 | + ***************************************************************************/ |
| 14 | +""" |
| 15 | + |
| 16 | +from qgsfieldcombobox import QgsFieldComboBox |
| 17 | +from qgsmaplayercombobox import QgsMapLayerComboBox |
| 18 | +from PyQt5 import QtCore, QtGui, QtWidgets |
| 19 | + |
| 20 | + |
| 21 | +class Ui_AttributeAssignment(object): |
| 22 | + def setupUi(self, AttributeAssignment): |
| 23 | + AttributeAssignment.setObjectName("AttributeAssignment") |
| 24 | + AttributeAssignment.setEnabled(True) |
| 25 | + AttributeAssignment.resize(240, 220) |
| 26 | + self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) |
| 27 | + self.formLayout = QtWidgets.QFormLayout(AttributeAssignment) |
| 28 | + self.formLayout.setFieldGrowthPolicy( |
| 29 | + QtWidgets.QFormLayout.AllNonFixedFieldsGrow) |
| 30 | + self.formLayout.setRowWrapPolicy(QtWidgets.QFormLayout.DontWrapRows) |
| 31 | + self.formLayout.setContentsMargins(20, 20, 20, 20) |
| 32 | + self.formLayout.setSpacing(10) |
| 33 | + self.formLayout.setObjectName("formLayout") |
| 34 | + self.label_layer = QtWidgets.QLabel(AttributeAssignment) |
| 35 | + font = QtGui.QFont() |
| 36 | + font.setPointSize(10) |
| 37 | + self.label_layer.setFont(font) |
| 38 | + self.label_layer.setObjectName("label_layer") |
| 39 | + self.formLayout.setWidget( |
| 40 | + 0, QtWidgets.QFormLayout.LabelRole, self.label_layer) |
| 41 | + self.mMapLayerComboBox = QgsMapLayerComboBox(AttributeAssignment) |
| 42 | + sizePolicy = QtWidgets.QSizePolicy( |
| 43 | + QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) |
| 44 | + sizePolicy.setHorizontalStretch(0) |
| 45 | + sizePolicy.setVerticalStretch(25) |
| 46 | + sizePolicy.setHeightForWidth( |
| 47 | + self.mMapLayerComboBox.sizePolicy().hasHeightForWidth()) |
| 48 | + self.mMapLayerComboBox.setSizePolicy(sizePolicy) |
| 49 | + self.mMapLayerComboBox.setAllowEmptyLayer(False) |
| 50 | + self.mMapLayerComboBox.setShowCrs(False) |
| 51 | + self.mMapLayerComboBox.setObjectName("mMapLayerComboBox") |
| 52 | + self.formLayout.setWidget( |
| 53 | + 1, QtWidgets.QFormLayout.SpanningRole, self.mMapLayerComboBox) |
| 54 | + self.label_field = QtWidgets.QLabel(AttributeAssignment) |
| 55 | + font = QtGui.QFont() |
| 56 | + font.setPointSize(10) |
| 57 | + self.label_field.setFont(font) |
| 58 | + self.label_field.setObjectName("label_field") |
| 59 | + self.formLayout.setWidget( |
| 60 | + 3, QtWidgets.QFormLayout.LabelRole, self.label_field) |
| 61 | + self.mFieldComboBox = QgsFieldComboBox(AttributeAssignment) |
| 62 | + sizePolicy = QtWidgets.QSizePolicy( |
| 63 | + QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) |
| 64 | + sizePolicy.setHorizontalStretch(0) |
| 65 | + sizePolicy.setVerticalStretch(25) |
| 66 | + sizePolicy.setHeightForWidth( |
| 67 | + self.mFieldComboBox.sizePolicy().hasHeightForWidth()) |
| 68 | + self.mFieldComboBox.setSizePolicy(sizePolicy) |
| 69 | + self.mFieldComboBox.setObjectName("mFieldComboBox") |
| 70 | + self.formLayout.setWidget( |
| 71 | + 4, QtWidgets.QFormLayout.SpanningRole, self.mFieldComboBox) |
| 72 | + self.label_value = QtWidgets.QLabel(AttributeAssignment) |
| 73 | + font = QtGui.QFont() |
| 74 | + font.setPointSize(10) |
| 75 | + self.label_value.setFont(font) |
| 76 | + self.label_value.setObjectName("label_value") |
| 77 | + self.formLayout.setWidget( |
| 78 | + 6, QtWidgets.QFormLayout.LabelRole, self.label_value) |
| 79 | + self.mValuePlaceholder = QtWidgets.QWidget(AttributeAssignment) |
| 80 | + sizePolicy = QtWidgets.QSizePolicy( |
| 81 | + QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) |
| 82 | + sizePolicy.setHorizontalStretch(0) |
| 83 | + sizePolicy.setVerticalStretch(25) |
| 84 | + sizePolicy.setHeightForWidth( |
| 85 | + self.mValuePlaceholder.sizePolicy().hasHeightForWidth()) |
| 86 | + self.mValuePlaceholder.setSizePolicy(sizePolicy) |
| 87 | + self.mValuePlaceholder.setObjectName("mValuePlaceholder") |
| 88 | + self.formLayout.setWidget( |
| 89 | + 7, QtWidgets.QFormLayout.SpanningRole, self.mValuePlaceholder) |
| 90 | + self.label_layer.raise_() |
| 91 | + self.mValuePlaceholder.raise_() |
| 92 | + self.label_field.raise_() |
| 93 | + self.mMapLayerComboBox.raise_() |
| 94 | + self.mFieldComboBox.raise_() |
| 95 | + self.label_value.raise_() |
| 96 | + self.retranslateUi(AttributeAssignment) |
| 97 | + QtCore.QMetaObject.connectSlotsByName(AttributeAssignment) |
| 98 | + |
| 99 | + def retranslateUi(self, AttributeAssignment): |
| 100 | + _translate = QtCore.QCoreApplication.translate |
| 101 | + AttributeAssignment.setWindowTitle(_translate( |
| 102 | + "AttributeAssignment", "AttributeAssignment")) |
| 103 | + self.label_layer.setText(_translate("AttributeAssignment", "Layer")) |
| 104 | + self.label_field.setText(_translate("AttributeAssignment", "Field")) |
| 105 | + self.label_value.setText(_translate("AttributeAssignment", "Value")) |
0 commit comments