def __init__(self, configuration, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.configuration = configuration 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)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) QgsGui.instance().enableAutoGeometryRestore(self) self.toml_file_key = None self.buttonBox.accepted.disconnect() self.buttonBox.accepted.connect(self.accepted) self.buttonBox.rejected.disconnect() self.buttonBox.rejected.connect(self.rejected) self.toml_file_browse_button.clicked.connect( make_file_selector( self.toml_file_line_edit, title=self.tr('Open Extra Model Information File (*.toml)'), file_filter=self.tr('Extra Model Info File (*.toml)'))) self.validators = Validators() self.fileValidator = FileValidator(pattern='*.toml', allow_empty=True) self.toml_file_line_edit.setValidator(self.fileValidator) self.restore_configuration() self.toml_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.toml_file_line_edit.textChanged.emit( self.toml_file_line_edit.text())
def __init__(self, configuration, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.configuration = configuration 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) self.ili2db_tool_combobox.addItem('ili2pg', 'ili2pg') self.ili2db_tool_combobox.addItem('ili2gpkg', 'ili2gpkg') 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()
def type_changed(self): self.progress_bar.hide() if self.type_combo_box.currentData() == 'ili2pg': self.ili_config.show() self.pg_config.show() self.gpkg_config.hide() self.pg_schema_line_edit.setPlaceholderText( self.tr("[Leave empty to create a default schema]")) elif self.type_combo_box.currentData() == 'pg': self.ili_config.hide() self.pg_config.show() self.gpkg_config.hide() self.pg_schema_line_edit.setPlaceholderText( self.tr("[Leave empty to load all schemas in the database]")) elif self.type_combo_box.currentData() == 'gpkg': self.ili_config.hide() self.pg_config.hide() self.gpkg_config.show() self.gpkg_file_line_edit.setValidator(self.gpkgOpenFileValidator) self.gpkg_file_line_edit.textChanged.emit( self.gpkg_file_line_edit.text()) try: self.gpkg_file_browse_button.clicked.disconnect() except: pass self.gpkg_file_browse_button.clicked.connect( make_file_selector( self.gpkg_file_line_edit, title=self.tr('Open GeoPackage database file'), file_filter=self.tr('GeoPackage Database (*.gpkg)'))) elif self.type_combo_box.currentData() == 'ili2gpkg': self.ili_config.show() self.pg_config.hide() self.gpkg_config.show() self.gpkg_file_line_edit.setValidator(self.gpkgSaveFileValidator) self.gpkg_file_line_edit.textChanged.emit( self.gpkg_file_line_edit.text()) try: self.gpkg_file_browse_button.clicked.disconnect() except: pass self.gpkg_file_browse_button.clicked.connect( 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'))
def __init__(self, iface, base_config, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.iface = iface QgsGui.instance().enableAutoGeometryRestore(self) self.buttonBox.accepted.disconnect() self.buttonBox.accepted.connect(self.accepted) self.buttonBox.clear() self.buttonBox.addButton(QDialogButtonBox.Cancel) create_button = self.buttonBox.addButton(self.tr('Create'), QDialogButtonBox.AcceptRole) create_button.setDefault(True) self.ili_file_browse_button.clicked.connect( make_file_selector( self.ili_file_line_edit, title=self.tr('Open Interlis Model'), file_filter=self.tr('Interlis Model File (*.ili)'))) self.buttonBox.addButton(QDialogButtonBox.Help) self.buttonBox.helpRequested.connect(self.help_requested) self.crs = QgsCoordinateReferenceSystem() self.ili2db_options = Ili2dbOptionsDialog() self.ili2db_options_button.clicked.connect(self.ili2db_options.open) self.ili2db_options.finished.connect(self.fill_toml_file_info_label) self.multiple_models_dialog = MultipleModelsDialog(self) self.multiple_models_button.clicked.connect( self.multiple_models_dialog.open) self.multiple_models_dialog.accepted.connect( self.fill_models_line_edit) self.type_combo_box.clear() self.type_combo_box.addItem(self.tr('Interlis (use PostGIS)'), 'ili2pg') self.type_combo_box.addItem(self.tr('Interlis (use GeoPackage)'), 'ili2gpkg') self.type_combo_box.addItem(self.tr('PostGIS'), 'pg') self.type_combo_box.addItem(self.tr('GeoPackage'), 'gpkg') self.type_combo_box.currentIndexChanged.connect(self.type_changed) self.txtStdout.anchorClicked.connect(self.link_activated) self.crsSelector.crsChanged.connect(self.crs_changed) self.base_configuration = base_config 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) self.validators = Validators() nonEmptyValidator = NonEmptyStringValidator() fileValidator = FileValidator(pattern='*.ili', allow_empty=True) self.gpkgSaveFileValidator = FileValidator(pattern='*.gpkg', allow_non_existing=True) self.gpkgOpenFileValidator = FileValidator(pattern='*.gpkg') self.gpkg_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.restore_configuration() self.ili_models_line_edit.setValidator(nonEmptyValidator) self.pg_host_line_edit.setValidator(nonEmptyValidator) self.pg_database_line_edit.setValidator(nonEmptyValidator) self.pg_user_line_edit.setValidator(nonEmptyValidator) self.ili_file_line_edit.setValidator(fileValidator) self.pg_host_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_host_line_edit.textChanged.emit(self.pg_host_line_edit.text()) self.pg_database_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_database_line_edit.textChanged.emit( self.pg_database_line_edit.text()) self.pg_user_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_user_line_edit.textChanged.emit(self.pg_user_line_edit.text()) self.pg_use_super_login.setText( self.tr('Generate schema with superuser login from settings ({})'). format(base_config.super_pg_user)) self.ili_models_line_edit.textChanged.connect( self.validators.validate_line_edits) self.ili_models_line_edit.textChanged.emit( self.ili_models_line_edit.text()) self.ili_models_line_edit.textChanged.connect(self.on_model_changed) self.ili_models_line_edit.textChanged.connect( self.complete_models_completer) self.ili_models_line_edit.punched.connect( self.complete_models_completer) self.ilicache = IliCache(self.base_configuration) self.refresh_ili_cache() self.ili_models_line_edit.setPlaceholderText( self.tr('[Search model from repository]')) self.ili_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.ili_file_line_edit.textChanged.connect(self.ili_file_changed) self.ili_file_line_edit.textChanged.emit( self.ili_file_line_edit.text())
def __init__(self, base_config, parent=None): QDialog.__init__(self, parent) self.setupUi(self) QgsGui.instance().enableAutoGeometryRestore(self) self.buttonBox.accepted.disconnect() self.buttonBox.accepted.connect(self.accepted) self.buttonBox.clear() self.buttonBox.addButton(QDialogButtonBox.Cancel) self.buttonBox.addButton(self.tr('Export'), 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);;Interlis 1 Transfer File (*.itf);;XML (*.xml);;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.gpkg_file_browse_button.clicked.connect( make_file_selector( self.gpkg_file_line_edit, title=self.tr('Open GeoPackage database file'), file_filter=self.tr('GeoPackage Database (*.gpkg)'))) self.type_combo_box.clear() self.type_combo_box.addItem(self.tr('PostGIS'), 'pg') self.type_combo_box.addItem(self.tr('GeoPackage'), 'gpkg') self.type_combo_box.currentIndexChanged.connect(self.type_changed) self.base_configuration = base_config self.restore_configuration() self.validators = Validators() nonEmptyValidator = NonEmptyStringValidator() fileValidator = FileValidator( pattern=['*.' + ext for ext in self.ValidExtensions], allow_non_existing=True) gpkgFileValidator = FileValidator(pattern='*.gpkg') self.pg_host_line_edit.setValidator(nonEmptyValidator) self.pg_database_line_edit.setValidator(nonEmptyValidator) self.pg_user_line_edit.setValidator(nonEmptyValidator) self.xtf_file_line_edit.setValidator(fileValidator) self.gpkg_file_line_edit.setValidator(gpkgFileValidator) self.pg_host_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_host_line_edit.textChanged.emit(self.pg_host_line_edit.text()) self.pg_database_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_database_line_edit.textChanged.emit( self.pg_database_line_edit.text()) self.pg_user_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_user_line_edit.textChanged.emit(self.pg_user_line_edit.text()) 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()) self.gpkg_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.gpkg_file_line_edit.textChanged.emit( self.gpkg_file_line_edit.text()) #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) self.pg_host_line_edit.textChanged.connect( self.request_for_refresh_models) self.pg_port_line_edit.textChanged.connect( self.request_for_refresh_models) self.pg_database_line_edit.textChanged.connect( self.request_for_refresh_models) self.pg_schema_line_edit.textChanged.connect( self.request_for_refresh_models) self.pg_user_line_edit.textChanged.connect( self.request_for_refresh_models) self.pg_password_line_edit.textChanged.connect( self.request_for_refresh_models) self.gpkg_file_line_edit.textChanged.connect( self.request_for_refresh_models) self.export_models_model = ExportModels(None, None, None) self.refreshed_export_models_model() 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)
def __init__(self, base_config, parent=None): QDialog.__init__(self, parent) self.setupUi(self) QgsGui.instance().enableAutoGeometryRestore(self); self.buttonBox.accepted.disconnect() self.buttonBox.accepted.connect(self.accepted) self.buttonBox.clear() self.buttonBox.addButton(QDialogButtonBox.Cancel) self.buttonBox.addButton( self.tr('Import Data'), QDialogButtonBox.AcceptRole) self.buttonBox.addButton(QDialogButtonBox.Help) self.buttonBox.helpRequested.connect(self.help_requested) self.xtf_file_browse_button.clicked.connect( make_file_selector(self.xtf_file_line_edit, title=self.tr('Open Transfer or Catalog File'), file_filter=self.tr('Transfer File (*.xtf *.itf);;Catalogue File(*.xml *.xls *.xlsx)'))) self.gpkg_file_browse_button.clicked.connect( make_save_file_selector(self.gpkg_file_line_edit, title=self.tr('Save in GeoPackage database file'), file_filter=self.tr('GeoPackage Database (*.gpkg)'), extension='.gpkg')) self.type_combo_box.clear() self.type_combo_box.addItem(self.tr('PostGIS'), 'pg') self.type_combo_box.addItem(self.tr('GeoPackage'), 'gpkg') self.type_combo_box.currentIndexChanged.connect(self.type_changed) self.ili2db_options = Ili2dbOptionsDialog() self.ili2db_options_button.clicked.connect(self.ili2db_options.open) self.ili2db_options.finished.connect(self.fill_toml_file_info_label) self.multiple_models_dialog = MultipleModelsDialog(self) self.multiple_models_button.clicked.connect( self.multiple_models_dialog.open) self.multiple_models_dialog.accepted.connect( self.fill_models_line_edit) self.base_configuration = base_config self.restore_configuration() self.validators = Validators() nonEmptyValidator = NonEmptyStringValidator() fileValidator = FileValidator( pattern=['*.xtf', '*.itf', '*.pdf', '*.xml', '*.xls', '*.xlsx']) gpkgFileValidator = FileValidator( pattern='*.gpkg', allow_non_existing=True) self.pg_host_line_edit.setValidator(nonEmptyValidator) self.pg_database_line_edit.setValidator(nonEmptyValidator) self.pg_user_line_edit.setValidator(nonEmptyValidator) self.xtf_file_line_edit.setValidator(fileValidator) self.gpkg_file_line_edit.setValidator(gpkgFileValidator) self.ili_models_line_edit.setPlaceholderText(self.tr('[Search model in repository]')) self.ili_models_line_edit.textChanged.connect(self.complete_models_completer) self.ili_models_line_edit.punched.connect(self.complete_models_completer) self.pg_host_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_host_line_edit.textChanged.emit(self.pg_host_line_edit.text()) self.pg_database_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_database_line_edit.textChanged.emit( self.pg_database_line_edit.text()) self.pg_user_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_user_line_edit.textChanged.emit(self.pg_user_line_edit.text()) self.pg_use_super_login.setText( self.tr('Generate schema with superuser login from settings ({})').format(base_config.super_pg_user)) self.xtf_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.xtf_file_line_edit.textChanged.emit( self.xtf_file_line_edit.text()) self.gpkg_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.gpkg_file_line_edit.textChanged.emit( self.gpkg_file_line_edit.text()) settings = QSettings() ilifile = settings.value('QgsProjectGenerator/ili2db/ilifile') self.ilicache = IliCache(base_config, ilifile or None) self.update_models_completer() self.ilicache.refresh()
def __init__(self, base_config, parent=None): QDialog.__init__(self, parent) self.setupUi(self) self.buttonBox.accepted.disconnect() self.buttonBox.accepted.connect(self.accepted) self.buttonBox.clear() self.buttonBox.addButton(QDialogButtonBox.Cancel) self.buttonBox.addButton( self.tr('Export'), 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)'), extension='.xtf')) self.xtf_file_browse_button.clicked.connect( self.xtf_browser_opened_to_true) self.xtf_browser_was_opened = False self.gpkg_file_browse_button.clicked.connect( make_file_selector(self.gpkg_file_line_edit, title=self.tr('Open GeoPackage database file'), file_filter=self.tr('GeoPackage Database (*.gpkg)'))) self.type_combo_box.clear() self.type_combo_box.addItem(self.tr('PostGIS'), 'pg') self.type_combo_box.addItem(self.tr('GeoPackage'), 'gpkg') self.type_combo_box.currentIndexChanged.connect(self.type_changed) self.multiple_models_dialog = MultipleModelsDialog(self) self.multiple_models_button.clicked.connect( self.multiple_models_dialog.open) self.multiple_models_dialog.accepted.connect( self.fill_models_line_edit) self.base_configuration = base_config self.restore_configuration() self.validators = Validators() nonEmptyValidator = NonEmptyStringValidator() fileValidator = FileValidator(pattern='*.xtf', allow_non_existing=True) gpkgFileValidator = FileValidator(pattern='*.gpkg') self.ili_models_line_edit.setValidator(nonEmptyValidator) self.pg_host_line_edit.setValidator(nonEmptyValidator) self.pg_database_line_edit.setValidator(nonEmptyValidator) self.pg_user_line_edit.setValidator(nonEmptyValidator) self.xtf_file_line_edit.setValidator(fileValidator) self.gpkg_file_line_edit.setValidator(gpkgFileValidator) self.ili_models_line_edit.textChanged.connect( self.validators.validate_line_edits) self.ili_models_line_edit.textChanged.emit( self.ili_models_line_edit.text()) self.pg_host_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_host_line_edit.textChanged.emit(self.pg_host_line_edit.text()) self.pg_database_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_database_line_edit.textChanged.emit( self.pg_database_line_edit.text()) self.pg_user_line_edit.textChanged.connect( self.validators.validate_line_edits) self.pg_user_line_edit.textChanged.emit(self.pg_user_line_edit.text()) 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()) self.gpkg_file_line_edit.textChanged.connect( self.validators.validate_line_edits) self.gpkg_file_line_edit.textChanged.emit( self.gpkg_file_line_edit.text()) settings = QSettings() ilifile = settings.value('QgsProjectGenerator/ili2db/ilifile') self.ilicache = IliCache(base_config, ilifile or None) self.ilicache.models_changed.connect(self.update_models_completer) self.ilicache.refresh()