Ejemplo n.º 1
0
    def _init_extent_layer_dialog(self, filters=QgsMapLayerProxyModel.All):
        dialog = QDialog()
        layout = QVBoxLayout()
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, dialog)
        layer_combobox = QgsMapLayerComboBox()

        layout.addWidget(layer_combobox)
        layout.addWidget(buttons)

        layer_combobox.setFilters(filters)
        layer_combobox.setAccessibleName('')
        dialog.setModal(True)
        dialog.setLayout(layout)

        buttons.accepted.connect(dialog.accept)
        buttons.rejected.connect(dialog.reject)

        # ugly, but better to keep the function as pure as possible pure.
        # I guess it begs for it's own class
        dialog.layer_combobox = layer_combobox

        return dialog