def _show_panel(self):
        if self.interlis_mode or self._db_action_type == DbActionType.IMPORT_DATA:
            validator = self.gpkgSaveFileValidator
            file_selector = make_save_file_selector(
                self.gpkg_file_line_edit,
                title=self.tr("Open GeoPackage database file"),
                file_filter=self.tr("GeoPackage Database (*.gpkg *.GPKG)"),
                extensions=["." + ext for ext in self.ValidExtensions],
                dont_confirm_overwrite=True,
            )
        else:
            validator = self.gpkgOpenFileValidator
            file_selector = make_file_selector(
                self.gpkg_file_line_edit,
                title=self.tr("Open GeoPackage database file"),
                file_filter=self.tr("GeoPackage Database (*.gpkg *.GPKG)"),
            )
        try:
            self.gpkg_file_browse_button.clicked.disconnect()
        except:
            pass

        self.gpkg_file_line_edit.setValidator(validator)
        self.gpkg_file_line_edit.textChanged.emit(self.gpkg_file_line_edit.text())
        self.gpkg_file_browse_button.clicked.connect(file_selector)
Exemplo n.º 2
0
    def __init__(self, configuration, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.configuration = configuration
        self.db_simple_factory = DbSimpleFactory()

        self.pg_user_line_edit.setText(configuration.super_pg_user)
        self.pg_password_line_edit.setText(configuration.super_pg_password)

        self.custom_model_directories_line_edit.setText(
            configuration.custom_model_directories)
        self.custom_model_directories_box.setChecked(
            configuration.custom_model_directories_enabled)
        self.java_path_line_edit.setText(configuration.java_path)
        self.java_path_search_button.clicked.connect(
            qt_utils.make_file_selector(self.java_path_line_edit,
                                        self.tr('Select Java application'),
                                        self.tr('java (*)')))
        self.java_path_line_edit.setValidator(
            FileValidator(is_executable=True, allow_empty=True))
        self.validators = Validators()
        self.java_path_line_edit.textChanged.connect(
            self.validators.validate_line_edits)
        self.ili2db_logfile_path.setText(configuration.logfile_path)
        self.ili2db_logfile_search_button.clicked.connect(
            qt_utils.make_save_file_selector(self.ili2db_logfile_path,
                                             self.tr('Select log file'),
                                             self.tr('Text files (*.txt)')))
        self.ili2db_enable_debugging.setChecked(
            self.configuration.debugging_enabled)
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.helpRequested.connect(self.help_requested)
        self.custom_models_dir_button.clicked.connect(
            self.show_custom_model_dir)

        for db_id in self.db_simple_factory.get_db_list(False):
            db_id |= DbIliMode.ili
            self.ili2db_tool_combobox.addItem(db_id.name, db_id)

        self.ili2db_action_combobox.addItem(self.tr('Schema Import'),
                                            'schemaimport')
        self.ili2db_action_combobox.addItem(self.tr('Data Import'), 'import')
        self.ili2db_action_combobox.addItem(self.tr('Data Export'), 'export')

        self.ili2db_tool_combobox.currentIndexChanged.connect(
            self.ili2db_command_reload)
        self.ili2db_action_combobox.currentIndexChanged.connect(
            self.ili2db_command_reload)

        self.ili2db_command_reload()

        settings = QSettings()
        drop_mode = DropMode[settings.value('QgisModelBaker/drop_mode',
                                            DropMode.ASK.name, str)]
        self.chk_dontask_to_handle_dropped_files.setEnabled(
            drop_mode != DropMode.ASK)
        self.chk_dontask_to_handle_dropped_files.setChecked(
            drop_mode != DropMode.ASK)
    def _show_panel(self):
        if self.interlis_mode:
            validator = self.gpkgSaveFileValidator
            file_selector = make_save_file_selector(
                self.gpkg_file_line_edit,
                title=self.tr("Open GeoPackage database file"),
                file_filter=self.tr("GeoPackage Database (*.gpkg)"),
                extension='.gpkg')
        else:
            validator = self.gpkgOpenFileValidator
            file_selector = make_file_selector(
                self.gpkg_file_line_edit,
                title=self.tr("Open GeoPackage database file"),
                file_filter=self.tr("GeoPackage Database (*.gpkg)"))
        try:
            self.gpkg_file_browse_button.clicked.disconnect()
        except:
            pass

        self.gpkg_file_line_edit.setValidator(validator)
        self.gpkg_file_line_edit.textChanged.emit(
            self.gpkg_file_line_edit.text())
        self.gpkg_file_browse_button.clicked.connect(file_selector)
Exemplo n.º 4
0
    def __init__(self, parent, title):
        QWizardPage.__init__(self, parent)
        self.workflow_wizard = parent

        self.setupUi(self)
        self.setTitle(title)

        self.filter_data_panel = FilterDataPanel(self.workflow_wizard)
        self.filter_layout.addWidget(self.filter_data_panel)

        self.is_complete = False

        self.xtf_file_browse_button.clicked.connect(
            make_save_file_selector(
                self.xtf_file_line_edit,
                title=self.tr("Save in XTF Transfer File"),
                file_filter=self.
                tr("XTF Transfer File (*.xtf *XTF);;Interlis 1 Transfer File (*.itf *ITF);;XML (*.xml *XML);;GML (*.gml *GML)"
                   ),
                extension=".xtf",
                extensions=["." + ext for ext in self.ValidExtensions],
            ))

        self.validators = Validators()

        fileValidator = FileValidator(
            pattern=["*." + ext for ext in self.ValidExtensions],
            allow_non_existing=True,
        )

        self.xtf_file_line_edit.setValidator(fileValidator)
        self.xtf_file_line_edit.textChanged.connect(
            self.validators.validate_line_edits)
        self.xtf_file_line_edit.textChanged.connect(
            self._set_current_export_target)
        self.xtf_file_line_edit.textChanged.emit(
            self.xtf_file_line_edit.text())
Exemplo n.º 5
0
    def __init__(self, base_config, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.db_simple_factory = DbSimpleFactory()
        QgsGui.instance().enableAutoGeometryRestore(self)
        self.buttonBox.accepted.disconnect()
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)
        self.buttonBox.addButton(QDialogButtonBox.Help)
        self.buttonBox.helpRequested.connect(self.help_requested)

        self.export_text = self.tr("Export")
        self.set_button_to_export_action = QAction(self.export_text, None)
        self.set_button_to_export_action.triggered.connect(
            self.set_button_to_export)

        self.export_without_validation_text = self.tr(
            "Export without validation")
        self.set_button_to_export_without_validation_action = QAction(
            self.export_without_validation_text, None)
        self.set_button_to_export_without_validation_action.triggered.connect(
            self.set_button_to_export_without_validation)

        self.edit_command_action = QAction(self.tr("Edit ili2db command"),
                                           None)
        self.edit_command_action.triggered.connect(self.edit_command)

        self.export_tool_button.addAction(
            self.set_button_to_export_without_validation_action)
        self.export_tool_button.addAction(self.edit_command_action)
        self.export_tool_button.setText(self.export_text)
        self.export_tool_button.clicked.connect(self.accepted)

        self.xtf_file_browse_button.clicked.connect(
            make_save_file_selector(
                self.xtf_file_line_edit,
                title=self.tr("Save in XTF Transfer File"),
                file_filter=self.
                tr("XTF Transfer File (*.xtf *XTF);;Interlis 1 Transfer File (*.itf *ITF);;XML (*.xml *XML);;GML (*.gml *GML)"
                   ),
                extension=".xtf",
                extensions=["." + ext for ext in self.ValidExtensions],
            ))
        self.xtf_file_browse_button.clicked.connect(
            self.xtf_browser_opened_to_true)
        self.xtf_browser_was_opened = False

        self.type_combo_box.clear()
        self._lst_panel = dict()

        for db_id in self.db_simple_factory.get_db_list(False):
            self.type_combo_box.addItem(displayDbIliMode[db_id], db_id)
            db_factory = self.db_simple_factory.create_factory(db_id)
            item_panel = db_factory.get_config_panel(self, DbActionType.EXPORT)
            self._lst_panel[db_id] = item_panel
            self.db_layout.addWidget(item_panel)

        self.validators = Validators()

        fileValidator = FileValidator(
            pattern=["*." + ext for ext in self.ValidExtensions],
            allow_non_existing=True,
        )

        self.xtf_file_line_edit.setValidator(fileValidator)
        self.xtf_file_line_edit.textChanged.connect(
            self.validators.validate_line_edits)
        self.xtf_file_line_edit.textChanged.connect(
            self.xtf_browser_opened_to_false)
        self.xtf_file_line_edit.textChanged.emit(
            self.xtf_file_line_edit.text())

        # Reset to export as default text
        self.xtf_file_line_edit.textChanged.connect(self.set_button_to_export)

        # refresh the models on changing values but avoid massive db connects by timer
        self.refreshTimer = QTimer()
        self.refreshTimer.setSingleShot(True)
        self.refreshTimer.timeout.connect(self.refresh_models)

        for key, value in self._lst_panel.items():
            value.notify_fields_modified.connect(
                self.request_for_refresh_models)

        self.validate_data = True  # validates exported data by default, We use --disableValidation when is False
        self.base_configuration = base_config
        self.restore_configuration()

        self.export_models_model = ExportModels()
        self.export_models_view.setModel(self.export_models_model)
        self.export_models_view.clicked.connect(self.export_models_model.check)
        self.export_models_view.space_pressed.connect(
            self.export_models_model.check)
        self.request_for_refresh_models()

        self.type_combo_box.currentIndexChanged.connect(self.type_changed)

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.txtStdout.setLayout(QGridLayout())
        self.txtStdout.layout().setContentsMargins(0, 0, 0, 0)
        self.txtStdout.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
Exemplo n.º 6
0
    def __init__(self, base_config, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.db_simple_factory = DbSimpleFactory()
        QgsGui.instance().enableAutoGeometryRestore(self)
        self.buttonBox.accepted.disconnect()
        self.buttonBox.clicked.connect(self.button_box_clicked)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)

        self.export_button_name = self.tr('Export')
        self.export_without_validate_button_name = self.tr(
            'Export without validation')

        self.buttonBox.addButton(self.export_button_name,
                                 QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(QDialogButtonBox.Help)
        self.buttonBox.helpRequested.connect(self.help_requested)
        self.xtf_file_browse_button.clicked.connect(
            make_save_file_selector(
                self.xtf_file_line_edit,
                title=self.tr('Save in XTF Transfer File'),
                file_filter=self.
                tr('XTF Transfer File (*.xtf *XTF);;Interlis 1 Transfer File (*.itf *ITF);;XML (*.xml *XML);;GML (*.gml *GML)'
                   ),
                extensions=['.' + ext for ext in self.ValidExtensions]))
        self.xtf_file_browse_button.clicked.connect(
            self.xtf_browser_opened_to_true)
        self.xtf_browser_was_opened = False

        self.type_combo_box.clear()
        self._lst_panel = dict()

        for db_id in self.db_simple_factory.get_db_list(False):
            self.type_combo_box.addItem(displayDbIliMode[db_id], db_id)
            db_factory = self.db_simple_factory.create_factory(db_id)
            item_panel = db_factory.get_config_panel(self, DbActionType.EXPORT)
            self._lst_panel[db_id] = item_panel
            self.db_layout.addWidget(item_panel)

        self.validators = Validators()

        fileValidator = FileValidator(
            pattern=['*.' + ext for ext in self.ValidExtensions],
            allow_non_existing=True)

        self.xtf_file_line_edit.setValidator(fileValidator)
        self.xtf_file_line_edit.textChanged.connect(
            self.validators.validate_line_edits)
        self.xtf_file_line_edit.textChanged.connect(
            self.xtf_browser_opened_to_false)
        self.xtf_file_line_edit.textChanged.emit(
            self.xtf_file_line_edit.text())

        # Remove export without validate button when xtf change
        self.xtf_file_line_edit.textChanged.connect(
            self.remove_export_without_validate_button)

        #refresh the models on changing values but avoid massive db connects by timer
        self.refreshTimer = QTimer()
        self.refreshTimer.setSingleShot(True)
        self.refreshTimer.timeout.connect(self.refresh_models)

        for key, value in self._lst_panel.items():
            value.notify_fields_modified.connect(
                self.request_for_refresh_models)

        self.validate_data = True  # validates exported data by default, We use --disableValidation when is False
        self.base_configuration = base_config
        self.restore_configuration()

        self.export_models_model = ExportModels()
        self.refresh_models()

        self.type_combo_box.currentIndexChanged.connect(self.type_changed)