def testMoveToTopActionEmbeddedGroup(self):
        """Test move to top action on embeddedgroup layer"""
        view = QgsLayerTreeView()
        group = self.project.layerTreeRoot().addGroup("embeddedgroup")
        group.addLayer(self.layer4)
        group.addLayer(self.layer5)
        groupname = group.name()
        view.setModel(self.model)
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(self.nodeOrder(self.project.layerTreeRoot().children()), [
            self.layer.name(),
            self.layer2.name(),
            self.layer3.name(),
            groupname,
            groupname + '-' + self.layer4.name(),
            groupname + '-' + self.layer5.name(),
        ])

        view.setCurrentLayer(self.layer5)
        movetotop = actions.actionMoveToTop()
        movetotop.trigger()
        self.assertEqual(self.nodeOrder(self.project.layerTreeRoot().children()), [
            self.layer.name(),
            self.layer2.name(),
            self.layer3.name(),
            groupname,
            groupname + '-' + self.layer5.name(),
            groupname + '-' + self.layer4.name(),
        ])
 def testMoveToTopActionLayer(self):
     """Test move to top action on layer"""
     view = QgsLayerTreeView()
     view.setModel(self.model)
     actions = QgsLayerTreeViewDefaultActions(view)
     self.assertEqual(self.project.layerTreeRoot().layerOrder(), [self.layer, self.layer2, self.layer3])
     view.setCurrentLayer(self.layer3)
     movetotop = actions.actionMoveToTop()
     movetotop.trigger()
     self.assertEqual(self.project.layerTreeRoot().layerOrder(), [self.layer3, self.layer, self.layer2])
Пример #3
0
    def setupUi(self, LayerSelectDialog):
        LayerSelectDialog.setObjectName(_fromUtf8("LayerSelectDialog"))
        LayerSelectDialog.resize(439, 425)
        self.verticalLayout = QtGui.QVBoxLayout(LayerSelectDialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(LayerSelectDialog)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab_Tree = QtGui.QWidget()
        self.tab_Tree.setObjectName(_fromUtf8("tab_Tree"))
        self.gridLayout_2 = QtGui.QGridLayout(self.tab_Tree)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.treeView = QgsLayerTreeView(self.tab_Tree)
        self.treeView.setObjectName(_fromUtf8("treeView"))
        self.gridLayout_2.addWidget(self.treeView, 0, 0, 1, 1)
        self.tabWidget.addTab(self.tab_Tree, _fromUtf8(""))
        self.tab_Preview = QtGui.QWidget()
        self.tab_Preview.setObjectName(_fromUtf8("tab_Preview"))
        self.gridLayout = QtGui.QGridLayout(self.tab_Preview)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.canvas = QgsMapCanvas(self.tab_Preview)
        self.canvas.setObjectName(_fromUtf8("canvas"))
        self.gridLayout.addWidget(self.canvas, 0, 0, 1, 1)
        self.tabWidget.addTab(self.tab_Preview, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.buttonBox = QtGui.QDialogButtonBox(LayerSelectDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(LayerSelectDialog)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), LayerSelectDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), LayerSelectDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(LayerSelectDialog)
    def setTreeView():
      def setModel():
        self.model = QgsLayerTreeModel( ltg )
        self.model.setFlag( QgsLayerTreeModel.AllowNodeReorder )
        self.model.setFlag( QgsLayerTreeModel.AllowNodeChangeVisibility, True )
        self.tview.setModel( self.model )

      self.tview = QgsLayerTreeView( self )
      self.tview.setSelectionMode( QAbstractItemView.ExtendedSelection )
      setModel()
      self.tview.currentLayerChanged.connect( self.currentLayerChanged.emit )
    def testDefaultActions(self):
        view = QgsLayerTreeView()
        view.setModel(self.model)
        actions = QgsLayerTreeViewDefaultActions(view)

        # show in overview action
        view.setCurrentLayer(self.layer)
        self.assertEqual(view.currentNode().customProperty('overview', 0), False)
        show_in_overview = actions.actionShowInOverview()
        show_in_overview.trigger()
        self.assertEqual(view.currentNode().customProperty('overview', 0), True)
        show_in_overview.trigger()
        self.assertEqual(view.currentNode().customProperty('overview', 0), False)
Пример #6
0
    def testMoveOutOfGroupActionLayer(self):
        """Test move out of group action on layer"""
        view = QgsLayerTreeView()
        group = self.project.layerTreeRoot().addGroup("embeddedgroup")
        group.addLayer(self.layer4)
        group.addLayer(self.layer5)
        groupname = group.name()
        view.setModel(self.model)
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
                groupname,
                groupname + '-' + self.layer4.name(),
                groupname + '-' + self.layer5.name(),
            ])

        view.setCurrentLayer(self.layer5)
        moveOutOfGroup = actions.actionMoveOutOfGroup()
        moveOutOfGroup.trigger()
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
                self.layer5.name(),
                groupname,
                groupname + '-' + self.layer4.name(),
            ])
Пример #7
0
    def setupUi(self, LayerSelectDialog):
        LayerSelectDialog.setObjectName(_fromUtf8("LayerSelectDialog"))
        LayerSelectDialog.resize(439, 425)
        self.verticalLayout = QtGui.QVBoxLayout(LayerSelectDialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.tabWidget = QtGui.QTabWidget(LayerSelectDialog)
        self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
        self.tab_Tree = QtGui.QWidget()
        self.tab_Tree.setObjectName(_fromUtf8("tab_Tree"))
        self.gridLayout_2 = QtGui.QGridLayout(self.tab_Tree)
        self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
        self.treeView = QgsLayerTreeView(self.tab_Tree)
        self.treeView.setObjectName(_fromUtf8("treeView"))
        self.gridLayout_2.addWidget(self.treeView, 0, 0, 1, 1)
        self.tabWidget.addTab(self.tab_Tree, _fromUtf8(""))
        self.tab_Preview = QtGui.QWidget()
        self.tab_Preview.setObjectName(_fromUtf8("tab_Preview"))
        self.gridLayout = QtGui.QGridLayout(self.tab_Preview)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.canvas = QgsMapCanvas(self.tab_Preview)
        self.canvas.setObjectName(_fromUtf8("canvas"))
        self.gridLayout.addWidget(self.canvas, 0, 0, 1, 1)
        self.tabWidget.addTab(self.tab_Preview, _fromUtf8(""))
        self.verticalLayout.addWidget(self.tabWidget)
        self.buttonBox = QtGui.QDialogButtonBox(LayerSelectDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
                                          | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(LayerSelectDialog)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QObject.connect(self.buttonBox,
                               QtCore.SIGNAL(_fromUtf8("accepted()")),
                               LayerSelectDialog.accept)
        QtCore.QObject.connect(self.buttonBox,
                               QtCore.SIGNAL(_fromUtf8("rejected()")),
                               LayerSelectDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(LayerSelectDialog)
Пример #8
0
    def testMoveToTopActionGroup(self):
        """Test move to top action on group"""
        view = QgsLayerTreeView()
        group = self.project.layerTreeRoot().addGroup("embeddedgroup")
        group.addLayer(self.layer4)
        group.addLayer(self.layer5)
        groupname = group.name()
        view.setModel(self.model)
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
                groupname,
                groupname + '-' + self.layer4.name(),
                groupname + '-' + self.layer5.name(),
            ])

        nodeLayerIndex = self.model.node2index(group)
        view.setCurrentIndex(nodeLayerIndex)
        movetotop = actions.actionMoveToTop()
        movetotop.trigger()
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                groupname,
                groupname + '-' + self.layer4.name(),
                groupname + '-' + self.layer5.name(),
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
            ])
    def testSetModel(self):
        view = QgsLayerTreeView()

        # should not work
        string_list_model = QStringListModel()
        view.setModel(string_list_model)
        self.assertFalse(view.model())

        # should work
        view.setModel(self.model)
        self.assertEqual(view.model(), self.model)
Пример #10
0
 def testMoveToTopActionLayer(self):
     """Test move to top action on layer"""
     view = QgsLayerTreeView()
     view.setModel(self.model)
     actions = QgsLayerTreeViewDefaultActions(view)
     self.assertEqual(self.project.layerTreeRoot().layerOrder(), [self.layer, self.layer2, self.layer3])
     view.setCurrentLayer(self.layer3)
     movetotop = actions.actionMoveToTop()
     movetotop.trigger()
     self.assertEqual(self.project.layerTreeRoot().layerOrder(), [self.layer3, self.layer, self.layer2])
Пример #11
0
    def testMoveToBottomActionLayer(self):
        """Test move to bottom action on layer"""

        view = QgsLayerTreeView()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(self.project.layerTreeRoot().layerOrder(),
                         [self.layer, self.layer2, self.layer3])
        view.setCurrentLayer(self.layer)
        movetobottom = actions.actionMoveToBottom()
        movetobottom.trigger()
        self.assertEqual(self.project.layerTreeRoot().layerOrder(),
                         [self.layer2, self.layer3, self.layer])
Пример #12
0
    def setupUi(self, ImportLayerTreeDialogBase):
        ImportLayerTreeDialogBase.setObjectName("ImportLayerTreeDialogBase")
        ImportLayerTreeDialogBase.resize(373, 548)
        self.vert_lay_global = QtWidgets.QVBoxLayout(ImportLayerTreeDialogBase)
        self.vert_lay_global.setObjectName("vert_lay_global")
        self.groupBox = QtWidgets.QGroupBox(ImportLayerTreeDialogBase)
        self.groupBox.setMaximumSize(QtCore.QSize(16777215, 60))
        self.groupBox.setObjectName("groupBox")
        self.vert_lay_file = QtWidgets.QVBoxLayout(self.groupBox)
        self.vert_lay_file.setObjectName("vert_lay_file")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.lineEditPrj = QtWidgets.QLineEdit(self.groupBox)
        self.lineEditPrj.setMinimumSize(QtCore.QSize(0, 20))
        self.lineEditPrj.setObjectName("lineEditPrj")
        self.horizontalLayout.addWidget(self.lineEditPrj)
        self.pushButtonPrj = QtWidgets.QPushButton(self.groupBox)
        self.pushButtonPrj.setMinimumSize(QtCore.QSize(0, 23))
        self.pushButtonPrj.setMaximumSize(QtCore.QSize(31, 23))
        self.pushButtonPrj.setObjectName("pushButtonPrj")
        self.horizontalLayout.addWidget(self.pushButtonPrj)
        self.vert_lay_file.addLayout(self.horizontalLayout)
        self.vert_lay_global.addWidget(self.groupBox)

        ################################################################################################################
        # Aquí inserto QgsLayerTreeView. Con QgsProjectionSelectionTreeWidget() por ejemplo funciona bien
        self.tree_widget = QgsLayerTreeView(ImportLayerTreeDialogBase)
        self.vert_lay_global.addWidget(self.tree_widget)
        ################################################################################################################

        self.button_box = QtWidgets.QDialogButtonBox(ImportLayerTreeDialogBase)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                           | QtWidgets.QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")
        self.vert_lay_global.addWidget(self.button_box)

        self.retranslateUi(ImportLayerTreeDialogBase)
        # self.button_box.accepted.connect(ImportLayerTreeDialogBase.accept)
        self.button_box.rejected.connect(ImportLayerTreeDialogBase.reject)
        QtCore.QMetaObject.connectSlotsByName(ImportLayerTreeDialogBase)
    def __init__(self, parent):
        self.setObjectName(_fromUtf8("self"))
        self.resize(393, 995)
        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.label_11 = QtGui.QLabel(self)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_11.sizePolicy().hasHeightForWidth())
        self.label_11.setSizePolicy(sizePolicy)
        self.label_11.setStyleSheet(
            _fromUtf8(
                "padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);"
            ))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.verticalLayout.addWidget(self.label_11)
        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setFrameShape(QtGui.QFrame.StyledPanel)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(
            0, 0, 375, 1478))
        self.scrollAreaWidgetContents.setObjectName(
            _fromUtf8("scrollAreaWidgetContents"))
        self.mainLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
        self.mainLayout.setObjectName(_fromUtf8("mainLayout"))
        self.mMainPropertiesColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mMainPropertiesColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mMainPropertiesColGroupBox.setProperty("syncGroup",
                                                    _fromUtf8("composeritem"))
        self.mMainPropertiesColGroupBox.setProperty("collapsed", False)
        self.mMainPropertiesColGroupBox.setObjectName(
            _fromUtf8("mMainPropertiesColGroupBox"))
        self.formLayout = QtGui.QFormLayout(self.mMainPropertiesColGroupBox)
        self.formLayout.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setLabelAlignment(QtCore.Qt.AlignLeading
                                          | QtCore.Qt.AlignLeft
                                          | QtCore.Qt.AlignVCenter)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.mTitleLabel = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.mTitleLabel.setObjectName(_fromUtf8("mTitleLabel"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
                                  self.mTitleLabel)
        self.mTitleLineEdit = QtGui.QLineEdit(self.mMainPropertiesColGroupBox)
        self.mTitleLineEdit.setObjectName(_fromUtf8("mTitleLineEdit"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
                                  self.mTitleLineEdit)
        self.mMapLabel = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.mMapLabel.setObjectName(_fromUtf8("mMapLabel"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
                                  self.mMapLabel)
        self.mMapComboBox = QtGui.QComboBox(self.mMainPropertiesColGroupBox)
        self.mMapComboBox.setObjectName(_fromUtf8("mMapComboBox"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
                                  self.mMapComboBox)
        self.label = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label)
        self.mWrapCharLineEdit = QtGui.QLineEdit(
            self.mMainPropertiesColGroupBox)
        self.mWrapCharLineEdit.setFrame(True)
        self.mWrapCharLineEdit.setObjectName(_fromUtf8("mWrapCharLineEdit"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
                                  self.mWrapCharLineEdit)
        self.label_15 = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.label_15.setObjectName(_fromUtf8("label_15"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
                                  self.label_15)
        self.mTitleAlignCombo = QtGui.QComboBox(
            self.mMainPropertiesColGroupBox)
        self.mTitleAlignCombo.setObjectName(_fromUtf8("mTitleAlignCombo"))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
                                  self.mTitleAlignCombo)
        self.mainLayout.addWidget(self.mMainPropertiesColGroupBox)
        self.mLegendItemColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mLegendItemColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mLegendItemColGroupBox.setProperty("syncGroup",
                                                _fromUtf8("composeritem"))
        self.mLegendItemColGroupBox.setProperty("collapsed", False)
        self.mLegendItemColGroupBox.setObjectName(
            _fromUtf8("mLegendItemColGroupBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.mLegendItemColGroupBox)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.mCheckBoxAutoUpdate = QtGui.QCheckBox(self.mLegendItemColGroupBox)
        self.mCheckBoxAutoUpdate.setChecked(True)
        self.mCheckBoxAutoUpdate.setObjectName(
            _fromUtf8("mCheckBoxAutoUpdate"))
        self.horizontalLayout.addWidget(self.mCheckBoxAutoUpdate)
        spacerItem = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.mUpdateAllPushButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        self.mUpdateAllPushButton.setObjectName(
            _fromUtf8("mUpdateAllPushButton"))
        self.horizontalLayout.addWidget(self.mUpdateAllPushButton)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.mItemTreeView = QgsLayerTreeView(self.mLegendItemColGroupBox)
        self.mItemTreeView.setMinimumSize(QtCore.QSize(0, 250))
        self.mItemTreeView.setSelectionMode(
            QtGui.QAbstractItemView.ContiguousSelection)
        self.mItemTreeView.setHeaderHidden(True)
        self.mItemTreeView.setObjectName(_fromUtf8("mItemTreeView"))
        self.mItemTreeView.header().setVisible(False)
        self.verticalLayout_2.addWidget(self.mItemTreeView)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(3)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.mMoveDownToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mMoveDownToolButton.sizePolicy().hasHeightForWidth())
        self.mMoveDownToolButton.setSizePolicy(sizePolicy)
        self.mMoveDownToolButton.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionArrowDown.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mMoveDownToolButton.setIcon(icon)
        self.mMoveDownToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mMoveDownToolButton.setObjectName(
            _fromUtf8("mMoveDownToolButton"))
        self.horizontalLayout_2.addWidget(self.mMoveDownToolButton)
        self.mMoveUpToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mMoveUpToolButton.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionArrowUp.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mMoveUpToolButton.setIcon(icon1)
        self.mMoveUpToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mMoveUpToolButton.setObjectName(_fromUtf8("mMoveUpToolButton"))
        self.horizontalLayout_2.addWidget(self.mMoveUpToolButton)
        self.mAddGroupToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionAddGroup.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mAddGroupToolButton.setIcon(icon2)
        self.mAddGroupToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mAddGroupToolButton.setObjectName(
            _fromUtf8("mAddGroupToolButton"))
        self.horizontalLayout_2.addWidget(self.mAddGroupToolButton)
        self.mAddToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mAddToolButton.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/symbologyAdd.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mAddToolButton.setIcon(icon3)
        self.mAddToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mAddToolButton.setObjectName(_fromUtf8("mAddToolButton"))
        self.horizontalLayout_2.addWidget(self.mAddToolButton)
        self.mRemoveToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mRemoveToolButton.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/symbologyRemove.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mRemoveToolButton.setIcon(icon4)
        self.mRemoveToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mRemoveToolButton.setObjectName(_fromUtf8("mRemoveToolButton"))
        self.horizontalLayout_2.addWidget(self.mRemoveToolButton)
        self.mEditPushButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mEditPushButton.setText(_fromUtf8(""))
        icon5 = QtGui.QIcon()
        icon5.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/symbologyEdit.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mEditPushButton.setIcon(icon5)
        self.mEditPushButton.setIconSize(QtCore.QSize(20, 20))
        self.mEditPushButton.setObjectName(_fromUtf8("mEditPushButton"))
        self.horizontalLayout_2.addWidget(self.mEditPushButton)
        self.mCountToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mCountToolButton.setEnabled(False)
        self.mCountToolButton.setText(_fromUtf8(""))
        icon6 = QtGui.QIcon()
        icon6.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/mActionSum.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mCountToolButton.setIcon(icon6)
        self.mCountToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mCountToolButton.setCheckable(True)
        self.mCountToolButton.setObjectName(_fromUtf8("mCountToolButton"))
        self.horizontalLayout_2.addWidget(self.mCountToolButton)
        self.mFilterByMapToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionFilter2.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mFilterByMapToolButton.setIcon(icon7)
        self.mFilterByMapToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mFilterByMapToolButton.setCheckable(True)
        self.mFilterByMapToolButton.setObjectName(
            _fromUtf8("mFilterByMapToolButton"))
        self.horizontalLayout_2.addWidget(self.mFilterByMapToolButton)
        self.mExpressionFilterButton = QgsLegendFilterButton(
            self.mLegendItemColGroupBox)
        self.mExpressionFilterButton.setText(_fromUtf8(""))
        icon8 = QtGui.QIcon()
        icon8.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mIconExpressionFilter.svg")
            ), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mExpressionFilterButton.setIcon(icon8)
        self.mExpressionFilterButton.setIconSize(QtCore.QSize(20, 20))
        self.mExpressionFilterButton.setObjectName(
            _fromUtf8("mExpressionFilterButton"))
        self.horizontalLayout_2.addWidget(self.mExpressionFilterButton)
        spacerItem1 = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.mFilterLegendByAtlasCheckBox = QtGui.QCheckBox(
            self.mLegendItemColGroupBox)
        self.mFilterLegendByAtlasCheckBox.setObjectName(
            _fromUtf8("mFilterLegendByAtlasCheckBox"))
        self.verticalLayout_2.addWidget(self.mFilterLegendByAtlasCheckBox)
        self.mainLayout.addWidget(self.mLegendItemColGroupBox)
        self.mFontsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mFontsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mFontsColGroupBox.setProperty("syncGroup",
                                           _fromUtf8("composeritem"))
        self.mFontsColGroupBox.setProperty("collapsed", True)
        self.mFontsColGroupBox.setObjectName(_fromUtf8("mFontsColGroupBox"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.mFontsColGroupBox)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.mTitleFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mTitleFontButton.sizePolicy().hasHeightForWidth())
        self.mTitleFontButton.setSizePolicy(sizePolicy)
        self.mTitleFontButton.setObjectName(_fromUtf8("mTitleFontButton"))
        self.verticalLayout_3.addWidget(self.mTitleFontButton)
        self.mLayerFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mLayerFontButton.setObjectName(_fromUtf8("mLayerFontButton"))
        self.verticalLayout_3.addWidget(self.mLayerFontButton)
        self.mGroupFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mGroupFontButton.setObjectName(_fromUtf8("mGroupFontButton"))
        self.verticalLayout_3.addWidget(self.mGroupFontButton)
        self.mItemFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mItemFontButton.setObjectName(_fromUtf8("mItemFontButton"))
        self.verticalLayout_3.addWidget(self.mItemFontButton)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.label_16 = QtGui.QLabel(self.mFontsColGroupBox)
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.horizontalLayout_3.addWidget(self.label_16)
        self.mFontColorButton = QgsColorButtonV2(self.mFontsColGroupBox)
        self.mFontColorButton.setMinimumSize(QtCore.QSize(120, 0))
        self.mFontColorButton.setMaximumSize(QtCore.QSize(120, 16777215))
        self.mFontColorButton.setText(_fromUtf8(""))
        self.mFontColorButton.setObjectName(_fromUtf8("mFontColorButton"))
        self.horizontalLayout_3.addWidget(self.mFontColorButton)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem2)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.mainLayout.addWidget(self.mFontsColGroupBox)
        self.mColumnsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mColumnsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mColumnsColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mColumnsColGroupBox.setProperty("collapsed", True)
        self.mColumnsColGroupBox.setObjectName(
            _fromUtf8("mColumnsColGroupBox"))
        self.formLayout_2 = QtGui.QFormLayout(self.mColumnsColGroupBox)
        self.formLayout_2.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.label_2 = QtGui.QLabel(self.mColumnsColGroupBox)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_2)
        self.mColumnCountSpinBox = QgsSpinBox(self.mColumnsColGroupBox)
        self.mColumnCountSpinBox.setPrefix(_fromUtf8(""))
        self.mColumnCountSpinBox.setMinimum(1)
        self.mColumnCountSpinBox.setMaximum(1000)
        self.mColumnCountSpinBox.setObjectName(
            _fromUtf8("mColumnCountSpinBox"))
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mColumnCountSpinBox)
        self.mEqualColumnWidthCheckBox = QtGui.QCheckBox(
            self.mColumnsColGroupBox)
        self.mEqualColumnWidthCheckBox.setObjectName(
            _fromUtf8("mEqualColumnWidthCheckBox"))
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.SpanningRole,
                                    self.mEqualColumnWidthCheckBox)
        self.mSplitLayerCheckBox = QtGui.QCheckBox(self.mColumnsColGroupBox)
        self.mSplitLayerCheckBox.setObjectName(
            _fromUtf8("mSplitLayerCheckBox"))
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.SpanningRole,
                                    self.mSplitLayerCheckBox)
        self.mainLayout.addWidget(self.mColumnsColGroupBox)
        self.mSymbolsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSymbolsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSymbolsColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mSymbolsColGroupBox.setProperty("collapsed", True)
        self.mSymbolsColGroupBox.setObjectName(
            _fromUtf8("mSymbolsColGroupBox"))
        self.formLayout_3 = QtGui.QFormLayout(self.mSymbolsColGroupBox)
        self.formLayout_3.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
        self.label_3 = QtGui.QLabel(self.mSymbolsColGroupBox)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_3)
        self.mSymbolWidthSpinBox = QgsDoubleSpinBox(self.mSymbolsColGroupBox)
        self.mSymbolWidthSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolWidthSpinBox.setProperty("showClearButton", False)
        self.mSymbolWidthSpinBox.setObjectName(
            _fromUtf8("mSymbolWidthSpinBox"))
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolWidthSpinBox)
        self.label_4 = QtGui.QLabel(self.mSymbolsColGroupBox)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_4)
        self.mSymbolHeightSpinBox = QgsDoubleSpinBox(self.mSymbolsColGroupBox)
        self.mSymbolHeightSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolHeightSpinBox.setProperty("showClearButton", False)
        self.mSymbolHeightSpinBox.setObjectName(
            _fromUtf8("mSymbolHeightSpinBox"))
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolHeightSpinBox)
        self.mRasterBorderGroupBox = QgsCollapsibleGroupBoxBasic(
            self.mSymbolsColGroupBox)
        self.mRasterBorderGroupBox.setCheckable(True)
        self.mRasterBorderGroupBox.setProperty("syncGroup",
                                               _fromUtf8("composeritem"))
        self.mRasterBorderGroupBox.setProperty("collapsed", True)
        self.mRasterBorderGroupBox.setObjectName(
            _fromUtf8("mRasterBorderGroupBox"))
        self.gridLayout = QtGui.QGridLayout(self.mRasterBorderGroupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label_17 = QtGui.QLabel(self.mRasterBorderGroupBox)
        self.label_17.setObjectName(_fromUtf8("label_17"))
        self.gridLayout.addWidget(self.label_17, 0, 0, 1, 1)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.mRasterBorderColorButton = QgsColorButtonV2(
            self.mRasterBorderGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mRasterBorderColorButton.sizePolicy().hasHeightForWidth())
        self.mRasterBorderColorButton.setSizePolicy(sizePolicy)
        self.mRasterBorderColorButton.setMinimumSize(QtCore.QSize(120, 0))
        self.mRasterBorderColorButton.setMaximumSize(
            QtCore.QSize(120, 16777215))
        self.mRasterBorderColorButton.setText(_fromUtf8(""))
        self.mRasterBorderColorButton.setObjectName(
            _fromUtf8("mRasterBorderColorButton"))
        self.horizontalLayout_6.addWidget(self.mRasterBorderColorButton)
        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem3)
        self.gridLayout.addLayout(self.horizontalLayout_6, 0, 1, 1, 1)
        self.mOutlineWidthLabel = QtGui.QLabel(self.mRasterBorderGroupBox)
        self.mOutlineWidthLabel.setObjectName(_fromUtf8("mOutlineWidthLabel"))
        self.gridLayout.addWidget(self.mOutlineWidthLabel, 1, 0, 1, 1)
        self.mRasterBorderWidthSpinBox = QgsDoubleSpinBox(
            self.mRasterBorderGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mRasterBorderWidthSpinBox.sizePolicy().hasHeightForWidth())
        self.mRasterBorderWidthSpinBox.setSizePolicy(sizePolicy)
        self.mRasterBorderWidthSpinBox.setSingleStep(0.1)
        self.mRasterBorderWidthSpinBox.setProperty("showClearButton", False)
        self.mRasterBorderWidthSpinBox.setObjectName(
            _fromUtf8("mRasterBorderWidthSpinBox"))
        self.gridLayout.addWidget(self.mRasterBorderWidthSpinBox, 1, 1, 1, 1)
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.SpanningRole,
                                    self.mRasterBorderGroupBox)
        self.mainLayout.addWidget(self.mSymbolsColGroupBox)
        self.mSymbolsColGroupBox_2 = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSymbolsColGroupBox_2.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSymbolsColGroupBox_2.setProperty("syncGroup",
                                               _fromUtf8("composeritem"))
        self.mSymbolsColGroupBox_2.setProperty("collapsed", True)
        self.mSymbolsColGroupBox_2.setObjectName(
            _fromUtf8("mSymbolsColGroupBox_2"))
        self.formLayout_5 = QtGui.QFormLayout(self.mSymbolsColGroupBox_2)
        self.formLayout_5.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_5.setObjectName(_fromUtf8("formLayout_5"))
        self.label_13 = QtGui.QLabel(self.mSymbolsColGroupBox_2)
        self.label_13.setObjectName(_fromUtf8("label_13"))
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_13)
        self.mWmsLegendWidthSpinBox = QgsDoubleSpinBox(
            self.mSymbolsColGroupBox_2)
        self.mWmsLegendWidthSpinBox.setPrefix(_fromUtf8(""))
        self.mWmsLegendWidthSpinBox.setMaximum(9999.0)
        self.mWmsLegendWidthSpinBox.setProperty("showClearButton", False)
        self.mWmsLegendWidthSpinBox.setObjectName(
            _fromUtf8("mWmsLegendWidthSpinBox"))
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mWmsLegendWidthSpinBox)
        self.label_14 = QtGui.QLabel(self.mSymbolsColGroupBox_2)
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_14)
        self.mWmsLegendHeightSpinBox = QgsDoubleSpinBox(
            self.mSymbolsColGroupBox_2)
        self.mWmsLegendHeightSpinBox.setPrefix(_fromUtf8(""))
        self.mWmsLegendHeightSpinBox.setMaximum(9999.0)
        self.mWmsLegendHeightSpinBox.setProperty("showClearButton", False)
        self.mWmsLegendHeightSpinBox.setObjectName(
            _fromUtf8("mWmsLegendHeightSpinBox"))
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mWmsLegendHeightSpinBox)
        self.mainLayout.addWidget(self.mSymbolsColGroupBox_2)
        self.mSpacingColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSpacingColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSpacingColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mSpacingColGroupBox.setProperty("collapsed", True)
        self.mSpacingColGroupBox.setObjectName(
            _fromUtf8("mSpacingColGroupBox"))
        self.formLayout_4 = QtGui.QFormLayout(self.mSpacingColGroupBox)
        self.formLayout_4.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_4.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_4.setObjectName(_fromUtf8("formLayout_4"))
        self.label_5 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_5)
        self.mGroupSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mGroupSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mGroupSpaceSpinBox.setObjectName(_fromUtf8("mGroupSpaceSpinBox"))
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mGroupSpaceSpinBox)
        self.label_6 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole,
                                    self.label_6)
        self.mLayerSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mLayerSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mLayerSpaceSpinBox.setObjectName(_fromUtf8("mLayerSpaceSpinBox"))
        self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole,
                                    self.mLayerSpaceSpinBox)
        self.label_7 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.formLayout_4.setWidget(3, QtGui.QFormLayout.LabelRole,
                                    self.label_7)
        self.mSymbolSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mSymbolSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolSpaceSpinBox.setObjectName(
            _fromUtf8("mSymbolSpaceSpinBox"))
        self.formLayout_4.setWidget(3, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolSpaceSpinBox)
        self.label_8 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout_4.setWidget(4, QtGui.QFormLayout.LabelRole,
                                    self.label_8)
        self.mIconLabelSpaceSpinBox = QgsDoubleSpinBox(
            self.mSpacingColGroupBox)
        self.mIconLabelSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mIconLabelSpaceSpinBox.setObjectName(
            _fromUtf8("mIconLabelSpaceSpinBox"))
        self.formLayout_4.setWidget(4, QtGui.QFormLayout.FieldRole,
                                    self.mIconLabelSpaceSpinBox)
        self.label_9 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.formLayout_4.setWidget(5, QtGui.QFormLayout.LabelRole,
                                    self.label_9)
        self.mBoxSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mBoxSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mBoxSpaceSpinBox.setObjectName(_fromUtf8("mBoxSpaceSpinBox"))
        self.formLayout_4.setWidget(5, QtGui.QFormLayout.FieldRole,
                                    self.mBoxSpaceSpinBox)
        self.label_12 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.formLayout_4.setWidget(6, QtGui.QFormLayout.LabelRole,
                                    self.label_12)
        self.mColumnSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mColumnSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mColumnSpaceSpinBox.setObjectName(
            _fromUtf8("mColumnSpaceSpinBox"))
        self.formLayout_4.setWidget(6, QtGui.QFormLayout.FieldRole,
                                    self.mColumnSpaceSpinBox)
        self.label_10 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_10)
        self.mTitleSpaceBottomSpinBox = QgsDoubleSpinBox(
            self.mSpacingColGroupBox)
        self.mTitleSpaceBottomSpinBox.setObjectName(
            _fromUtf8("mTitleSpaceBottomSpinBox"))
        self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mTitleSpaceBottomSpinBox)
        self.mainLayout.addWidget(self.mSpacingColGroupBox)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout.addWidget(self.scrollArea)
        self.mTitleLabel.setBuddy(self.mTitleLineEdit)
        self.mOutlineWidthLabel.setBuddy(self.mRasterBorderWidthSpinBox)

        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(self)
        self.setTabOrder(self.scrollArea, self.mMainPropertiesColGroupBox)
        self.setTabOrder(self.mMainPropertiesColGroupBox, self.mTitleLineEdit)
        self.setTabOrder(self.mTitleLineEdit, self.mTitleAlignCombo)
        self.setTabOrder(self.mTitleAlignCombo, self.mMapComboBox)
        self.setTabOrder(self.mMapComboBox, self.mWrapCharLineEdit)
        self.setTabOrder(self.mWrapCharLineEdit, self.mLegendItemColGroupBox)
        self.setTabOrder(self.mLegendItemColGroupBox, self.mCheckBoxAutoUpdate)
        self.setTabOrder(self.mCheckBoxAutoUpdate, self.mUpdateAllPushButton)
        self.setTabOrder(self.mUpdateAllPushButton, self.mItemTreeView)
        self.setTabOrder(self.mItemTreeView, self.mMoveDownToolButton)
        self.setTabOrder(self.mMoveDownToolButton, self.mMoveUpToolButton)
        self.setTabOrder(self.mMoveUpToolButton, self.mAddGroupToolButton)
        self.setTabOrder(self.mAddGroupToolButton, self.mAddToolButton)
        self.setTabOrder(self.mAddToolButton, self.mRemoveToolButton)
        self.setTabOrder(self.mRemoveToolButton, self.mEditPushButton)
        self.setTabOrder(self.mEditPushButton, self.mCountToolButton)
        self.setTabOrder(self.mCountToolButton, self.mFilterByMapToolButton)
        self.setTabOrder(self.mFilterByMapToolButton,
                         self.mExpressionFilterButton)
        self.setTabOrder(self.mExpressionFilterButton,
                         self.mFilterLegendByAtlasCheckBox)
        self.setTabOrder(self.mFilterLegendByAtlasCheckBox,
                         self.mFontsColGroupBox)
        self.setTabOrder(self.mFontsColGroupBox, self.mTitleFontButton)
        self.setTabOrder(self.mTitleFontButton, self.mLayerFontButton)
        self.setTabOrder(self.mLayerFontButton, self.mGroupFontButton)
        self.setTabOrder(self.mGroupFontButton, self.mItemFontButton)
        self.setTabOrder(self.mItemFontButton, self.mFontColorButton)
        self.setTabOrder(self.mFontColorButton, self.mColumnsColGroupBox)
        self.setTabOrder(self.mColumnsColGroupBox, self.mColumnCountSpinBox)
        self.setTabOrder(self.mColumnCountSpinBox,
                         self.mEqualColumnWidthCheckBox)
        self.setTabOrder(self.mEqualColumnWidthCheckBox,
                         self.mSplitLayerCheckBox)
        self.setTabOrder(self.mSplitLayerCheckBox, self.mSymbolsColGroupBox)
        self.setTabOrder(self.mSymbolsColGroupBox, self.mSymbolWidthSpinBox)
        self.setTabOrder(self.mSymbolWidthSpinBox, self.mSymbolHeightSpinBox)
        self.setTabOrder(self.mSymbolHeightSpinBox, self.mRasterBorderGroupBox)
        self.setTabOrder(self.mRasterBorderGroupBox,
                         self.mRasterBorderColorButton)
        self.setTabOrder(self.mRasterBorderColorButton,
                         self.mRasterBorderWidthSpinBox)
        self.setTabOrder(self.mRasterBorderWidthSpinBox,
                         self.mSymbolsColGroupBox_2)
        self.setTabOrder(self.mSymbolsColGroupBox_2,
                         self.mWmsLegendWidthSpinBox)
        self.setTabOrder(self.mWmsLegendWidthSpinBox,
                         self.mWmsLegendHeightSpinBox)
        self.setTabOrder(self.mWmsLegendHeightSpinBox,
                         self.mSpacingColGroupBox)
        self.setTabOrder(self.mSpacingColGroupBox,
                         self.mTitleSpaceBottomSpinBox)
        self.setTabOrder(self.mTitleSpaceBottomSpinBox,
                         self.mGroupSpaceSpinBox)
        self.setTabOrder(self.mGroupSpaceSpinBox, self.mLayerSpaceSpinBox)
        self.setTabOrder(self.mLayerSpaceSpinBox, self.mSymbolSpaceSpinBox)
        self.setTabOrder(self.mSymbolSpaceSpinBox, self.mIconLabelSpaceSpinBox)
        self.setTabOrder(self.mIconLabelSpaceSpinBox, self.mBoxSpaceSpinBox)
        self.setTabOrder(self.mBoxSpaceSpinBox, self.mColumnSpaceSpinBox)
class Ui_QgsComposerLegendWidgetBase(QtGui.QWidget):
    def __init__(self, parent):
        self.setObjectName(_fromUtf8("self"))
        self.resize(393, 995)
        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.label_11 = QtGui.QLabel(self)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.label_11.sizePolicy().hasHeightForWidth())
        self.label_11.setSizePolicy(sizePolicy)
        self.label_11.setStyleSheet(
            _fromUtf8(
                "padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);"
            ))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.verticalLayout.addWidget(self.label_11)
        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setFrameShape(QtGui.QFrame.StyledPanel)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName(_fromUtf8("scrollArea"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(
            0, 0, 375, 1478))
        self.scrollAreaWidgetContents.setObjectName(
            _fromUtf8("scrollAreaWidgetContents"))
        self.mainLayout = QtGui.QVBoxLayout(self.scrollAreaWidgetContents)
        self.mainLayout.setObjectName(_fromUtf8("mainLayout"))
        self.mMainPropertiesColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mMainPropertiesColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mMainPropertiesColGroupBox.setProperty("syncGroup",
                                                    _fromUtf8("composeritem"))
        self.mMainPropertiesColGroupBox.setProperty("collapsed", False)
        self.mMainPropertiesColGroupBox.setObjectName(
            _fromUtf8("mMainPropertiesColGroupBox"))
        self.formLayout = QtGui.QFormLayout(self.mMainPropertiesColGroupBox)
        self.formLayout.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setLabelAlignment(QtCore.Qt.AlignLeading
                                          | QtCore.Qt.AlignLeft
                                          | QtCore.Qt.AlignVCenter)
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.mTitleLabel = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.mTitleLabel.setObjectName(_fromUtf8("mTitleLabel"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
                                  self.mTitleLabel)
        self.mTitleLineEdit = QtGui.QLineEdit(self.mMainPropertiesColGroupBox)
        self.mTitleLineEdit.setObjectName(_fromUtf8("mTitleLineEdit"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
                                  self.mTitleLineEdit)
        self.mMapLabel = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.mMapLabel.setObjectName(_fromUtf8("mMapLabel"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
                                  self.mMapLabel)
        self.mMapComboBox = QtGui.QComboBox(self.mMainPropertiesColGroupBox)
        self.mMapComboBox.setObjectName(_fromUtf8("mMapComboBox"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
                                  self.mMapComboBox)
        self.label = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label)
        self.mWrapCharLineEdit = QtGui.QLineEdit(
            self.mMainPropertiesColGroupBox)
        self.mWrapCharLineEdit.setFrame(True)
        self.mWrapCharLineEdit.setObjectName(_fromUtf8("mWrapCharLineEdit"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
                                  self.mWrapCharLineEdit)
        self.label_15 = QtGui.QLabel(self.mMainPropertiesColGroupBox)
        self.label_15.setObjectName(_fromUtf8("label_15"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
                                  self.label_15)
        self.mTitleAlignCombo = QtGui.QComboBox(
            self.mMainPropertiesColGroupBox)
        self.mTitleAlignCombo.setObjectName(_fromUtf8("mTitleAlignCombo"))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.mTitleAlignCombo.addItem(_fromUtf8(""))
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
                                  self.mTitleAlignCombo)
        self.mainLayout.addWidget(self.mMainPropertiesColGroupBox)
        self.mLegendItemColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mLegendItemColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mLegendItemColGroupBox.setProperty("syncGroup",
                                                _fromUtf8("composeritem"))
        self.mLegendItemColGroupBox.setProperty("collapsed", False)
        self.mLegendItemColGroupBox.setObjectName(
            _fromUtf8("mLegendItemColGroupBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.mLegendItemColGroupBox)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.mCheckBoxAutoUpdate = QtGui.QCheckBox(self.mLegendItemColGroupBox)
        self.mCheckBoxAutoUpdate.setChecked(True)
        self.mCheckBoxAutoUpdate.setObjectName(
            _fromUtf8("mCheckBoxAutoUpdate"))
        self.horizontalLayout.addWidget(self.mCheckBoxAutoUpdate)
        spacerItem = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.mUpdateAllPushButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        self.mUpdateAllPushButton.setObjectName(
            _fromUtf8("mUpdateAllPushButton"))
        self.horizontalLayout.addWidget(self.mUpdateAllPushButton)
        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.mItemTreeView = QgsLayerTreeView(self.mLegendItemColGroupBox)
        self.mItemTreeView.setMinimumSize(QtCore.QSize(0, 250))
        self.mItemTreeView.setSelectionMode(
            QtGui.QAbstractItemView.ContiguousSelection)
        self.mItemTreeView.setHeaderHidden(True)
        self.mItemTreeView.setObjectName(_fromUtf8("mItemTreeView"))
        self.mItemTreeView.header().setVisible(False)
        self.verticalLayout_2.addWidget(self.mItemTreeView)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(3)
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.mMoveDownToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mMoveDownToolButton.sizePolicy().hasHeightForWidth())
        self.mMoveDownToolButton.setSizePolicy(sizePolicy)
        self.mMoveDownToolButton.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionArrowDown.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mMoveDownToolButton.setIcon(icon)
        self.mMoveDownToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mMoveDownToolButton.setObjectName(
            _fromUtf8("mMoveDownToolButton"))
        self.horizontalLayout_2.addWidget(self.mMoveDownToolButton)
        self.mMoveUpToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mMoveUpToolButton.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionArrowUp.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mMoveUpToolButton.setIcon(icon1)
        self.mMoveUpToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mMoveUpToolButton.setObjectName(_fromUtf8("mMoveUpToolButton"))
        self.horizontalLayout_2.addWidget(self.mMoveUpToolButton)
        self.mAddGroupToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionAddGroup.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mAddGroupToolButton.setIcon(icon2)
        self.mAddGroupToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mAddGroupToolButton.setObjectName(
            _fromUtf8("mAddGroupToolButton"))
        self.horizontalLayout_2.addWidget(self.mAddGroupToolButton)
        self.mAddToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mAddToolButton.setText(_fromUtf8(""))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/symbologyAdd.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mAddToolButton.setIcon(icon3)
        self.mAddToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mAddToolButton.setObjectName(_fromUtf8("mAddToolButton"))
        self.horizontalLayout_2.addWidget(self.mAddToolButton)
        self.mRemoveToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mRemoveToolButton.setText(_fromUtf8(""))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/symbologyRemove.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mRemoveToolButton.setIcon(icon4)
        self.mRemoveToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mRemoveToolButton.setObjectName(_fromUtf8("mRemoveToolButton"))
        self.horizontalLayout_2.addWidget(self.mRemoveToolButton)
        self.mEditPushButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mEditPushButton.setText(_fromUtf8(""))
        icon5 = QtGui.QIcon()
        icon5.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/symbologyEdit.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mEditPushButton.setIcon(icon5)
        self.mEditPushButton.setIconSize(QtCore.QSize(20, 20))
        self.mEditPushButton.setObjectName(_fromUtf8("mEditPushButton"))
        self.horizontalLayout_2.addWidget(self.mEditPushButton)
        self.mCountToolButton = QtGui.QToolButton(self.mLegendItemColGroupBox)
        self.mCountToolButton.setEnabled(False)
        self.mCountToolButton.setText(_fromUtf8(""))
        icon6 = QtGui.QIcon()
        icon6.addPixmap(
            QtGui.QPixmap(
                _fromUtf8("Resource/images/themes/default/mActionSum.png")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mCountToolButton.setIcon(icon6)
        self.mCountToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mCountToolButton.setCheckable(True)
        self.mCountToolButton.setObjectName(_fromUtf8("mCountToolButton"))
        self.horizontalLayout_2.addWidget(self.mCountToolButton)
        self.mFilterByMapToolButton = QtGui.QToolButton(
            self.mLegendItemColGroupBox)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mActionFilter2.svg")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mFilterByMapToolButton.setIcon(icon7)
        self.mFilterByMapToolButton.setIconSize(QtCore.QSize(20, 20))
        self.mFilterByMapToolButton.setCheckable(True)
        self.mFilterByMapToolButton.setObjectName(
            _fromUtf8("mFilterByMapToolButton"))
        self.horizontalLayout_2.addWidget(self.mFilterByMapToolButton)
        self.mExpressionFilterButton = QgsLegendFilterButton(
            self.mLegendItemColGroupBox)
        self.mExpressionFilterButton.setText(_fromUtf8(""))
        icon8 = QtGui.QIcon()
        icon8.addPixmap(
            QtGui.QPixmap(
                _fromUtf8(
                    "Resource/images/themes/default/mIconExpressionFilter.svg")
            ), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.mExpressionFilterButton.setIcon(icon8)
        self.mExpressionFilterButton.setIconSize(QtCore.QSize(20, 20))
        self.mExpressionFilterButton.setObjectName(
            _fromUtf8("mExpressionFilterButton"))
        self.horizontalLayout_2.addWidget(self.mExpressionFilterButton)
        spacerItem1 = QtGui.QSpacerItem(0, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)
        self.mFilterLegendByAtlasCheckBox = QtGui.QCheckBox(
            self.mLegendItemColGroupBox)
        self.mFilterLegendByAtlasCheckBox.setObjectName(
            _fromUtf8("mFilterLegendByAtlasCheckBox"))
        self.verticalLayout_2.addWidget(self.mFilterLegendByAtlasCheckBox)
        self.mainLayout.addWidget(self.mLegendItemColGroupBox)
        self.mFontsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mFontsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mFontsColGroupBox.setProperty("syncGroup",
                                           _fromUtf8("composeritem"))
        self.mFontsColGroupBox.setProperty("collapsed", True)
        self.mFontsColGroupBox.setObjectName(_fromUtf8("mFontsColGroupBox"))
        self.verticalLayout_3 = QtGui.QVBoxLayout(self.mFontsColGroupBox)
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.mTitleFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mTitleFontButton.sizePolicy().hasHeightForWidth())
        self.mTitleFontButton.setSizePolicy(sizePolicy)
        self.mTitleFontButton.setObjectName(_fromUtf8("mTitleFontButton"))
        self.verticalLayout_3.addWidget(self.mTitleFontButton)
        self.mLayerFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mLayerFontButton.setObjectName(_fromUtf8("mLayerFontButton"))
        self.verticalLayout_3.addWidget(self.mLayerFontButton)
        self.mGroupFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mGroupFontButton.setObjectName(_fromUtf8("mGroupFontButton"))
        self.verticalLayout_3.addWidget(self.mGroupFontButton)
        self.mItemFontButton = QtGui.QPushButton(self.mFontsColGroupBox)
        self.mItemFontButton.setObjectName(_fromUtf8("mItemFontButton"))
        self.verticalLayout_3.addWidget(self.mItemFontButton)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.label_16 = QtGui.QLabel(self.mFontsColGroupBox)
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.horizontalLayout_3.addWidget(self.label_16)
        self.mFontColorButton = QgsColorButtonV2(self.mFontsColGroupBox)
        self.mFontColorButton.setMinimumSize(QtCore.QSize(120, 0))
        self.mFontColorButton.setMaximumSize(QtCore.QSize(120, 16777215))
        self.mFontColorButton.setText(_fromUtf8(""))
        self.mFontColorButton.setObjectName(_fromUtf8("mFontColorButton"))
        self.horizontalLayout_3.addWidget(self.mFontColorButton)
        spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem2)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.mainLayout.addWidget(self.mFontsColGroupBox)
        self.mColumnsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mColumnsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mColumnsColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mColumnsColGroupBox.setProperty("collapsed", True)
        self.mColumnsColGroupBox.setObjectName(
            _fromUtf8("mColumnsColGroupBox"))
        self.formLayout_2 = QtGui.QFormLayout(self.mColumnsColGroupBox)
        self.formLayout_2.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.label_2 = QtGui.QLabel(self.mColumnsColGroupBox)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_2)
        self.mColumnCountSpinBox = QgsSpinBox(self.mColumnsColGroupBox)
        self.mColumnCountSpinBox.setPrefix(_fromUtf8(""))
        self.mColumnCountSpinBox.setMinimum(1)
        self.mColumnCountSpinBox.setMaximum(1000)
        self.mColumnCountSpinBox.setObjectName(
            _fromUtf8("mColumnCountSpinBox"))
        self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mColumnCountSpinBox)
        self.mEqualColumnWidthCheckBox = QtGui.QCheckBox(
            self.mColumnsColGroupBox)
        self.mEqualColumnWidthCheckBox.setObjectName(
            _fromUtf8("mEqualColumnWidthCheckBox"))
        self.formLayout_2.setWidget(3, QtGui.QFormLayout.SpanningRole,
                                    self.mEqualColumnWidthCheckBox)
        self.mSplitLayerCheckBox = QtGui.QCheckBox(self.mColumnsColGroupBox)
        self.mSplitLayerCheckBox.setObjectName(
            _fromUtf8("mSplitLayerCheckBox"))
        self.formLayout_2.setWidget(4, QtGui.QFormLayout.SpanningRole,
                                    self.mSplitLayerCheckBox)
        self.mainLayout.addWidget(self.mColumnsColGroupBox)
        self.mSymbolsColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSymbolsColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSymbolsColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mSymbolsColGroupBox.setProperty("collapsed", True)
        self.mSymbolsColGroupBox.setObjectName(
            _fromUtf8("mSymbolsColGroupBox"))
        self.formLayout_3 = QtGui.QFormLayout(self.mSymbolsColGroupBox)
        self.formLayout_3.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
        self.label_3 = QtGui.QLabel(self.mSymbolsColGroupBox)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_3)
        self.mSymbolWidthSpinBox = QgsDoubleSpinBox(self.mSymbolsColGroupBox)
        self.mSymbolWidthSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolWidthSpinBox.setProperty("showClearButton", False)
        self.mSymbolWidthSpinBox.setObjectName(
            _fromUtf8("mSymbolWidthSpinBox"))
        self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolWidthSpinBox)
        self.label_4 = QtGui.QLabel(self.mSymbolsColGroupBox)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_4)
        self.mSymbolHeightSpinBox = QgsDoubleSpinBox(self.mSymbolsColGroupBox)
        self.mSymbolHeightSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolHeightSpinBox.setProperty("showClearButton", False)
        self.mSymbolHeightSpinBox.setObjectName(
            _fromUtf8("mSymbolHeightSpinBox"))
        self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolHeightSpinBox)
        self.mRasterBorderGroupBox = QgsCollapsibleGroupBoxBasic(
            self.mSymbolsColGroupBox)
        self.mRasterBorderGroupBox.setCheckable(True)
        self.mRasterBorderGroupBox.setProperty("syncGroup",
                                               _fromUtf8("composeritem"))
        self.mRasterBorderGroupBox.setProperty("collapsed", True)
        self.mRasterBorderGroupBox.setObjectName(
            _fromUtf8("mRasterBorderGroupBox"))
        self.gridLayout = QtGui.QGridLayout(self.mRasterBorderGroupBox)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label_17 = QtGui.QLabel(self.mRasterBorderGroupBox)
        self.label_17.setObjectName(_fromUtf8("label_17"))
        self.gridLayout.addWidget(self.label_17, 0, 0, 1, 1)
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.mRasterBorderColorButton = QgsColorButtonV2(
            self.mRasterBorderGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mRasterBorderColorButton.sizePolicy().hasHeightForWidth())
        self.mRasterBorderColorButton.setSizePolicy(sizePolicy)
        self.mRasterBorderColorButton.setMinimumSize(QtCore.QSize(120, 0))
        self.mRasterBorderColorButton.setMaximumSize(
            QtCore.QSize(120, 16777215))
        self.mRasterBorderColorButton.setText(_fromUtf8(""))
        self.mRasterBorderColorButton.setObjectName(
            _fromUtf8("mRasterBorderColorButton"))
        self.horizontalLayout_6.addWidget(self.mRasterBorderColorButton)
        spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem3)
        self.gridLayout.addLayout(self.horizontalLayout_6, 0, 1, 1, 1)
        self.mOutlineWidthLabel = QtGui.QLabel(self.mRasterBorderGroupBox)
        self.mOutlineWidthLabel.setObjectName(_fromUtf8("mOutlineWidthLabel"))
        self.gridLayout.addWidget(self.mOutlineWidthLabel, 1, 0, 1, 1)
        self.mRasterBorderWidthSpinBox = QgsDoubleSpinBox(
            self.mRasterBorderGroupBox)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mRasterBorderWidthSpinBox.sizePolicy().hasHeightForWidth())
        self.mRasterBorderWidthSpinBox.setSizePolicy(sizePolicy)
        self.mRasterBorderWidthSpinBox.setSingleStep(0.1)
        self.mRasterBorderWidthSpinBox.setProperty("showClearButton", False)
        self.mRasterBorderWidthSpinBox.setObjectName(
            _fromUtf8("mRasterBorderWidthSpinBox"))
        self.gridLayout.addWidget(self.mRasterBorderWidthSpinBox, 1, 1, 1, 1)
        self.formLayout_3.setWidget(2, QtGui.QFormLayout.SpanningRole,
                                    self.mRasterBorderGroupBox)
        self.mainLayout.addWidget(self.mSymbolsColGroupBox)
        self.mSymbolsColGroupBox_2 = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSymbolsColGroupBox_2.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSymbolsColGroupBox_2.setProperty("syncGroup",
                                               _fromUtf8("composeritem"))
        self.mSymbolsColGroupBox_2.setProperty("collapsed", True)
        self.mSymbolsColGroupBox_2.setObjectName(
            _fromUtf8("mSymbolsColGroupBox_2"))
        self.formLayout_5 = QtGui.QFormLayout(self.mSymbolsColGroupBox_2)
        self.formLayout_5.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_5.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_5.setObjectName(_fromUtf8("formLayout_5"))
        self.label_13 = QtGui.QLabel(self.mSymbolsColGroupBox_2)
        self.label_13.setObjectName(_fromUtf8("label_13"))
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_13)
        self.mWmsLegendWidthSpinBox = QgsDoubleSpinBox(
            self.mSymbolsColGroupBox_2)
        self.mWmsLegendWidthSpinBox.setPrefix(_fromUtf8(""))
        self.mWmsLegendWidthSpinBox.setMaximum(9999.0)
        self.mWmsLegendWidthSpinBox.setProperty("showClearButton", False)
        self.mWmsLegendWidthSpinBox.setObjectName(
            _fromUtf8("mWmsLegendWidthSpinBox"))
        self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mWmsLegendWidthSpinBox)
        self.label_14 = QtGui.QLabel(self.mSymbolsColGroupBox_2)
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_14)
        self.mWmsLegendHeightSpinBox = QgsDoubleSpinBox(
            self.mSymbolsColGroupBox_2)
        self.mWmsLegendHeightSpinBox.setPrefix(_fromUtf8(""))
        self.mWmsLegendHeightSpinBox.setMaximum(9999.0)
        self.mWmsLegendHeightSpinBox.setProperty("showClearButton", False)
        self.mWmsLegendHeightSpinBox.setObjectName(
            _fromUtf8("mWmsLegendHeightSpinBox"))
        self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mWmsLegendHeightSpinBox)
        self.mainLayout.addWidget(self.mSymbolsColGroupBox_2)
        self.mSpacingColGroupBox = QgsCollapsibleGroupBoxBasic(
            self.scrollAreaWidgetContents)
        self.mSpacingColGroupBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.mSpacingColGroupBox.setProperty("syncGroup",
                                             _fromUtf8("composeritem"))
        self.mSpacingColGroupBox.setProperty("collapsed", True)
        self.mSpacingColGroupBox.setObjectName(
            _fromUtf8("mSpacingColGroupBox"))
        self.formLayout_4 = QtGui.QFormLayout(self.mSpacingColGroupBox)
        self.formLayout_4.setFieldGrowthPolicy(
            QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_4.setLabelAlignment(QtCore.Qt.AlignLeading
                                            | QtCore.Qt.AlignLeft
                                            | QtCore.Qt.AlignVCenter)
        self.formLayout_4.setObjectName(_fromUtf8("formLayout_4"))
        self.label_5 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole,
                                    self.label_5)
        self.mGroupSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mGroupSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mGroupSpaceSpinBox.setObjectName(_fromUtf8("mGroupSpaceSpinBox"))
        self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole,
                                    self.mGroupSpaceSpinBox)
        self.label_6 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole,
                                    self.label_6)
        self.mLayerSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mLayerSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mLayerSpaceSpinBox.setObjectName(_fromUtf8("mLayerSpaceSpinBox"))
        self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole,
                                    self.mLayerSpaceSpinBox)
        self.label_7 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.formLayout_4.setWidget(3, QtGui.QFormLayout.LabelRole,
                                    self.label_7)
        self.mSymbolSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mSymbolSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mSymbolSpaceSpinBox.setObjectName(
            _fromUtf8("mSymbolSpaceSpinBox"))
        self.formLayout_4.setWidget(3, QtGui.QFormLayout.FieldRole,
                                    self.mSymbolSpaceSpinBox)
        self.label_8 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout_4.setWidget(4, QtGui.QFormLayout.LabelRole,
                                    self.label_8)
        self.mIconLabelSpaceSpinBox = QgsDoubleSpinBox(
            self.mSpacingColGroupBox)
        self.mIconLabelSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mIconLabelSpaceSpinBox.setObjectName(
            _fromUtf8("mIconLabelSpaceSpinBox"))
        self.formLayout_4.setWidget(4, QtGui.QFormLayout.FieldRole,
                                    self.mIconLabelSpaceSpinBox)
        self.label_9 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.formLayout_4.setWidget(5, QtGui.QFormLayout.LabelRole,
                                    self.label_9)
        self.mBoxSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mBoxSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mBoxSpaceSpinBox.setObjectName(_fromUtf8("mBoxSpaceSpinBox"))
        self.formLayout_4.setWidget(5, QtGui.QFormLayout.FieldRole,
                                    self.mBoxSpaceSpinBox)
        self.label_12 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.formLayout_4.setWidget(6, QtGui.QFormLayout.LabelRole,
                                    self.label_12)
        self.mColumnSpaceSpinBox = QgsDoubleSpinBox(self.mSpacingColGroupBox)
        self.mColumnSpaceSpinBox.setPrefix(_fromUtf8(""))
        self.mColumnSpaceSpinBox.setObjectName(
            _fromUtf8("mColumnSpaceSpinBox"))
        self.formLayout_4.setWidget(6, QtGui.QFormLayout.FieldRole,
                                    self.mColumnSpaceSpinBox)
        self.label_10 = QtGui.QLabel(self.mSpacingColGroupBox)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole,
                                    self.label_10)
        self.mTitleSpaceBottomSpinBox = QgsDoubleSpinBox(
            self.mSpacingColGroupBox)
        self.mTitleSpaceBottomSpinBox.setObjectName(
            _fromUtf8("mTitleSpaceBottomSpinBox"))
        self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole,
                                    self.mTitleSpaceBottomSpinBox)
        self.mainLayout.addWidget(self.mSpacingColGroupBox)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout.addWidget(self.scrollArea)
        self.mTitleLabel.setBuddy(self.mTitleLineEdit)
        self.mOutlineWidthLabel.setBuddy(self.mRasterBorderWidthSpinBox)

        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(self)
        self.setTabOrder(self.scrollArea, self.mMainPropertiesColGroupBox)
        self.setTabOrder(self.mMainPropertiesColGroupBox, self.mTitleLineEdit)
        self.setTabOrder(self.mTitleLineEdit, self.mTitleAlignCombo)
        self.setTabOrder(self.mTitleAlignCombo, self.mMapComboBox)
        self.setTabOrder(self.mMapComboBox, self.mWrapCharLineEdit)
        self.setTabOrder(self.mWrapCharLineEdit, self.mLegendItemColGroupBox)
        self.setTabOrder(self.mLegendItemColGroupBox, self.mCheckBoxAutoUpdate)
        self.setTabOrder(self.mCheckBoxAutoUpdate, self.mUpdateAllPushButton)
        self.setTabOrder(self.mUpdateAllPushButton, self.mItemTreeView)
        self.setTabOrder(self.mItemTreeView, self.mMoveDownToolButton)
        self.setTabOrder(self.mMoveDownToolButton, self.mMoveUpToolButton)
        self.setTabOrder(self.mMoveUpToolButton, self.mAddGroupToolButton)
        self.setTabOrder(self.mAddGroupToolButton, self.mAddToolButton)
        self.setTabOrder(self.mAddToolButton, self.mRemoveToolButton)
        self.setTabOrder(self.mRemoveToolButton, self.mEditPushButton)
        self.setTabOrder(self.mEditPushButton, self.mCountToolButton)
        self.setTabOrder(self.mCountToolButton, self.mFilterByMapToolButton)
        self.setTabOrder(self.mFilterByMapToolButton,
                         self.mExpressionFilterButton)
        self.setTabOrder(self.mExpressionFilterButton,
                         self.mFilterLegendByAtlasCheckBox)
        self.setTabOrder(self.mFilterLegendByAtlasCheckBox,
                         self.mFontsColGroupBox)
        self.setTabOrder(self.mFontsColGroupBox, self.mTitleFontButton)
        self.setTabOrder(self.mTitleFontButton, self.mLayerFontButton)
        self.setTabOrder(self.mLayerFontButton, self.mGroupFontButton)
        self.setTabOrder(self.mGroupFontButton, self.mItemFontButton)
        self.setTabOrder(self.mItemFontButton, self.mFontColorButton)
        self.setTabOrder(self.mFontColorButton, self.mColumnsColGroupBox)
        self.setTabOrder(self.mColumnsColGroupBox, self.mColumnCountSpinBox)
        self.setTabOrder(self.mColumnCountSpinBox,
                         self.mEqualColumnWidthCheckBox)
        self.setTabOrder(self.mEqualColumnWidthCheckBox,
                         self.mSplitLayerCheckBox)
        self.setTabOrder(self.mSplitLayerCheckBox, self.mSymbolsColGroupBox)
        self.setTabOrder(self.mSymbolsColGroupBox, self.mSymbolWidthSpinBox)
        self.setTabOrder(self.mSymbolWidthSpinBox, self.mSymbolHeightSpinBox)
        self.setTabOrder(self.mSymbolHeightSpinBox, self.mRasterBorderGroupBox)
        self.setTabOrder(self.mRasterBorderGroupBox,
                         self.mRasterBorderColorButton)
        self.setTabOrder(self.mRasterBorderColorButton,
                         self.mRasterBorderWidthSpinBox)
        self.setTabOrder(self.mRasterBorderWidthSpinBox,
                         self.mSymbolsColGroupBox_2)
        self.setTabOrder(self.mSymbolsColGroupBox_2,
                         self.mWmsLegendWidthSpinBox)
        self.setTabOrder(self.mWmsLegendWidthSpinBox,
                         self.mWmsLegendHeightSpinBox)
        self.setTabOrder(self.mWmsLegendHeightSpinBox,
                         self.mSpacingColGroupBox)
        self.setTabOrder(self.mSpacingColGroupBox,
                         self.mTitleSpaceBottomSpinBox)
        self.setTabOrder(self.mTitleSpaceBottomSpinBox,
                         self.mGroupSpaceSpinBox)
        self.setTabOrder(self.mGroupSpaceSpinBox, self.mLayerSpaceSpinBox)
        self.setTabOrder(self.mLayerSpaceSpinBox, self.mSymbolSpaceSpinBox)
        self.setTabOrder(self.mSymbolSpaceSpinBox, self.mIconLabelSpaceSpinBox)
        self.setTabOrder(self.mIconLabelSpaceSpinBox, self.mBoxSpaceSpinBox)
        self.setTabOrder(self.mBoxSpaceSpinBox, self.mColumnSpaceSpinBox)

    def retranslateUi(self):
        self.setWindowTitle(
            _translate("QgsComposerLegendWidgetBase", "Legend Options", None))
        self.label_11.setText(
            _translate("QgsComposerLegendWidgetBase", "Legend", None))
        self.mMainPropertiesColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Main properties", None))
        self.mTitleLabel.setText(
            _translate("QgsComposerLegendWidgetBase", "&Title", None))
        self.mMapLabel.setText(
            _translate("QgsComposerLegendWidgetBase", "Map", None))
        self.label.setText(
            _translate("QgsComposerLegendWidgetBase", "Wrap text on", None))
        self.label_15.setText(
            _translate("QgsComposerLegendWidgetBase", "Title alignment:",
                       None))
        self.mTitleAlignCombo.setItemText(
            0, _translate("QgsComposerLegendWidgetBase", "Left", None))
        self.mTitleAlignCombo.setItemText(
            1, _translate("QgsComposerLegendWidgetBase", "Center", None))
        self.mTitleAlignCombo.setItemText(
            2, _translate("QgsComposerLegendWidgetBase", "Right", None))
        self.mLegendItemColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Legend items", None))
        self.mCheckBoxAutoUpdate.setText(
            _translate("QgsComposerLegendWidgetBase", "Auto update", None))
        self.mUpdateAllPushButton.setToolTip(
            _translate(
                "QgsComposerLegendWidgetBase",
                "Update whole legend. Layers are added/removed according to main application legend. User defined labels will be deleted.",
                None))
        self.mUpdateAllPushButton.setText(
            _translate("QgsComposerLegendWidgetBase", "Update all", None))
        self.mAddGroupToolButton.setToolTip(
            _translate("QgsComposerLegendWidgetBase", "Add group", None))
        self.mAddGroupToolButton.setText(
            _translate("QgsComposerLegendWidgetBase", "...", None))
        self.mCountToolButton.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Show feature count for each class of vector layer.",
                       None))
        self.mFilterByMapToolButton.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Filter Legend By Map Content", None))
        self.mFilterLegendByAtlasCheckBox.setToolTip(
            _translate(
                "QgsComposerLegendWidgetBase",
                "Filter out legend elements that lie outside the current atlas feature.",
                None))
        self.mFilterLegendByAtlasCheckBox.setText(
            _translate("QgsComposerLegendWidgetBase",
                       "Only show items inside current atlas feature", None))
        self.mFontsColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Fonts", None))
        self.mTitleFontButton.setText(
            _translate("QgsComposerLegendWidgetBase", "Title font...", None))
        self.mLayerFontButton.setText(
            _translate("QgsComposerLegendWidgetBase", "Subgroup font...",
                       None))
        self.mGroupFontButton.setText(
            _translate("QgsComposerLegendWidgetBase", "Group font...", None))
        self.mItemFontButton.setText(
            _translate("QgsComposerLegendWidgetBase", "Item font...", None))
        self.label_16.setText(
            _translate("QgsComposerLegendWidgetBase", "Font color", None))
        self.mColumnsColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Columns", None))
        self.label_2.setText(
            _translate("QgsComposerLegendWidgetBase", "Count", None))
        self.mEqualColumnWidthCheckBox.setText(
            _translate("QgsComposerLegendWidgetBase", "Equal column widths",
                       None))
        self.mSplitLayerCheckBox.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Allow splitting layer items into multiple columns.",
                       None))
        self.mSplitLayerCheckBox.setText(
            _translate("QgsComposerLegendWidgetBase", "Split layers", None))
        self.mSymbolsColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Symbol", None))
        self.label_3.setText(
            _translate("QgsComposerLegendWidgetBase", "Symbol width", None))
        self.mSymbolWidthSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_4.setText(
            _translate("QgsComposerLegendWidgetBase", "Symbol height", None))
        self.mSymbolHeightSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.mRasterBorderGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase",
                       "Draw border for raster symbols", None))
        self.label_17.setText(
            _translate("QgsComposerLegendWidgetBase", "Border color", None))
        self.mOutlineWidthLabel.setText(
            _translate("QgsComposerLegendWidgetBase", "Thickness", None))
        self.mRasterBorderWidthSpinBox.setSpecialValueText(
            _translate("QgsComposerLegendWidgetBase", "Hairline", None))
        self.mRasterBorderWidthSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.mSymbolsColGroupBox_2.setTitle(
            _translate("QgsComposerLegendWidgetBase", "WMS LegendGraphic",
                       None))
        self.label_13.setText(
            _translate("QgsComposerLegendWidgetBase", "Legend width", None))
        self.mWmsLegendWidthSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_14.setText(
            _translate("QgsComposerLegendWidgetBase", "Legend height", None))
        self.mWmsLegendHeightSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.mSpacingColGroupBox.setTitle(
            _translate("QgsComposerLegendWidgetBase", "Spacing", None))
        self.label_5.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Space above text using group style.", None))
        self.label_5.setText(
            _translate("QgsComposerLegendWidgetBase", "Group Space", None))
        self.mGroupSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_6.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Space above text using subgroup style.", None))
        self.label_6.setText(
            _translate("QgsComposerLegendWidgetBase", "Subgroup space", None))
        self.mLayerSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_7.setToolTip(
            _translate("QgsComposerLegendWidgetBase",
                       "Space above symbol and symbol label.", None))
        self.label_7.setText(
            _translate("QgsComposerLegendWidgetBase", "Symbol space", None))
        self.mSymbolSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_8.setToolTip(
            _translate(
                "QgsComposerLegendWidgetBase",
                "Space between symbol icon and symbol label (symbol label left margin).",
                None))
        self.label_8.setText(
            _translate("QgsComposerLegendWidgetBase", "Icon label space",
                       None))
        self.mIconLabelSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_9.setText(
            _translate("QgsComposerLegendWidgetBase", "Box space", None))
        self.mBoxSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_12.setText(
            _translate("QgsComposerLegendWidgetBase", "Column space", None))
        self.mColumnSpaceSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
        self.label_10.setToolTip(
            _translate("QgsComposerLegendWidgetBase", "Space below title.",
                       None))
        self.label_10.setText(
            _translate("QgsComposerLegendWidgetBase", "Title space", None))
        self.mTitleSpaceBottomSpinBox.setToolTip(
            _translate("QgsComposerLegendWidgetBase", "Space below title.",
                       None))
        self.mTitleSpaceBottomSpinBox.setSuffix(
            _translate("QgsComposerLegendWidgetBase", " mm", None))
class AuxiliaryLegend(QDockWidget):

    currentLayerChanged = pyqtSignal("QgsMapLayer")
    currentLayerQgis = pyqtSignal("QgsMapLayer")
    syncGroupLayer = pyqtSignal()
    addSelectedLayersQgis = pyqtSignal()
    removeLayer = pyqtSignal("QgsMapLayer")
    needSelectLayer = pyqtSignal()
    closed = pyqtSignal()

    def __init__(self, parent, numWin):
        def setTreeView():
            def setModel():
                self.model = QgsLayerTreeModel(ltg)
                self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
                self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility,
                                   True)
                self.tview.setModel(self.model)

            self.tview = QgsLayerTreeView(self)
            self.tview.setSelectionMode(QAbstractItemView.ExtendedSelection)
            setModel()
            self.tview.currentLayerChanged.connect(
                self.currentLayerChanged.emit)

        def setupUi():
            self.setAllowedAreas(Qt.LeftDockWidgetArea)
            winLegend.setWindowFlags(Qt.Widget)
            toolBar.setFloatable(False)
            toolBar.setMovable(False)
            winLegend.addToolBar(toolBar)
            self.setWidget(winLegend)

        def addActions():
            actn = QAction(winLegend)
            actn.setIcon(qgis.utils.iface.actionShowSelectedLayers().icon())
            actn.setIconText('Show selected layers')
            actn.setObjectName('showLayer')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

            actn = QAction(winLegend)
            actn.setIcon(qgis.utils.iface.actionHideSelectedLayers().icon())
            actn.setIconText('Hide selected layers')
            actn.setObjectName('hideLayer')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

            actn = QAction(winLegend)
            actn.setIcon(qgis.utils.iface.actionRemoveLayer().icon())
            actn.setIconText('Remove selected layers')
            actn.setObjectName('removeLayer')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

            toolBar.addSeparator()

            actn = QAction(winLegend)
            actn.setIcon(qgis.utils.iface.actionDuplicateLayer().icon())
            actn.setIconText('Add selected layers from main map')
            actn.setObjectName('addLayer')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

            actn = QAction(winLegend)
            actn.setIcon(
                QIcon(
                    os.path.join(os.path.dirname(__file__),
                                 'mActionCurrentLayer.png')))
            actn.setIconText('Current layer for main map')
            actn.setObjectName('currentLayer')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

            actn = QAction(winLegend)
            actn.setIcon(
                QIcon(
                    os.path.join(os.path.dirname(__file__),
                                 'mActionAddGroup.png')))
            actn.setObjectName('syncGroup')
            actn.triggered.connect(self.onAction)
            toolBar.addAction(actn)

        super(AuxiliaryLegend, self).__init__("#%d - Layers" % numWin, parent)

        ltg = parent.ltg
        self.tview = self.model = self.bridge = None
        self.textSync = "Sync with group(main map) for new layers"
        self.actSync = None
        setTreeView()

        winLegend = QMainWindow(self)
        toolBar = QToolBar(winLegend)
        setupUi()
        addActions()
        self.addNameSyncGroup("None")
        winLegend.setCentralWidget(self.tview)

    def addNameSyncGroup(self, name):
        act = self.findChild(QAction, 'syncGroup')
        text = "%s -> %s" % (self.textSync, name)
        act.setIconText(text)

    def setBridge(self, canvas):
        ltg = self.model.rootGroup()
        self.bridge = QgsLayerTreeMapCanvasBridge(
            ltg, canvas)  # Need wait populate ltg

    def clearBridge(self):
        if not self.bridge is None:
            self.bridge.clear()

    def closeEvent(self, event):
        event.accept()
        self.closed.emit()

    @pyqtSlot()
    def onAction(self):
        nameSender = self.sender().objectName()

        if nameSender in ('showLayer', 'hideLayer', 'removeLayer'):
            nodes = self.tview.selectedLayerNodes()
            if len(nodes) == 0:
                self.needSelectLayer.emit()
                return

            if nameSender in ('showLayer', 'hideLayer'):
                checked = Qt.Checked if nameSender == 'showLayer' else Qt.Unchecked
                map(lambda item: item.setVisible(checked), nodes)
            else:
                ltg = self.model.rootGroup()
                for node in nodes:
                    self.removeLayer.emit(node.layer())
                    ltg.removeChildNode(node)

        # addLayer, currentLayer
        else:
            if nameSender == 'addLayer':
                self.addSelectedLayersQgis.emit()
            elif nameSender == 'currentLayer':
                self.currentLayerQgis.emit(self.tview.currentLayer())
            else:
                self.syncGroupLayer.emit()
Пример #16
0
    def testSetCurrentLayer(self):

        view = QgsLayerTreeView()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        current_layer_changed_spy = QSignalSpy(view.currentLayerChanged)
        self.assertFalse(view.currentLayer())
        view.setCurrentLayer(self.layer3)
        self.assertEqual(view.currentLayer(), self.layer3)
        self.assertEqual(len(current_layer_changed_spy), 1)
        view.setCurrentLayer(self.layer)
        self.assertEqual(view.currentLayer(), self.layer)
        self.assertEqual(len(current_layer_changed_spy), 2)
        view.setCurrentLayer(None)
        self.assertFalse(view.currentLayer())
        self.assertEqual(len(current_layer_changed_spy), 3)
Пример #17
0
# coding: utf-8
from qgis.core import QgsProject, QgsLayerTreeModel
from qgis.gui import QgsLayerTreeView

root = QgsProject.instance().layerTreeRoot()
model = QgsLayerTreeModel(root)
view = QgsLayerTreeView()
view.setModel(model)
view.show()
Пример #18
0
    def testAddGroupActionGroups(self):
        """Test add group action on several groups"""

        view = QgsLayerTreeView()
        group = self.project.layerTreeRoot().insertGroup(0, "embeddedgroup")
        group.addLayer(self.layer4)
        groupname = group.name()
        group2 = self.project.layerTreeRoot().insertGroup(0, "embeddedgroup2")
        group2.addLayer(self.layer5)
        groupname2 = group2.name()

        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                groupname2,
                groupname2 + '-' + self.layer5.name(),
                groupname,
                groupname + '-' + self.layer4.name(),
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
            ])

        selectionMode = view.selectionMode()
        view.setSelectionMode(QgsLayerTreeView.MultiSelection)
        nodeLayerIndex = view.node2index(group)
        view.setCurrentIndex(nodeLayerIndex)
        nodeLayerIndex2 = view.node2index(group2)
        view.setCurrentIndex(nodeLayerIndex2)
        view.setSelectionMode(selectionMode)

        addgroup = actions.actionAddGroup()
        addgroup.trigger()
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                self.groupname + '1', self.groupname + '1' + '-' + groupname,
                self.groupname + '1' + '-' + groupname + '-' +
                self.layer4.name(), self.groupname + '1' + '-' + groupname2,
                self.groupname + '1' + '-' + groupname2 + '-' +
                self.layer5.name(),
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name()
            ])
Пример #19
0
class Window(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(Window, self).__init__()
        self.setupUi(self)

        self.layers = []

        # ---------初始化图层和画布----------
        self.vl = QVBoxLayout(self.dockWidgetContents)
        self.layer_tree_view = QgsLayerTreeView(self)
        self.vl.addWidget(self.layer_tree_view)
        self.hl = QHBoxLayout(self.frame)
        self.mapCanvas = QgsMapCanvas(self.frame)
        self.hl.addWidget(self.mapCanvas)
        # ---------初始化图层和画布----------

        self.action_open.triggered.connect(self.action_open_triggered)

        # 建立桥梁
        self.model = QgsLayerTreeModel(QgsProject.instance().layerTreeRoot(),
                                       self)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        self.model.setFlag(QgsLayerTreeModel.ShowLegendAsTree)
        self.model.setAutoCollapseLegendNodes(10)
        self.layer_tree_view.setModel(self.model)
        self.layer_tree_bridge = QgsLayerTreeMapCanvasBridge(
            QgsProject.instance().layerTreeRoot(), self.mapCanvas)

        # 设置识别工具
        self.identifyTool = QgsMapToolIdentifyFeature(self.mapCanvas)
        # 发送识别的要素
        self.identifyTool.featureIdentified.connect(self.print_features)
        self.mapCanvas.setMapTool(self.identifyTool)

    def action_open_triggered(self):
        data_file, ext = QFileDialog.getOpenFileName(self, '打开', '', '所有文件(*)')
        if data_file:
            if data_file.endswith('.shp'):
                basename = os.path.splitext(os.path.basename(data_file))[0]
                layer = QgsVectorLayer(data_file, basename, "ogr")
                QgsProject.instance().addMapLayer(layer)
                self.layers.append(layer)
                self.mapCanvas.setExtent(layer.extent())
                self.mapCanvas.setLayers(self.layers)
                self.mapCanvas.refresh()
                self.layer_tree_view.setCurrentLayer(layer)

                # 设置需要识别的图层
                self.identifyTool.setLayer(layer)

            elif data_file.endswith('.qgz') or data_file.endswith('.qgs'):
                QgsProject.instance().read(data_file)
            else:
                print('error')

    def print_features(self, feature):
        print(feature.attributes())
        print(feature.fields())
        print(feature.geometry())
 def testSetCurrentLayer(self):
     view = QgsLayerTreeView()
     view.setModel(self.model)
     current_layer_changed_spy = QSignalSpy(view.currentLayerChanged)
     self.assertFalse(view.currentLayer())
     view.setCurrentLayer(self.layer3)
     self.assertEqual(view.currentLayer(), self.layer3)
     self.assertEqual(len(current_layer_changed_spy), 1)
     view.setCurrentLayer(self.layer)
     self.assertEqual(view.currentLayer(), self.layer)
     self.assertEqual(len(current_layer_changed_spy), 2)
     view.setCurrentLayer(None)
     self.assertFalse(view.currentLayer())
     self.assertEqual(len(current_layer_changed_spy), 3)
Пример #21
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        self.first_flag = True
        self.setWindowTitle('PyQGIS')
        # 调整窗口大小
        self.resize(800, 600)
        # 初始化图层树
        vl = QVBoxLayout(self.dockWidgetContents)
        self.layerTreeView = QgsLayerTreeView(self)
        vl.addWidget(self.layerTreeView)
        # 初始化地图画布
        self.mapCanvas = QgsMapCanvas(self)
        hl = QHBoxLayout(self.frame)
        hl.setContentsMargins(0, 0, 0, 0)
        hl.addWidget(self.mapCanvas)

        # 建立桥梁
        self.model = QgsLayerTreeModel(PROJECT.layerTreeRoot(), self)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        self.model.setFlag(QgsLayerTreeModel.ShowLegendAsTree)
        self.model.setAutoCollapseLegendNodes(10)
        self.layerTreeView.setModel(self.model)
        self.layerTreeBridge = QgsLayerTreeMapCanvasBridge(
            PROJECT.layerTreeRoot(), self.mapCanvas, self)
        # 显示经纬度
        self.mapCanvas.xyCoordinates.connect(self.showLngLat)

        # 打开工程
        self.actionOpen.triggered.connect(self.actionOpenTriggered)
        # 退出程序
        self.actionQuit.triggered.connect(self.close)

        # 地图工具
        # TODO:放大、缩小没有图标
        self.actionPanTriggered()
        self.actionPan.triggered.connect(self.actionPanTriggered)
        self.actionZoomin.triggered.connect(self.actionZoomInTriggered)
        self.actionZoomout.triggered.connect(self.actionZoomOutTriggered)
        self.actionIdentity.triggered.connect(self.actionIdentifyTriggered)

        # 图层
        self.actionShapefile.triggered.connect(self.actionShapefileTriggered)
        self.actionCsv.triggered.connect(self.actionCsvTriggered)
        self.actionPostGIS.triggered.connect(self.actionPostGISTriggered)
        self.actionWFS.triggered.connect(self.actionWFSTriggered)

        self.actionGeotiff.triggered.connect(self.actionGeotiffTriggered)
        self.actionXYZ.triggered.connect(self.actionXYZTriggered)

        # 绘图工具
        self.actionPoint.triggered.connect(self.actionPointTriggered)
        self.actionLine.triggered.connect(self.actionLineTriggered)
        self.actionRectangle.triggered.connect(self.actionRectangleTriggered)
        self.actionPolygon.triggered.connect(self.actionPolygonTriggered)

        # 关于Qt
        self.actionAboutQt.triggered.connect(
            lambda: QMessageBox.aboutQt(self, '关于Qt'))
        self.actionAbout.triggered.connect(
            lambda: QMessageBox.about(self, '关于', 'PyQGIS二次开发'))

        # self.actionPan.triggered.connect(self.actionPanTriggered)
        # self.actionIdentify.triggered.connect(self.actionIdentifyTriggered)

        # 图层右键菜单
        self.customMenuProvider = CustomMenuProvider(self.layerTreeView,
                                                     self.mapCanvas)
        self.layerTreeView.setMenuProvider(self.customMenuProvider)
Пример #22
0
class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        self.first_flag = True
        self.setWindowTitle('PyQGIS')
        # 调整窗口大小
        self.resize(800, 600)
        # 初始化图层树
        vl = QVBoxLayout(self.dockWidgetContents)
        self.layerTreeView = QgsLayerTreeView(self)
        vl.addWidget(self.layerTreeView)
        # 初始化地图画布
        self.mapCanvas = QgsMapCanvas(self)
        hl = QHBoxLayout(self.frame)
        hl.setContentsMargins(0, 0, 0, 0)
        hl.addWidget(self.mapCanvas)

        # 建立桥梁
        self.model = QgsLayerTreeModel(PROJECT.layerTreeRoot(), self)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        self.model.setFlag(QgsLayerTreeModel.ShowLegendAsTree)
        self.model.setAutoCollapseLegendNodes(10)
        self.layerTreeView.setModel(self.model)
        self.layerTreeBridge = QgsLayerTreeMapCanvasBridge(
            PROJECT.layerTreeRoot(), self.mapCanvas, self)
        # 显示经纬度
        self.mapCanvas.xyCoordinates.connect(self.showLngLat)

        # 打开工程
        self.actionOpen.triggered.connect(self.actionOpenTriggered)
        # 退出程序
        self.actionQuit.triggered.connect(self.close)

        # 地图工具
        # TODO:放大、缩小没有图标
        self.actionPanTriggered()
        self.actionPan.triggered.connect(self.actionPanTriggered)
        self.actionZoomin.triggered.connect(self.actionZoomInTriggered)
        self.actionZoomout.triggered.connect(self.actionZoomOutTriggered)
        self.actionIdentity.triggered.connect(self.actionIdentifyTriggered)

        # 图层
        self.actionShapefile.triggered.connect(self.actionShapefileTriggered)
        self.actionCsv.triggered.connect(self.actionCsvTriggered)
        self.actionPostGIS.triggered.connect(self.actionPostGISTriggered)
        self.actionWFS.triggered.connect(self.actionWFSTriggered)

        self.actionGeotiff.triggered.connect(self.actionGeotiffTriggered)
        self.actionXYZ.triggered.connect(self.actionXYZTriggered)

        # 绘图工具
        self.actionPoint.triggered.connect(self.actionPointTriggered)
        self.actionLine.triggered.connect(self.actionLineTriggered)
        self.actionRectangle.triggered.connect(self.actionRectangleTriggered)
        self.actionPolygon.triggered.connect(self.actionPolygonTriggered)

        # 关于Qt
        self.actionAboutQt.triggered.connect(
            lambda: QMessageBox.aboutQt(self, '关于Qt'))
        self.actionAbout.triggered.connect(
            lambda: QMessageBox.about(self, '关于', 'PyQGIS二次开发'))

        # self.actionPan.triggered.connect(self.actionPanTriggered)
        # self.actionIdentify.triggered.connect(self.actionIdentifyTriggered)

        # 图层右键菜单
        self.customMenuProvider = CustomMenuProvider(self.layerTreeView,
                                                     self.mapCanvas)
        self.layerTreeView.setMenuProvider(self.customMenuProvider)
        # self.layerTreeRegistryBridge = QgsLayerTreeRegistryBridge(PROJECT.layerTreeRoot(), PROJECT, self)

    def actionOpenTriggered(self):
        """打开工程"""
        data_file, ext = QFileDialog.getOpenFileName(self, '打开', '',
                                                     '工程文件(*.qgs , *.qgz)')
        if data_file:
            PROJECT.read(data_file)

    def actionPanTriggered(self):
        self.mapTool = QgsMapToolPan(self.mapCanvas)
        self.mapCanvas.setMapTool(self.mapTool)

    def actionZoomInTriggered(self):
        self.mapTool = QgsMapToolZoom(self.mapCanvas, False)
        self.mapCanvas.setMapTool(self.mapTool)

    def actionZoomOutTriggered(self):
        self.mapTool = QgsMapToolZoom(self.mapCanvas, True)
        self.mapCanvas.setMapTool(self.mapTool)

    def actionIdentifyTriggered(self):
        # 设置识别工具
        self.identifyTool = QgsMapToolIdentifyFeature(self.mapCanvas)
        self.identifyTool.featureIdentified.connect(self.showFeatures)
        self.mapCanvas.setMapTool(self.identifyTool)

        # 设置需要识别的图层
        layers = self.mapCanvas.layers()
        if layers:
            # 识别画布中第一个图层
            self.identifyTool.setLayer(layers[0])

    def showFeatures(self, feature):
        print(type(feature))

        QMessageBox.information(self, '信息', ''.join(feature.attributes()))

    def actionAddGroupTriggered(self):
        PROJECT.layerTreeRoot().addGroup('group1')

    def actionShapefileTriggered(self):
        """打开shp"""
        data_file, ext = QFileDialog.getOpenFileName(self, '打开', '', '*.shp')
        if data_file:
            layer = QgsVectorLayer(
                data_file,
                os.path.splitext(os.path.basename(data_file))[0], "ogr")
            self.addLayer(layer)

    def actionCsvTriggered(self):
        """加载csv数据"""
        data_file, ext = QFileDialog.getOpenFileName(self, '打开', '', '*.csv')
        if data_file:
            # 去掉盘符,否则图层无效
            data_file = os.path.splitdrive(data_file)[1]
            uri = f"file://{data_file}?delimiter=,&xField=x&yField=y"
            print(uri)
            layer = QgsVectorLayer(uri, "point", "delimitedtext")
            self.addLayer(layer)

    def actionPostGISTriggered(self):
        """加载postgis图层"""
        dialog = PostGISDialog(self)
        if dialog.exec_():
            uri = QgsDataSourceUri()
            uri.setConnection(dialog.lineEditHost.text(),
                              dialog.lineEditPort.text(),
                              dialog.lineEditDatabase.text(),
                              dialog.lineEditUsername.text(),
                              dialog.lineEditPassword.text())
            # lineEditGeometryColumn:根据实际情况,可能为:wkb_geometry、geometry、the_geom...
            uri.setDataSource("public", dialog.lineEditLayer.text(),
                              dialog.lineEditGeometryColumn.text())

            layer = QgsVectorLayer(uri.uri(False), dialog.lineEditLayer.text(),
                                   "postgres")
            self.addLayer(layer)

    def actionWFSTriggered(self):
        """加载天地图WFS图层"""
        uri = 'http://gisserver.tianditu.gov.cn/TDTService/wfs?' \
              'srsname=EPSG:4326&typename=TDTService:RESA&version=auto&request=GetFeature&service=WFS'
        layer = QgsVectorLayer(uri, "RESA", "WFS")
        self.addLayer(layer)

    def actionGeotiffTriggered(self):
        """加载geotiff"""
        data_file, ext = QFileDialog.getOpenFileName(self, '打开', '', '*.tif')
        if data_file:
            layer = QgsRasterLayer(data_file, os.path.basename(data_file))
            self.addLayer(layer)

    def actionXYZTriggered(self):
        uri = 'type=xyz&' \
              'url=https://www.google.cn/maps/vt?lyrs=s@804%26gl=cn%26x={x}%26y={y}%26z={z}&' \
              'zmax=19&' \
              'zmin=0&' \
              'crs=EPSG3857'
        layer = QgsRasterLayer(uri, 'google', 'wms')
        self.addLayer(layer)

    def addLayer(self, layer):
        if layer.isValid():
            if self.first_flag:
                self.mapCanvas.setDestinationCrs(layer.crs())
                self.mapCanvas.setExtent(layer.extent())
                self.first_flag = False
            PROJECT.addMapLayer(layer)
            layers = [layer
                      ] + [PROJECT.mapLayer(i) for i in PROJECT.mapLayers()]
            self.mapCanvas.setLayers(layers)
            self.mapCanvas.refresh()
        else:
            print('图层无效.')

    def actionPointTriggered(self):
        self.pointTool = PointMapTool(self.mapCanvas)
        self.mapCanvas.setMapTool(self.pointTool)

    def actionLineTriggered(self):
        self.lineTool = LineMapTool(self.mapCanvas)
        self.mapCanvas.setMapTool(self.lineTool)

    def actionRectangleTriggered(self):
        self.rectangleTool = RectangleMapTool(self.mapCanvas)
        self.mapCanvas.setMapTool(self.rectangleTool)

    def actionPolygonTriggered(self):
        self.polygonTool = PolygonMapTool(self.mapCanvas)
        self.mapCanvas.setMapTool(self.polygonTool)

    def showLngLat(self, point):
        x = point.x()
        y = point.y()
        self.statusbar.showMessage(f'经度:{x}, 纬度:{y}')
Пример #23
0
class MapExplorer(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MapExplorer, self).__init__()
        self.project = QgsProject()
        self.band_synthesis_window = Band_Synthesis_Component()
        self.kmeans_window = KMeans_Component()
        self.meanshift_window = MeanShift_Component()
        self.dbscan_window = DBScan_Component()
        self.setupUi(self)
        self.init_mapcanvas()
        self.slot_connect()
        self.init_layerTree()

        self.style_stand()

    def init_layerTree(self):
        self.layer_tree_view = QgsLayerTreeView(self)
        layout = QVBoxLayout(self.layerTreeWidget)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.layer_tree_view)
        model = QgsLayerTreeModel(QgsProject.instance().layerTreeRoot(), self)
        model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        model.setFlag(QgsLayerTreeModel.ShowLegendAsTree)
        model.setAutoCollapseLegendNodes(10)
        self.layer_tree_view.setModel(model)
        provider = MenuProvider(self.layer_tree_view, self.mapCanvas,
                                self.project.instance())
        self.layer_tree_view.setMenuProvider(provider)

        # 注意self.layer_tree_bridge必须有
        self.layer_tree_bridge = QgsLayerTreeMapCanvasBridge(
            self.project.instance().layerTreeRoot(), self.mapCanvas)

    def slot_connect(self):
        self.actionopen_file.triggered.connect(self.action_open_triggered)
        self.actionzoom_in.triggered.connect(self.action_zoomin_triggered)
        self.actionzoom_out.triggered.connect(self.action_zoomout_triggered)
        self.actionpan.triggered.connect(self.action_pan_triggered)
        self.actionfull_extent.triggered.connect(
            self.action_fullextent_triggered)
        self.action_select.triggered.connect(self.action_select_triggered)
        self.actionsave.triggered.connect(self.action_save_triggered)
        self.mapdecoration.triggered.connect(self.mapDecoration_show)

        self.actionAqua.triggered.connect(self.style_Aqua)
        self.actionstand.triggered.connect(self.style_stand)
        self.actionConsoleStule.triggered.connect(self.style_ConsoleStyle)
        self.actionElegantDark.triggered.connect(self.style_ElegantDark)
        self.actionManjaroMix.triggered.connect(self.style_ManjaroMix)
        self.actionMaterialDark.triggered.connect(self.style_MaterialDark)
        self.actionUbuntu.triggered.connect(self.style_Ubuntu)

        self.action_KMeans.triggered.connect(self.action_KMeans_triggered)
        self.action_DBScan.triggered.connect(self.action_DBScan_triggered)
        self.action_MeanShift.triggered.connect(
            self.action_Meanshift_triggered)
        self.action_band_synthesis.triggered.connect(
            self.action_band_synthesis_triggered)
        self.kmeans_window.add_layer_signal.connect(
            self.action_add_kmeans_result)
        self.dbscan_window.add_layer_signal.connect(
            self.action_add_dbscan_result)
        self.meanshift_window.add_layer_signal.connect(
            self.action_add_meanshift_result)
        self.band_synthesis_window.add_layer_signal.connect(
            self.action_add_band_synthesis_result)

    def init_mapcanvas(self):
        # 实例化地图画布
        self.mapCanvas = QgsMapCanvas()
        self.mapCanvas.xyCoordinates.connect(self.show_lonlat)
        self.mapCanvas.setCanvasColor(QColor(60, 63, 65, 100))
        # self.mapCanvas.show()
        layout = QVBoxLayout(self.mapWidget)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.mapCanvas)

    def loadMap(self, fullpath, classArray=None):
        print(fullpath[-3:-1] + fullpath[-1])
        imgClass = fullpath[-3:-1] + fullpath[-1]

        basename = os.path.splitext(os.path.basename(fullpath))[0]

        if imgClass == 'shp':
            self.layer = QgsVectorLayer(fullpath, basename, "ogr")
        else:
            self.layer = QgsRasterLayer(fullpath, basename)
        # 添加图例
        if classArray:
            self.node = QgsLayerTreeLayer(self.layer)
            # self.classArray = [{'name':'class1','color':QColor(0,0,0)},{'name':'class1','color':QColor(0,255,0)}]
            self.legend = CustomViewerLegend(classArray)
            self.legend.createLayerTreeModelLegendNodes(self.node)
            self.layer.setLegend(self.legend)
        # 注册图层
        self.project.instance().addMapLayer(self.layer)
        self.mapCanvas.setLayers([self.layer])
        # 设置图层范围
        self.mapCanvas.setExtent(self.layer.extent())
        self.mapCanvas.refresh()
        self.layer_tree_view.setCurrentLayer(self.layer)

    def action_open_triggered(self):
        fullpath, format = QFileDialog.getOpenFileName(
            self, '打开数据', '', '*.shp;;*.jpg;;*.png;;*.tif')
        if os.path.exists(fullpath):
            self.loadMap(fullpath)

    def action_save_triggered(self):
        fullpath, format = QFileDialog.getSaveFileName(self, '保存数据', '',
                                                       '*.tif')
        if os.path.exists(fullpath):
            self.mapCanvas.saveAsImage(fullpath)

    def action_zoomin_triggered(self):
        self.maptool = QgsMapToolZoom(self.mapCanvas, False)
        self.mapCanvas.setMapTool(self.maptool)

    def action_zoomout_triggered(self):
        self.maptool = QgsMapToolZoom(self.mapCanvas, True)
        self.mapCanvas.setMapTool(self.maptool)

    def action_pan_triggered(self):
        self.maptool = QgsMapToolPan(self.mapCanvas)
        self.mapCanvas.setMapTool(self.maptool)

    def action_fullextent_triggered(self):
        self.mapCanvas.setExtent(self.layer.extent())
        self.mapCanvas.refresh()

    def action_select_triggered(self):
        self.maptool = PolygonMapTool(self)
        self.mapCanvas.setMapTool(self.maptool, True)
        self.mapCanvas.refresh()

    def mapDecoration_show(self):
        self.mapdecoration_dia = layerOut(QgsProject.instance(),
                                          self.qssStyleDia)
        self.mapdecoration_dia.show()

    # 显示鼠标点的经纬度信息
    def show_lonlat(self, point):
        x = point.x()
        y = point.y()
        self.statusbar.showMessage(f'经度:{x},纬度:{y}')

    def style_stand(self):
        styleFile = './QSS-master/style.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS('./QSS-master/ElegantDark.qss')
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_Aqua(self):
        styleFile = './QSS-master/Aqua.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_ConsoleStyle(self):
        styleFile = './QSS-master/ConsoleStyle.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_ElegantDark(self):
        styleFile = './QSS-master/ElegantDark.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_ManjaroMix(self):
        styleFile = './QSS-master/ManjaroMix.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_MaterialDark(self):
        styleFile = './QSS-master/MaterialDark.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def style_Ubuntu(self):
        styleFile = './QSS-master/Ubuntu.qss'
        self.qssStyle = CommonHelper.readQSS(styleFile)
        self.qssStyleDia = CommonHelper.readQSS(styleFile)
        QMainWindow.setStyleSheet(self, self.qssStyle)

    def action_band_synthesis_triggered(self):
        self.band_synthesis_window.show()

    def action_KMeans_triggered(self):
        self.kmeans_window.show()

    def action_DBScan_triggered(self):
        self.dbscan_window.show()

    def action_Meanshift_triggered(self):
        self.meanshift_window.show()

    def action_add_kmeans_result(self, kmeans_img_path, layer_legends):
        self.loadMap(kmeans_img_path, layer_legends)

    def action_add_dbscan_result(self, dbscan_img_path, layer_legends):
        self.loadMap(dbscan_img_path, layer_legends)

    def action_add_meanshift_result(self, meanshift_img_path, layer_legends):
        self.loadMap(meanshift_img_path, layer_legends)

    def action_add_band_synthesis_result(self, multiband_img_path):
        self.loadMap(multiband_img_path)
Пример #24
0
    def initGui(self):
        icon = QIcon()
        icon.addPixmap(
            QPixmap(
                "C:/Roberto/Visual_Studio_Code/GisBike/programa/IMG/Qgis.png"),
            QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.setWindowModality(Qt.WindowModal)
        self.setWindowFlags(Qt.Window
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.resize(1200, 600)

        self.verticalLayout_2 = QVBoxLayout(self)
        self.splitter = QSplitter(self)
        self.splitter.setOrientation(Qt.Horizontal)

        self.actionZoomIn = QPushButton("Zoom in", self.splitter)
        self.actionZoomOut = QPushButton("Zoom out", self.splitter)
        self.actionPan = QPushButton("Pan", self.splitter)
        self.actionFile = QPushButton("File", self.splitter)

        self.project = QgsProject.instance()
        self.project.read('C:/Users/Fcc/Desktop/QGis/pruebas2.qgz')
        self.root = QgsProject.instance().layerTreeRoot()
        self.bridge = QgsLayerTreeMapCanvasBridge(self.root, self.canvas)

        self.bridge.setCanvasLayers()
        self.bridge.setAutoSetupOnFirstLayer(True)

        #https://gis.stackexchange.com/questions/141516/adding-legend-to-canvas-in-standalone-pyqgis-application
        self.model = QgsLayerTreeModel(self.root)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        self.model.setFlag(QgsLayerTreeModel.ShowLegend)
        self.view = QgsLayerTreeView(self.splitter)
        self.view.setModel(self.model)
        self.view.setFixedWidth(150)
        #self.view.resize(150,600)

        self.widget = QWidget(self.splitter)
        self.verticalLayout = QVBoxLayout(self.widget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.addWidget(self.actionZoomIn)
        self.horizontalLayout.addWidget(self.actionZoomOut)
        self.horizontalLayout.addWidget(self.actionPan)
        self.horizontalLayout.addWidget(self.actionFile)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.addWidget(self.canvas)
        self.verticalLayout_2.addWidget(self.splitter)

        self.actionZoomIn.clicked.connect(self.zoomIn)
        self.actionZoomOut.clicked.connect(self.zoomOut)
        self.actionPan.clicked.connect(self.pan)
        self.actionFile.clicked.connect(self.file)

        # create the map tools
        self.toolPan = QgsMapToolPan(self.canvas)
        self.toolZoomIn = QgsMapToolZoom(self.canvas, False)  # false = in
        self.toolZoomOut = QgsMapToolZoom(self.canvas, True)  # true = out
Пример #25
0
class see_map(QDialog):
    #app2 = QgsApplication([], True)
    #app2.initQgis()
    def __init__(self, file_name):
        super().__init__()

        # Creación del Lienzo / Canvas
        self.canvas = QgsMapCanvas(self)
        self.setWindowTitle("Map of Track  /  Mapa del Recorrido")
        self.canvas.setCanvasColor(Qt.white)

        self.initGui()

        if not file_name == None:
            vlayer = QgsVectorLayer(file_name, "Track Converted", "ogr")
            #vlayer.updateExtents()
            self.project.instance().addMapLayer(vlayer)
            vlayer.renderer().symbol().setWidth(2)
            vlayer.renderer().symbol().setColor(QColor.fromRgb(250, 0, 0))
            self.view.refreshLayerSymbology(vlayer.id())

            uri = 'crs=EPSG:4326&dpiMode=7&format=image/jpeg&layers=IGNBaseTodo&styles=default&tileMatrixSet=EPSG:4326&url=http://www.ign.es/wmts/ign-base'
            map_spain = QgsRasterLayer(uri, "Spain", "wms")
            self.root.insertLayer(1, map_spain)
            self.project.instance().addMapLayer(map_spain)
            if not map_spain.isValid():
                print("Track failed to load! /n" + file_name)
            else:
                print("Track Load Correct! " + file_name)

        else:
            uri = 'crs=EPSG:4326&dpiMode=7&format=image/jpeg&layers=IGNBaseTodo&styles=default&tileMatrixSet=EPSG:4326&url=http://www.ign.es/wmts/ign-base'
            map_spain = QgsRasterLayer(uri, "Spain", "wms")
            self.project.instance().addMapLayer(map_spain)

            if not map_spain.isValid():
                print("Track failed to load! /n" + file_name)
            else:
                print("Track Load Correct! " + file_name)

    def zoomIn(self):
        self.canvas.setMapTool(self.toolZoomIn)

    def zoomOut(self):
        self.canvas.setMapTool(self.toolZoomOut)

    def pan(self):
        self.canvas.setMapTool(self.toolPan)

    def file(self):
        filename, _ = QFileDialog.getOpenFileName(self,
                                                  'Selecciona Fichero GPX',
                                                  'c:/', 'QGis (*.qgz)')
        if filename:
            self.project.read(filename)

    def initGui(self):
        icon = QIcon()
        icon.addPixmap(
            QPixmap(
                "C:/Roberto/Visual_Studio_Code/GisBike/programa/IMG/Qgis.png"),
            QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.setWindowModality(Qt.WindowModal)
        self.setWindowFlags(Qt.Window
                            | Qt.WindowSystemMenuHint
                            | Qt.WindowMinimizeButtonHint
                            | Qt.WindowMaximizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.resize(1200, 600)

        self.verticalLayout_2 = QVBoxLayout(self)
        self.splitter = QSplitter(self)
        self.splitter.setOrientation(Qt.Horizontal)

        self.actionZoomIn = QPushButton("Zoom in", self.splitter)
        self.actionZoomOut = QPushButton("Zoom out", self.splitter)
        self.actionPan = QPushButton("Pan", self.splitter)
        self.actionFile = QPushButton("File", self.splitter)

        self.project = QgsProject.instance()
        self.project.read('C:/Users/Fcc/Desktop/QGis/pruebas2.qgz')
        self.root = QgsProject.instance().layerTreeRoot()
        self.bridge = QgsLayerTreeMapCanvasBridge(self.root, self.canvas)

        self.bridge.setCanvasLayers()
        self.bridge.setAutoSetupOnFirstLayer(True)

        #https://gis.stackexchange.com/questions/141516/adding-legend-to-canvas-in-standalone-pyqgis-application
        self.model = QgsLayerTreeModel(self.root)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeReorder)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeRename)
        self.model.setFlag(QgsLayerTreeModel.AllowNodeChangeVisibility)
        self.model.setFlag(QgsLayerTreeModel.ShowLegend)
        self.view = QgsLayerTreeView(self.splitter)
        self.view.setModel(self.model)
        self.view.setFixedWidth(150)
        #self.view.resize(150,600)

        self.widget = QWidget(self.splitter)
        self.verticalLayout = QVBoxLayout(self.widget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.addWidget(self.actionZoomIn)
        self.horizontalLayout.addWidget(self.actionZoomOut)
        self.horizontalLayout.addWidget(self.actionPan)
        self.horizontalLayout.addWidget(self.actionFile)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.addWidget(self.canvas)
        self.verticalLayout_2.addWidget(self.splitter)

        self.actionZoomIn.clicked.connect(self.zoomIn)
        self.actionZoomOut.clicked.connect(self.zoomOut)
        self.actionPan.clicked.connect(self.pan)
        self.actionFile.clicked.connect(self.file)

        # create the map tools
        self.toolPan = QgsMapToolPan(self.canvas)
        self.toolZoomIn = QgsMapToolZoom(self.canvas, False)  # false = in
        self.toolZoomOut = QgsMapToolZoom(self.canvas, True)  # true = out
Пример #26
0
    def testProxyModel(self):
        """Test proxy model filtering and private layers"""

        view = QgsLayerTreeView()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        tree_model = view.layerTreeModel()
        proxy_model = view.proxyModel()

        self.assertEqual(tree_model.rowCount(), 3)
        self.assertEqual(proxy_model.rowCount(), 3)

        items = []
        for r in range(tree_model.rowCount()):
            items.append(tree_model.data(tree_model.index(r, 0)))

        self.assertEqual(items, ['layer1', 'layer2', 'layer3'])

        proxy_items = []
        for r in range(proxy_model.rowCount()):
            proxy_items.append(proxy_model.data(proxy_model.index(r, 0)))

        self.assertEqual(proxy_items, ['layer1', 'layer2', 'layer3'])

        self.layer3.setFlags(self.layer.Private)
        self.assertEqual(tree_model.rowCount(), 3)
        self.assertEqual(proxy_model.rowCount(), 2)

        proxy_items = []
        for r in range(proxy_model.rowCount()):
            proxy_items.append(proxy_model.data(proxy_model.index(r, 0)))

        self.assertEqual(proxy_items, ['layer1', 'layer2'])

        view.setShowPrivateLayers(True)

        self.assertEqual(proxy_model.rowCount(), 3)

        proxy_items = []
        for r in range(proxy_model.rowCount()):
            proxy_items.append(proxy_model.data(proxy_model.index(r, 0)))

        self.assertEqual(proxy_items, ['layer1', 'layer2', 'layer3'])

        view.setShowPrivateLayers(False)

        self.assertEqual(proxy_model.rowCount(), 2)

        proxy_items = []
        for r in range(proxy_model.rowCount()):
            proxy_items.append(proxy_model.data(proxy_model.index(r, 0)))

        self.assertEqual(proxy_items, ['layer1', 'layer2'])

        # Test filters
        proxy_model.setFilterText('layer2')

        self.assertEqual(proxy_model.rowCount(), 1)

        proxy_items = []
        for r in range(proxy_model.rowCount()):
            proxy_items.append(proxy_model.data(proxy_model.index(r, 0)))

        self.assertEqual(proxy_items, ['layer2'])
Пример #27
0
    def testNode2IndexMethods(self):
        """Test node2index and node2sourceIndex"""

        view = QgsLayerTreeView()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
            tree_tester = QAbstractItemModelTester(view.layerTreeModel())

        tree_model = view.layerTreeModel()
        proxy_model = view.proxyModel()

        proxy_index = proxy_model.index(1, 0)
        node2 = view.index2node(proxy_index)
        self.assertEqual(node2.name(), 'layer2')

        proxy_layer2_index = view.node2index(node2)
        self.assertEqual(proxy_layer2_index, view.node2index(node2))

        source_index = tree_model.index(1, 0)
        tree_layer2_index = view.node2sourceIndex(node2)
        self.assertEqual(tree_layer2_index, view.node2sourceIndex(node2))
class AuxiliaryLegend( QDockWidget ):

  currentLayerChanged = pyqtSignal( "QgsMapLayer" )
  currentLayerQgis = pyqtSignal( "QgsMapLayer" )
  syncGroupLayer = pyqtSignal()
  addSelectedLayersQgis = pyqtSignal()
  removeLayer = pyqtSignal( "QgsMapLayer" )
  needSelectLayer = pyqtSignal()
  closed = pyqtSignal()

  def __init__( self, parent, numWin ):
    def setTreeView():
      def setModel():
        self.model = QgsLayerTreeModel( ltg )
        self.model.setFlag( QgsLayerTreeModel.AllowNodeReorder )
        self.model.setFlag( QgsLayerTreeModel.AllowNodeChangeVisibility, True )
        self.tview.setModel( self.model )

      self.tview = QgsLayerTreeView( self )
      self.tview.setSelectionMode( QAbstractItemView.ExtendedSelection )
      setModel()
      self.tview.currentLayerChanged.connect( self.currentLayerChanged.emit )

    def setupUi():
      self.setAllowedAreas( Qt.LeftDockWidgetArea )
      winLegend.setWindowFlags( Qt.Widget )
      toolBar.setFloatable( False )
      toolBar.setMovable( False )
      winLegend.addToolBar( toolBar )
      self.setWidget( winLegend )

    def addActions():
      actn = QAction( winLegend )
      actn.setIcon( qgis.utils.iface.actionShowSelectedLayers().icon() )
      actn.setIconText( 'Show selected layers')
      actn.setObjectName( 'showLayer')
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )

      actn = QAction( winLegend )
      actn.setIcon( qgis.utils.iface.actionHideSelectedLayers().icon() )
      actn.setIconText( 'Hide selected layers')
      actn.setObjectName( 'hideLayer')
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )

      actn = QAction( winLegend )
      actn.setIcon( qgis.utils.iface.actionRemoveLayer().icon() )
      actn.setIconText( 'Remove selected layers')
      actn.setObjectName( 'removeLayer')
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )

      toolBar.addSeparator()

      actn = QAction( winLegend )
      actn.setIcon( qgis.utils.iface.actionDuplicateLayer().icon() )
      actn.setIconText( 'Add selected layers from main map')
      actn.setObjectName( 'addLayer')
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )

      actn = QAction( winLegend )
      actn.setIcon( QIcon( os.path.join( os.path.dirname(__file__), 'mActionCurrentLayer.png' ) ) )
      actn.setIconText( 'Current layer for main map')
      actn.setObjectName( 'currentLayer')
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )

      actn = QAction( winLegend )
      actn.setIcon( QIcon( os.path.join( os.path.dirname(__file__), 'mActionAddGroup.png' ) ) )
      actn.setObjectName( 'syncGroup' )
      actn.triggered.connect( self.onAction )
      toolBar.addAction( actn )


    super( AuxiliaryLegend, self ).__init__( "#%d - Layers" % numWin, parent )

    ltg = parent.ltg    
    self.tview = self.model = self.bridge = None
    self.textSync = "Sync with group(main map) for new layers"
    self.actSync = None
    setTreeView()

    winLegend = QMainWindow( self )
    toolBar = QToolBar( winLegend )
    setupUi()
    addActions()
    self.addNameSyncGroup( "None" )
    winLegend.setCentralWidget( self.tview )

  def addNameSyncGroup(self, name):
    act = self.findChild( QAction, 'syncGroup' )
    text = "%s -> %s" % ( self.textSync, name )
    act.setIconText( text )

  def setBridge(self, canvas):
    ltg = self.model.rootGroup() 
    self.bridge = QgsLayerTreeMapCanvasBridge( ltg, canvas ) # Need wait populate ltg

  def clearBridge(self):
    if not self.bridge is None:
      self.bridge.clear()

  def closeEvent(self, event):
    event.accept()
    self.closed.emit()

  @pyqtSlot()
  def onAction(self):
    nameSender = self.sender().objectName()

    if nameSender in ( 'showLayer', 'hideLayer', 'removeLayer'):
      nodes = self.tview.selectedLayerNodes()
      if len( nodes ) == 0:
        self.needSelectLayer.emit()
        return
      
      if nameSender in ( 'showLayer', 'hideLayer'):
        checked = Qt.Checked if nameSender == 'showLayer' else Qt.Unchecked
        map( lambda item: item.setVisible( checked ), nodes )
      else:
        ltg = self.model.rootGroup()
        for node in nodes:
          self.removeLayer.emit( node.layer() )
          ltg.removeChildNode( node )

    # addLayer, currentLayer
    else: 
      if nameSender == 'addLayer':
        self.addSelectedLayersQgis.emit()
      elif nameSender == 'currentLayer':
        self.currentLayerQgis.emit( self.tview.currentLayer() )
      else:
        self.syncGroupLayer.emit()
Пример #29
0
    def testMoveToBottomActionLayerAndGroup(self):
        """Test move to top action for a group and it's layer simultaneously"""

        view = QgsLayerTreeView()
        group = self.project.layerTreeRoot().insertGroup(0, "embeddedgroup")
        group.addLayer(self.layer4)
        group.addLayer(self.layer5)
        groupname = group.name()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        actions = QgsLayerTreeViewDefaultActions(view)
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                groupname,
                groupname + '-' + self.layer4.name(),
                groupname + '-' + self.layer5.name(),
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
            ])

        selectionMode = view.selectionMode()
        view.setSelectionMode(QgsLayerTreeView.MultiSelection)
        nodeLayerIndex = view.node2index(group)
        view.setCurrentIndex(nodeLayerIndex)
        view.setCurrentLayer(self.layer4)
        view.setSelectionMode(selectionMode)
        movetobottom = actions.actionMoveToBottom()
        movetobottom.trigger()
        self.assertEqual(
            self.nodeOrder(self.project.layerTreeRoot().children()), [
                self.layer.name(),
                self.layer2.name(),
                self.layer3.name(),
                groupname,
                groupname + '-' + self.layer5.name(),
                groupname + '-' + self.layer4.name(),
            ])
Пример #30
0
    def testSetLayerVisible(self):

        view = QgsLayerTreeView()
        view.setModel(self.model)
        if USE_MODEL_TESTER:
            proxy_tester = QAbstractItemModelTester(view.model())
        self.project.layerTreeRoot().findLayer(
            self.layer).setItemVisibilityChecked(True)
        self.project.layerTreeRoot().findLayer(
            self.layer2).setItemVisibilityChecked(True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer).itemVisibilityChecked())
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())

        view.setLayerVisible(None, True)
        view.setLayerVisible(self.layer, True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer).itemVisibilityChecked())
        view.setLayerVisible(self.layer2, False)
        self.assertFalse(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())
        view.setLayerVisible(self.layer2, True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())
Пример #31
0
 def testSetCurrentLayer(self):
     view = QgsLayerTreeView()
     view.setModel(self.model)
     current_layer_changed_spy = QSignalSpy(view.currentLayerChanged)
     self.assertFalse(view.currentLayer())
     view.setCurrentLayer(self.layer3)
     self.assertEqual(view.currentLayer(), self.layer3)
     self.assertEqual(len(current_layer_changed_spy), 1)
     view.setCurrentLayer(self.layer)
     self.assertEqual(view.currentLayer(), self.layer)
     self.assertEqual(len(current_layer_changed_spy), 2)
     view.setCurrentLayer(None)
     self.assertFalse(view.currentLayer())
     self.assertEqual(len(current_layer_changed_spy), 3)
Пример #32
0
    def testSetLayerVisible(self):
        view = QgsLayerTreeView()
        view.setModel(self.model)
        self.project.layerTreeRoot().findLayer(
            self.layer).setItemVisibilityChecked(True)
        self.project.layerTreeRoot().findLayer(
            self.layer2).setItemVisibilityChecked(True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer).itemVisibilityChecked())
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())

        view.setLayerVisible(None, True)
        view.setLayerVisible(self.layer, True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer).itemVisibilityChecked())
        view.setLayerVisible(self.layer2, False)
        self.assertFalse(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())
        view.setLayerVisible(self.layer2, True)
        self.assertTrue(self.project.layerTreeRoot().findLayer(
            self.layer2).itemVisibilityChecked())