示例#1
0
    def __init__(self, alg, model, algName=None, configuration=None):
        super().__init__()
        self.setObjectName('ModelerParametersDialog')
        self.setModal(True)

        if iface is not None:
            self.setStyleSheet(iface.mainWindow().styleSheet())

        # dammit this is SUCH as mess... stupid stable API
        self._alg = alg  # The algorithm to define in this dialog. It is an instance of QgsProcessingAlgorithm
        self.model = model  # The model this algorithm is going to be added to. It is an instance of QgsProcessingModelAlgorithm
        self.childId = algName  # The name of the algorithm in the model, in case we are editing it and not defining it for the first time
        self.configuration = configuration
        self.context = createContext()

        self.setWindowTitle(self._alg.displayName())

        self.widget = ModelerParametersWidget(alg, model, algName, configuration, context=self.context, dialog=self)
        QgsGui.enableAutoGeometryRestore(self)

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok | QDialogButtonBox.Help)

        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.helpRequested.connect(self.openHelp)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.widget, 1)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)
示例#2
0
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.setupUi(self)

        QgsGui.enableAutoGeometryRestore(self)

        self.btn_composer_out_folder.setIcon(
            GuiUtils.get_icon('open_file.png'))
        self.btn_template_folder.setIcon(GuiUtils.get_icon('open_file.png'))
        self.btn_supporting_docs.setIcon(GuiUtils.get_icon('open_file.png'))

        self.iface = iface

        self.notif_bar = NotificationBar(self.vlNotification, 6000)
        self._apply_btn = self.buttonBox.button(QDialogButtonBox.Apply)
        self._reg_config = RegistryConfig()
        self._db_config = DatabaseConfig()

        version = version_from_metadata()
        #upgrade_label_text = self.label_9.text().replace(
        #'1.4', version.strip()
        #)
        #self.label_9.setText(upgrade_label_text)

        # Connect signals
        self._apply_btn.clicked.connect(self.apply_settings)
        self.buttonBox.accepted.connect(self.on_accept)
        self.chk_pg_connections.toggled.connect(self._on_use_pg_connections)
        self.cbo_pg_connections.currentIndexChanged.connect(
            self._on_pg_profile_changed)
        self.btn_db_conn_clear.clicked.connect(self.clear_properties)
        self.btn_test_db_connection.clicked.connect(self._on_test_connection)
        self.btn_supporting_docs.clicked.connect(
            self._on_choose_supporting_docs_path)
        self.btn_template_folder.clicked.connect(
            self._on_choose_doc_designer_template_path)
        self.btn_composer_out_folder.clicked.connect(
            self._on_choose_doc_generator_output_path)

        self._config = StdmConfiguration.instance()
        self._default_style_sheet = self.txtRepoLocation.styleSheet()

        #self.upgradeButton.toggled.connect(self.manage_upgrade)
        #self.manage_upgrade()

        self.init_gui()

        self.profile_entity_widget = None
        self.cache = None
        self.sort_record_widget = None

        self.tabWidget.setCurrentIndex(0)
        self.btnAdd.clicked.connect(self.add_sorting_column)
        self.init_sorting_widgets(self.cbo_profiles.currentText())
        self.cbo_profiles.currentIndexChanged.connect(self.profile_changed)
示例#3
0
    def __init__(self, parent=None):
        """Constructor."""
        super().__init__(parent)

        self.setWindowTitle(self.tr('Customize Areas'))

        QgsGui.enableAutoGeometryRestore(self)

        self.widget = PredefinedAreasWidget()
        layout = QVBoxLayout()
        layout.addWidget(self.widget)
        self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)
        layout.addWidget(self.button_box)
        self.setLayout(layout)
示例#4
0
    def __init__(self, exc_info, parent=None):
        QDialog.__init__(self, parent)

        self.setObjectName('FirstAidDebugDialog')
        self.setWindowTitle('Python Error')

        self.debug_widget = DebugWidget(exc_info)
        layout = QVBoxLayout()
        layout.addWidget(self.debug_widget, 1)

        self.button_box = QDialogButtonBox(QDialogButtonBox.Close)
        self.button_box.rejected.connect(self.reject)
        layout.addWidget(self.button_box)

        self.setLayout(layout)

        QgsGui.enableAutoGeometryRestore(self)
示例#5
0
    def __init__(self, plugin):
        QDialog.__init__(self, plugin.iface.mainWindow())
        self.setupUi(self)

        QgsGui.enableAutoGeometryRestore(self)

        # Initialize the dialog
        self.initGui()

        # Load users
        self.loadContent()

        # Load Roles
        self.loadRoles()

        # Reference to the currently selected STDM content item
        self.currentContent = None
示例#6
0
    def __init__(self, parent=None, test_connect_mode=False):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        QgsGui.enableAutoGeometryRestore(self)

        self.btn_db_settings.setIcon(
            GuiUtils.get_icon('db_server_settings.png'))

        # If dialog is used in the context of testing database connections
        self._test_connect_mode = test_connect_mode

        # gui initialization
        self.initGui()

        # class properties
        self.user = None
        self.dbConn = None
示例#7
0
    def __init__(self, iface, service_type, service_id, parent):
        super().__init__(parent)
        self.setObjectName('ServiceConfigurationDialog')

        QgsGui.enableAutoGeometryRestore(self)

        self.setWindowTitle(self.tr('Edit Service {}').format(service_id))

        self.config_widget = ServiceConfigurationWidget(
            iface, service_type, service_id)
        layout = QVBoxLayout()
        layout.addWidget(self.config_widget, 1)
        self.button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                           | QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)
        layout.addWidget(self.button_box)
        self.setLayout(layout)
        self.config_widget.validChanged.connect(self.valid_changed)
        self.valid_changed(self.config_widget.is_valid()[0])
    def __init__(self, layer_name, original_uri, layer_type, parent=None):
        super().__init__(parent)

        self.setupUi(self)
        self.setWindowTitle("Select Source for {}".format(layer_name))
        QgsGui.enableAutoGeometryRestore(self)

        # in case browser panel isn't open, we need to force initialize the model now
        iface.browserModel().initialize()

        self.browser_proxy_model = QgsBrowserProxyModel(self)
        self.browser_proxy_model.setBrowserModel(iface.browserModel())
        self.browser_proxy_model.setFilterByLayerType(True)
        self.browser_proxy_model.setLayerType(layer_type)
        self.mBrowserTreeView.setHeaderHidden(True)
        self.mBrowserTreeView.setModel(self.browser_proxy_model)
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
        self.mBrowserTreeView.clicked.connect(self.on_layer_selected)
        self.uri = None
        self.description_label = None
        self.setDescription("Original source: {}".format(original_uri))
示例#9
0
    def __init__(self, plugin):
        QDialog.__init__(self, plugin.iface.mainWindow())
        self.setupUi(self)

        QgsGui.enableAutoGeometryRestore(self)

        self.tbUserRole.setTabIcon(0, GuiUtils.get_icon('user.png'))
        self.tbUserRole.setTabIcon(1, GuiUtils.get_icon('roles.png'))
        self.tbUserRole.setTabIcon(2, GuiUtils.get_icon('user_mapping.png'))

        # Initialize the dialog
        self.initGui()

        # Load users
        self.loadUsers()

        # Load Roles
        self.loadRoles()

        # Load user mappings
        self.loadUserMappings()

        # Reference to the currently selected STDM role for which user mappings need to be defined
        self.currentRole = None
示例#10
0
    def __init__(self, iface, parent=None):  # pylint:disable=too-many-statements
        """Constructor."""
        super().__init__(parent)

        self.setupUi(self)

        self.setObjectName('QQuakeDialog')
        QgsGui.enableAutoGeometryRestore(self)

        self.scrollArea.setStyleSheet("""
            QScrollArea { background: transparent; }
            QScrollArea > QWidget > QWidget { background: transparent; }
            QScrollArea > QWidget > QScrollBar { background: 1; }
        """)
        self.scrollArea_2.setStyleSheet(self.scrollArea.styleSheet())
        self.scrollArea_3.setStyleSheet(self.scrollArea.styleSheet())
        self.scrollArea_4.setStyleSheet(self.scrollArea.styleSheet())

        self.splitter.setStretchFactor(0, 0)
        self.splitter_2.setStretchFactor(0, 0)
        self.splitter_3.setStretchFactor(0, 0)
        self.splitter_4.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 1)
        self.splitter_2.setStretchFactor(1, 1)
        self.splitter_3.setStretchFactor(1, 1)
        self.splitter_4.setStretchFactor(1, 1)

        self.fdsn_event_filter = FilterParameterWidget(
            iface, SERVICE_MANAGER.FDSNEVENT)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.fdsn_event_filter)
        self.fdsn_event_filter_container.setLayout(vl)
        self.earthquake_service_info_widget = ServiceInformationWidget(iface)
        self.fdsn_by_id_filter = FilterByIdWidget(iface,
                                                  SERVICE_MANAGER.FDSNEVENT)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.fdsn_by_id_filter)
        self.fdsn_by_id_container.setLayout(vl)
        self.fdsn_by_url_widget = FetchByUrlWidget(iface,
                                                   SERVICE_MANAGER.FDSNEVENT)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.fdsn_by_url_widget)
        self.fdsn_by_url_container.setLayout(vl)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.earthquake_service_info_widget)
        self.earthquake_service_info_container.setLayout(vl)

        self.macro_filter = FilterParameterWidget(iface,
                                                  SERVICE_MANAGER.MACROSEISMIC)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.macro_filter)
        self.macro_filter_container.setLayout(vl)
        self.macro_by_id_filter = FilterByIdWidget(
            iface, SERVICE_MANAGER.MACROSEISMIC)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.macro_by_id_filter)
        self.macro_by_id_container.setLayout(vl)
        self.macro_by_url_widget = FetchByUrlWidget(
            iface, SERVICE_MANAGER.MACROSEISMIC)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.macro_by_url_widget)
        self.macro_by_url_container.setLayout(vl)
        self.macro_service_info_widget = ServiceInformationWidget(iface)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.macro_service_info_widget)
        self.macro_service_info_container.setLayout(vl)

        self.station_filter = FilterParameterWidget(
            iface, SERVICE_MANAGER.FDSNSTATION)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.station_filter)
        self.station_filter_container.setLayout(vl)
        self.station_by_id_filter = FilterStationByIdWidget(
            iface, SERVICE_MANAGER.FDSNSTATION)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.station_by_id_filter)
        self.station_by_id_container.setLayout(vl)
        self.station_service_info_widget = ServiceInformationWidget(iface)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.station_service_info_widget)
        self.station_service_info_container.setLayout(vl)

        self.station_by_url_widget = FetchByUrlWidget(
            iface, SERVICE_MANAGER.FDSNSTATION)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.station_by_url_widget)
        self.station_by_url_container.setLayout(vl)

        self.ogc_service_widget = OgcServiceWidget(iface)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.ogc_service_widget)
        self.ogc_widget_container.setLayout(vl)
        self.ogc_service_info_widget = ServiceInformationWidget(iface)
        vl = QVBoxLayout()
        vl.setContentsMargins(0, 0, 0, 0)
        vl.addWidget(self.ogc_service_info_widget)
        self.ogc_service_info_container.setLayout(vl)

        self.message_bar = QgsMessageBar()
        self.message_bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.verticalLayout.insertWidget(0, self.message_bar)

        self.fdsn_event_url_text_browser.viewport().setAutoFillBackground(
            False)
        self.fdsn_macro_url_text_browser.viewport().setAutoFillBackground(
            False)
        self.fdsn_station_url_text_browser.viewport().setAutoFillBackground(
            False)

        self.button_box.button(QDialogButtonBox.Ok).setText(
            self.tr('Fetch Data'))
        self.button_box.rejected.connect(self._save_settings)

        self.iface = iface

        # OGC
        self.ogc_combo.addItem(self.tr('Web Map Services (WMS)'),
                               SERVICE_MANAGER.WMS)
        self.ogc_combo.addItem(self.tr('Web Feature Services (WFS)'),
                               SERVICE_MANAGER.WFS)
        self.ogc_combo.currentIndexChanged.connect(self.refreshOgcWidgets)

        self.ogc_list_model = QStandardItemModel(self.ogc_list)
        self.ogc_list.setModel(self.ogc_list_model)
        self.ogc_list.selectionModel().selectionChanged.connect(
            self._ogc_service_changed)

        self._refresh_services()
        SERVICE_MANAGER.refreshed.connect(self._refresh_services)

        # connect to refreshing function to refresh the UI depending on the WS
        self._refresh_fdsnevent_widgets()
        self.refreshFdsnMacroseismicWidgets()
        self.refreshFdsnStationWidgets()

        # change the UI parameter according to the web service chosen
        self.fdsn_event_list.currentRowChanged.connect(
            self._refresh_fdsnevent_widgets)
        self.fdsn_macro_list.currentRowChanged.connect(
            self.refreshFdsnMacroseismicWidgets)
        self.fdsn_station_list.currentRowChanged.connect(
            self.refreshFdsnStationWidgets)

        self.fdsn_event_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNEVENT))
        self.fdsn_by_id_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNEVENT))
        self.fdsn_by_url_widget.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNEVENT))
        self.fdsn_event_list.currentRowChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNEVENT))
        self.macro_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.MACROSEISMIC))
        self.macro_by_id_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.MACROSEISMIC))
        self.macro_by_url_widget.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.MACROSEISMIC))
        self.fdsn_macro_list.currentRowChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.MACROSEISMIC))
        self.station_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNSTATION))
        self.station_by_id_filter.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNSTATION))
        self.fdsn_station_list.currentRowChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNSTATION))
        self.station_by_url_widget.changed.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNSTATION))

        self.button_box.accepted.connect(self._getEventList)

        self.service_tab_widget.currentChanged.connect(
            lambda: self._refresh_url(None))

        self.fetcher = None

        QgsGui.enableAutoGeometryRestore(self)

        self.fdsn_tab_widget.currentChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNEVENT))
        self.macro_tab_widget.currentChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.MACROSEISMIC))
        self.fdsnstation_tab_widget.currentChanged.connect(
            lambda: self._refresh_url(SERVICE_MANAGER.FDSNSTATION))

        for b in [
                self.button_fdsn_new_service, self.button_macro_new_service,
                self.button_station_new_service, self.button_ogc_new_service
        ]:
            self._build_add_service_menu(b)

        for b in [
                self.button_fdsn_edit_service, self.button_macro_edit_service,
                self.button_station_edit_service, self.button_ogc_edit_service
        ]:
            b.clicked.connect(self._edit_service)

        for b in [
                self.button_fdsn_rename_service,
                self.button_macro_rename_service,
                self.button_station_rename_service,
                self.button_ogc_rename_service
        ]:
            b.clicked.connect(self._rename_service)

        for b in [
                self.button_fdsn_remove_service,
                self.button_macro_remove_service,
                self.button_station_remove_service,
                self.button_ogc_remove_service
        ]:
            b.clicked.connect(self._remove_service)

        for b in [
                self.button_fdsn_export_service,
                self.button_macro_export_service,
                self.button_station_export_service,
                self.button_ogc_export_service
        ]:
            b.clicked.connect(self._export_service)

        self._restore_settings()
        self._refresh_url(SERVICE_MANAGER.FDSNEVENT)
        self._refresh_url(SERVICE_MANAGER.MACROSEISMIC)
        self._refresh_url(SERVICE_MANAGER.FDSNSTATION)
示例#11
0
    def __init__(
            self,  # pylint: disable=too-many-locals,too-many-branches,too-many-statements
            service_type: str,
            service_id: str,
            initial_fields: List[str],
            parent=None):
        """Constructor."""
        super().__init__(parent)
        self.setupUi(self)
        self.service_type = service_type
        self.service_id = service_id

        service_config = SERVICE_MANAGER.service_details(
            service_type, service_id)

        self.setWindowTitle(self.tr('Output Table Options'))

        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        QgsGui.enableAutoGeometryRestore(self)
        self.default_fields = None

        s = QgsSettings()

        short_field_names = s.value('/plugins/qquake/output_short_field_names',
                                    True, bool)
        if short_field_names:
            self.radio_short_fields.setChecked(True)
        else:
            self.radio_long_fields.setChecked(True)

        self.radio_short_fields.toggled.connect(self.change_field_names)

        nodes = []
        for _, settings in SERVICE_MANAGER.get_field_config(
                self.service_type)['field_groups'].items():
            if self.service_type != SERVICE_MANAGER.FDSNSTATION and settings[
                    'label'] == 'station':
                continue
            if self.service_type == SERVICE_MANAGER.FDSNSTATION and settings[
                    'label'] not in ('station', 'general', 'network'):
                continue

            parent_node = ModelNode([settings['label']])
            for f in settings['fields']:
                if f.get('skip'):
                    continue

                if f['source'] is not None:
                    if f['source'].startswith('eventParameters'):
                        path = f['source'][len('eventParameters>event>'):]
                    elif f['source'].startswith('macroseismicParameters'):
                        path = f['source'][len('macroseismicParameters>'):]
                    else:
                        path = f['source'][len('FDSNStationXML>'):]
                else:
                    path = ''

                if initial_fields:
                    checked = f['source'] in initial_fields
                else:
                    checked = s.value(
                        '/plugins/qquake/output_field_{}'.format(
                            path.replace('>', '_')), True, bool)

                parent_node.addChild(
                    ModelNode([
                        'checked', f['field_short' if short_field_names else
                                     'field_long'], path
                    ],
                              checked,
                              user_data=f))
            nodes.append(parent_node)

        self.field_model = SimpleNodeModel(
            nodes,
            headers=[
                self.tr('Include'),
                self.tr('Field Name'),
                self.tr('StationML Source') if service_type
                == SERVICE_MANAGER.FDSNSTATION else self.tr('QuakeML Source')
            ])
        self.fields_tree_view.setModel(self.field_model)
        self.fields_tree_view.expandAll()

        for r in range(self.field_model.rowCount(QModelIndex())):
            self.fields_tree_view.setFirstColumnSpanned(r, QModelIndex(), True)

        self.output_preferred_origins_only_check.setVisible(
            self.service_type in (SERVICE_MANAGER.MACROSEISMIC,
                                  SERVICE_MANAGER.FDSNEVENT))
        self.output_preferred_origins_only_check.setEnabled(
            service_config['settings'].get('queryincludeallorigins', False))

        self.output_preferred_magnitudes_only_check.setVisible(
            self.service_type in (SERVICE_MANAGER.MACROSEISMIC,
                                  SERVICE_MANAGER.FDSNEVENT))
        self.output_preferred_magnitudes_only_check.setEnabled(
            service_config['settings'].get('queryincludeallmagnitudes', False))

        self.check_include_event_params_in_mdp.setVisible(
            self.service_type == SERVICE_MANAGER.MACROSEISMIC)
        self.check_include_event_params_in_mdp.setEnabled(
            self.service_type == SERVICE_MANAGER.MACROSEISMIC)

        self.output_preferred_mdp_only_check.setVisible(
            self.service_type == SERVICE_MANAGER.MACROSEISMIC)

        self.output_features_group_box.setVisible(
            self.service_type in (SERVICE_MANAGER.MACROSEISMIC,
                                  SERVICE_MANAGER.FDSNEVENT))

        preferred_origins_only_checked = s.value(
            '/plugins/qquake/output_preferred_origins', True, bool)
        self.output_preferred_origins_only_check.setChecked(
            preferred_origins_only_checked)
        preferred_magnitudes_only_checked = s.value(
            '/plugins/qquake/output_preferred_magnitude', True, bool)
        self.output_preferred_magnitudes_only_check.setChecked(
            preferred_magnitudes_only_checked)
        preferred_mdp_only_checked = s.value(
            '/plugins/qquake/output_preferred_mdp', True, bool)
        self.output_preferred_mdp_only_check.setChecked(
            preferred_mdp_only_checked)

        include_quake_details_in_mdp = s.value(
            '/plugins/qquake/include_quake_details_in_mdp', True, bool)
        self.check_include_event_params_in_mdp.setChecked(
            include_quake_details_in_mdp)

        self.reset_fields_button.clicked.connect(self.reset_fields)
        self.check_all_button.clicked.connect(lambda: self._check_all(True))
        self.uncheck_all_button.clicked.connect(lambda: self._check_all(False))
        self.reset_fields_button.setVisible(False)

        if 'fields' in SERVICE_MANAGER.service_details(service_type,
                                                       service_id)['default']:
            self.set_default_fields(
                SERVICE_MANAGER.service_details(
                    service_type, service_id)['default']['fields'])
示例#12
0
    def __init__(self,
                 entity,
                 model=None,
                 parent=None,
                 manage_documents=True,
                 collect_model=False,
                 parent_entity=None,
                 exclude_columns=None,
                 plugin=None,
                 allow_str_creation=True):
        """
        Class constructor.
        :param entity: Entity object corresponding to a table object.
        :type entity: Entity
        :param model: Data object for loading data into the form widgets.
        If the model is set, then the editor dialog is assumed to be in edit
        mode.
        :type model: object
        :param parent: Parent widget that the form belongs to.
        :type parent: QWidget
        :param manage_documents: True if the dialog should provide controls
        for managing supporting documents. Only applicable if the entity
        allows for supporting documents to be attached.
        :type manage_documents: bool
        :param collect_model: If set to True only returns
        the filled form model without saving it to the database.
        :type collect_model: Boolean
        :param parent_entity: The parent entity of the editor
        :type parent_entity: Object
        :param exclude_columns: List of columns to be excluded if in a list.
        :type exclude_columns: List
        :return: If collect_model, returns SQLAlchemy Model
        """
        super().__init__(parent=parent, model=model, entity=entity)

        QgsGui.enableAutoGeometryRestore(self)

        self.collection_suffix = self.tr('Collection')

        # Set minimum width
        self.setMinimumWidth(450)

        self.plugin = plugin

        # Flag for mandatory columns
        self.has_mandatory = False
        self.reload_form = False
        self._entity = entity
        self.edit_model = model
        self.column_widgets = OrderedDict()
        self.columns = {}
        self._parent = parent
        self.exclude_columns = exclude_columns or []
        self.entity_tab_widget = None
        self._disable_collections = False
        self.filter_val = None
        self.parent_entity = parent_entity
        self.child_models = OrderedDict()
        self.entity_scroll_area = None
        self.entity_editor_widgets = OrderedDict()
        self.details_tree_view = None
        # Set notification layout bar
        self.vlNotification = QVBoxLayout()
        self.vlNotification.setObjectName('vlNotification')
        self._notifBar = NotificationBar(self.vlNotification)
        self.do_not_check_dirty = False
        # Set manage documents only if the entity supports documents
        if self._entity.supports_documents:
            self._manage_documents = manage_documents
        else:
            self._manage_documents = False

        # Setup entity model
        self._ent_document_model = None
        if self._entity.supports_documents:
            self.ent_model, self._ent_document_model = entity_model(
                self._entity, with_supporting_document=True)
        else:
            self.ent_model = entity_model(self._entity)
        if model is not None:
            self.ent_model = model

        MapperMixin.__init__(self, self.ent_model, entity)

        self.collect_model = collect_model

        self.register_column_widgets()

        try:
            if isinstance(parent._parent, EntityEditorDialog):
                # hide collections form child editor
                self._disable_collections = True
        except AttributeError:
            self._parent._parent = None

        # Set title
        editor_trans = self.tr('Editor')
        if self._entity.label is not None:
            if self._entity.label != '':
                title_str = self._entity.label
            else:
                title_str = format_name(self._entity.short_name)
        else:
            title_str = format_name(self._entity.short_name)

        self.title = '{0} {1}'.format(title_str, editor_trans)

        self.setWindowTitle(self.title)

        # determine whether the entity is part of the STR relationship
        curr_profile = current_profile()
        self.participates_in_str, self.is_party_unit = curr_profile.social_tenure.entity_participates_in_str(
            self.entity)

        self._init_gui(show_str_tab=allow_str_creation
                       and self.participates_in_str,
                       is_party_unit=self.is_party_unit)
        self.adjustSize()

        self._get_entity_editor_widgets()

        if isinstance(parent._parent, EntityEditorDialog):
            self.parent_entity = parent.parent_entity
            self.set_parent_values()
            # make the size smaller to differentiate from parent and as it
            # only has few tabs.
            self.adjustSize()

        self.attribute_mappers = self._attr_mapper_collection

        # Exception title for editor extension exceptions
        self._ext_exc_msg = self.tr(
            'An error has occured while executing Python code in the editor '
            'extension:')

        # Register custom editor extension if specified
        self._editor_ext = entity_dlg_extension(self)
        if self._editor_ext is not None:
            self._editor_ext.post_init()

            # Initialize CascadingFieldContext objects
            self._editor_ext.connect_cf_contexts()