Ejemplo n.º 1
0
    def __init__(self, request_id, supply_type, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        self.request_id = request_id
        self.supply_type = supply_type
        self.st_utils = STUtils()

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.upload_file)
        self.buttonBox.helpRequested.connect(self.show_help)
        self.btn_browse_file.clicked.connect(
            make_file_selector(
                self.txt_file_path,
                QCoreApplication.translate(
                    "STUploadFileDialog",
                    "Select the file you want to upload to the transitional system"
                ),
                QCoreApplication.translate(
                    "STUploadFileDialog",
                    'INTERLIS 2 transfer format (*.xtf)')))

        self.initialize_progress()

        self.restore_settings()

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
Ejemplo n.º 2
0
    def __init__(self, controller, parent=None):
        QgsPanelWidget.__init__(self, None)
        self.setupUi(self)
        self.__controller = controller
        self.parent = parent
        self.app = AppInterface()
        self.logger = Logger()
        self.__mode = EnumQualityRulePanelMode.VALIDATE

        self.__selected_items_list = list()
        self.__icon_names = ['schema.png', 'points.png', 'lines.png', 'polygons.png', 'relationships.svg']

        self.txt_search.addAction(QIcon(":/Asistente-LADM-COL/resources/images/search.png"), QLineEdit.LeadingPosition)

        self.setDockMode(True)
        self.setPanelTitle(QCoreApplication.translate("QualityRulesInitialPanelWidget", "Quality Rules"))

        self.tab.setTabEnabled(TAB_READ_INDEX, False)  # TODO: Remove when implemented
        self.__restore_settings()

        # TODO: uncomment the following block when implemented
        self.lbl_presets.setEnabled(False)
        self.cbo_presets.setEnabled(False)
        self.btn_save_selection.setEnabled(False)
        self.btn_delete_selection.setEnabled(False)

        self.txt_search.textChanged.connect(self.__search_text_changed)
        self.btn_validate.clicked.connect(self.__validate_clicked)
        self.btn_read.clicked.connect(self.__read_clicked)
        self.btn_help.clicked.connect(self.__show_help)
        self.trw_qrs.itemSelectionChanged.connect(self.__selection_changed)
        self.tab.currentChanged.connect(self.__tab_changed)

        dir_selector = make_folder_selector(self.txt_dir_path,
                                            title=QCoreApplication.translate("QualityRulesInitialPanelWidget",
                                                                             "Select a folder to store quality errors"),
                                            parent=None,
                                            setting_property="qr_results_dir_path")
        self.btn_dir_path.clicked.connect(dir_selector)

        db_file_selector = make_file_selector(self.txt_db_path,
                                              title=QCoreApplication.translate("QualityRulesInitialPanelWidget",
                                                                               "Open GeoPackage database file with quality errors"),
                                              file_filter=QCoreApplication.translate("QualityRulesInitialPanelWidget",
                                                                                     "GeoPackage Database (*.gpkg)"),
                                              setting_property="qr_db_file_path")

        self.btn_db_path.clicked.connect(db_file_selector)

        self.__tab_changed(self.tab.currentIndex())  # Direct call to initialize controls
    def __init__(self, iface, db):
        QWizard.__init__(self)
        self.setupUi(self)
        self.iface = iface
        self._db = db
        self.logger = Logger()
        self.app = AppInterface()

        self.names = self._db.names
        self.help_strings = HelpStrings()

        self._layers = {
            self.names.LC_BOUNDARY_POINT_T: None,
            self.names.LC_SURVEY_POINT_T: None,
            self.names.LC_CONTROL_POINT_T: None
        }

        self.target_layer = None

        # Auxiliary data to set nonlinear next pages
        self.pages = [self.wizardPage1, self.wizardPage2, self.wizardPage3]
        self.dict_pages_ids = {self.pages[idx] : pid for idx, pid in enumerate(self.pageIds())}

        self.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.PointLayer)

        # Set connections
        self.btn_browse_file.clicked.connect(
            make_file_selector(self.txt_file_path,
                               file_filter=QCoreApplication.translate("WizardTranslations",'CSV File (*.csv *.txt)')))
        self.txt_file_path.textChanged.connect(self.file_path_changed)
        self.crsSelector.crsChanged.connect(self.crs_changed)
        self.crs = ""  # SRS auth id
        self.txt_delimiter.textChanged.connect(self.fill_long_lat_combos)
        self.mMapLayerComboBox.layerChanged.connect(self.import_layer_changed)

        self.known_delimiters = [
            {'name': ';', 'value': ';'},
            {'name': ',', 'value': ','},
            {'name': 'tab', 'value': '\t'},
            {'name': 'space', 'value': ' '},
            {'name': '|', 'value': '|'},
            {'name': '~', 'value': '~'},
            {'name': 'Other', 'value': ''}
        ]
        self.cbo_delimiter.addItems([ item['name'] for item in self.known_delimiters ])
        self.cbo_delimiter.currentTextChanged.connect(self.separator_changed)

        self.restore_settings()

        self.txt_file_path.textChanged.emit(self.txt_file_path.text())

        self.rad_boundary_point.toggled.connect(self.point_option_changed)
        self.rad_control_point.toggled.connect(self.point_option_changed)
        self.rad_csv.toggled.connect(self.adjust_page_2_controls)
        self.point_option_changed() # Initialize it
        self.button(QWizard.FinishButton).clicked.connect(self.finished_dialog)
        self.currentIdChanged.connect(self.current_page_changed)

        self.txt_help_page_2.setHtml(self.help_strings.WIZ_ADD_POINTS_SURVEY_PAGE_2_OPTION_CSV)

        self.wizardPage2.setButtonText(QWizard.FinishButton,
                                       QCoreApplication.translate("WizardTranslations",
                                            "Import"))
        self.txt_help_page_3.setHtml(self.help_strings.WIZ_ADD_POINTS_SURVEY_PAGE_3_OPTION_CSV)
        self.txt_help_page_3.anchorClicked.connect(self.save_template)
        self.button(QWizard.HelpButton).clicked.connect(self.show_help)
        self.rejected.connect(self.close_wizard)

        # Set MessageBar for QWizard
        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.setLayout(QGridLayout())
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
Ejemplo n.º 4
0
    def __init__(self, ):
        QWidget.__init__(self)
        self.setupUi(self)
        self.logger = Logger()
        self.app = AppInterface()

        self.validators = Validators()

        self.restore_settings()

        self.btn_browse_file_predio_bloqueo.clicked.connect(
            make_file_selector(
                self.txt_file_path_predio_bloqueo,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the predio sanción .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_predio.clicked.connect(
            make_file_selector(
                self.txt_file_path_predio,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the predio .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_direccion.clicked.connect(
            make_file_selector(
                self.txt_file_path_direccion,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the dirección .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_uni.clicked.connect(
            make_file_selector(
                self.txt_file_path_uni,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the unidad construcción .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_uni_comp.clicked.connect(
            make_file_selector(
                self.txt_file_path_uni_comp,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the unidad construcción comp .csv file with SNC data "
                ),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_persona.clicked.connect(
            make_file_selector(
                self.txt_file_path_persona,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the persona .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_persona_predio.clicked.connect(
            make_file_selector(
                self.txt_file_path_persona_predio,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the persona predio .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_ficha_m.clicked.connect(
            make_file_selector(
                self.txt_file_path_ficha_m,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the ficha matriz .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_ficha_m_predio.clicked.connect(
            make_file_selector(
                self.txt_file_path_ficha_m_predio,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the ficha matriz predio .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_ficha_m_torre.clicked.connect(
            make_file_selector(
                self.txt_file_path_ficha_m_torre,
                QCoreApplication.translate(
                    "SNCDataSourceWidget",
                    "Select the ficha matriz torre .csv file with SNC data "),
                QCoreApplication.translate("SNCDataSourceWidget",
                                           'CSV File (*.csv)'),
                setting_property="snc_files_path"))

        self.btn_browse_file_gdb.clicked.connect(
            make_folder_selector(self.txt_file_path_gdb,
                                 QCoreApplication.translate(
                                     "SNCDataSourceWidget", "Open GDB folder"),
                                 None,
                                 setting_property="snc_files_path"))

        file_validator_optional = FileValidator(pattern='*.csv',
                                                allow_empty=True)
        file_validator_csv = FileValidator(pattern='*.csv',
                                           allow_non_existing=False)
        dir_validator_gdb = DirValidator(pattern='*.gdb',
                                         allow_non_existing=False)

        self.txt_file_path_predio_bloqueo.setValidator(file_validator_optional)
        self.txt_file_path_predio.setValidator(file_validator_csv)
        self.txt_file_path_direccion.setValidator(file_validator_csv)
        self.txt_file_path_uni.setValidator(file_validator_csv)
        self.txt_file_path_uni_comp.setValidator(file_validator_csv)
        self.txt_file_path_persona.setValidator(file_validator_csv)
        self.txt_file_path_persona_predio.setValidator(file_validator_csv)
        self.txt_file_path_ficha_m.setValidator(file_validator_optional)
        self.txt_file_path_ficha_m_predio.setValidator(file_validator_optional)
        self.txt_file_path_ficha_m_torre.setValidator(file_validator_optional)
        self.txt_file_path_gdb.setValidator(dir_validator_gdb)

        self.txt_file_path_predio_bloqueo.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_predio.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_direccion.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_uni.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_uni_comp.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_persona.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_persona_predio.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_ficha_m.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_ficha_m_predio.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_ficha_m_torre.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_gdb.textChanged.connect(
            self.validators.validate_line_edits)

        self.txt_file_path_predio_bloqueo.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_predio.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_direccion.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_uni.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_uni_comp.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_persona.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_persona_predio.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_ficha_m.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_ficha_m_predio.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_ficha_m_torre.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_gdb.textChanged.connect(
            self.emit_input_data_changed)

        # Trigger validations right now
        self.txt_file_path_predio_bloqueo.textChanged.emit(
            self.txt_file_path_predio_bloqueo.text())
        self.txt_file_path_predio.textChanged.emit(
            self.txt_file_path_predio.text())
        self.txt_file_path_direccion.textChanged.emit(
            self.txt_file_path_direccion.text())
        self.txt_file_path_uni.textChanged.emit(self.txt_file_path_uni.text())
        self.txt_file_path_uni_comp.textChanged.emit(
            self.txt_file_path_uni_comp.text())
        self.txt_file_path_persona.textChanged.emit(
            self.txt_file_path_persona.text())
        self.txt_file_path_persona_predio.textChanged.emit(
            self.txt_file_path_persona_predio.text())
        self.txt_file_path_ficha_m.textChanged.emit(
            self.txt_file_path_ficha_m.text())
        self.txt_file_path_ficha_m_predio.textChanged.emit(
            self.txt_file_path_ficha_m_predio.text())
        self.txt_file_path_ficha_m_torre.textChanged.emit(
            self.txt_file_path_ficha_m_torre.text())
        self.txt_file_path_gdb.textChanged.emit(self.txt_file_path_gdb.text())
Ejemplo n.º 5
0
    def __init__(self,
                 iface,
                 conn_manager,
                 context,
                 link_to_import_schema=True,
                 parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        QgsGui.instance().enableAutoGeometryRestore(self)
        self.iface = iface
        self.conn_manager = conn_manager
        self.db_source = context.get_db_sources()[0]
        self.link_to_import_schema = link_to_import_schema
        self.db = self.conn_manager.get_db_connector_from_source(
            self.db_source)
        self.base_configuration = BaseConfiguration()
        self.logger = Logger()
        self.app = AppInterface()
        self.__ladmcol_models = LADMColModelRegistry()

        self.java_dependency = JavaDependency()
        self.java_dependency.download_dependency_completed.connect(
            self.download_java_complete)
        self.java_dependency.download_dependency_progress_changed.connect(
            self.download_java_progress_change)

        self.ilicache = IliCache(self.base_configuration)
        self.ilicache.refresh()

        self._dbs_supported = ConfigDBsSupported()
        self._running_tool = False

        # There may be 1 case where we need to emit a db_connection_changed from the Import Data dialog:
        #   1) Connection Settings was opened and the DB conn was changed.
        self._db_was_changed = False  # To postpone calling refresh gui until we close this dialog instead of settings

        # Similarly, we could call a refresh on layers and relations cache in 1 case:
        #   1) If the ID dialog was called for the COLLECTED source: opening Connection Settings and changing the DB
        #      connection.
        self._schedule_layers_and_relations_refresh = False

        # We need bar definition above calling clear_messages
        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

        self.xtf_file_browse_button.clicked.connect(
            make_file_selector(
                self.xtf_file_line_edit,
                title=QCoreApplication.translate(
                    "DialogImportData", "Open Transfer or Catalog File"),
                file_filter=QCoreApplication.translate(
                    "DialogImportData",
                    'Transfer File (*.xtf *.itf);;Catalogue File (*.xml *.xls *.xlsx)'
                )))

        self.validators = Validators()
        self.xtf_file_line_edit.setPlaceholderText(
            QCoreApplication.translate("DialogImportData",
                                       "[Name of the XTF to be imported]"))
        fileValidator = FileValidator(pattern=['*.xtf', '*.itf', '*.xml'])
        self.xtf_file_line_edit.setValidator(fileValidator)
        self.xtf_file_line_edit.textChanged.connect(self.update_import_models)
        self.xtf_file_line_edit.textChanged.emit(
            self.xtf_file_line_edit.text())

        # db
        self.connection_setting_button.clicked.connect(self.show_settings)
        self.connection_setting_button.setText(
            QCoreApplication.translate("DialogImportData",
                                       "Connection Settings"))

        # LOG
        self.log_config.setTitle(
            QCoreApplication.translate("DialogImportData", "Show log"))

        self.buttonBox.accepted.disconnect()
        self.buttonBox.clicked.connect(self.accepted_import_data)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)
        self._accept_button = self.buttonBox.addButton(
            self.BUTTON_NAME_IMPORT_DATA, QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(QDialogButtonBox.Help)
        self.buttonBox.helpRequested.connect(self.show_help)

        self.update_connection_info()
        self.restore_configuration()
Ejemplo n.º 6
0
    def __init__(self, iface, db, qgis_utils, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.iface = iface
        self._db = db
        self.qgis_utils = qgis_utils
        self.logger = Logger()
        self.help_strings = HelpStrings()
        self.log_dialog_excel_text_content = ""
        self.group_parties_exists = False
        self.names = self._db.names
        self._running_tool = False
        self.tool_name = QCoreApplication.translate(
            "ImportFromExcelDialog", "Import intermediate structure")

        self.fields = {
            EXCEL_SHEET_NAME_PLOT: [
                EXCEL_SHEET_TITLE_DEPARTMENT, EXCEL_SHEET_TITLE_MUNICIPALITY,
                EXCEL_SHEET_TITLE_ZONE, EXCEL_SHEET_TITLE_REGISTRATION_PLOT,
                EXCEL_SHEET_TITLE_NPN, EXCEL_SHEET_TITLE_NPV,
                EXCEL_SHEET_TITLE_PLOT_NAME, EXCEL_SHEET_TITLE_VALUATION,
                EXCEL_SHEET_TITLE_PLOT_CONDITION, EXCEL_SHEET_TITLE_PLOT_TYPE,
                EXCEL_SHEET_TITLE_ADDRESS
            ],
            EXCEL_SHEET_NAME_PARTY: [
                EXCEL_SHEET_TITLE_FIRST_NAME, EXCEL_SHEET_TITLE_MIDDLE,
                EXCEL_SHEET_TITLE_FIRST_SURNAME,
                EXCEL_SHEET_TITLE_SECOND_SURNAME,
                EXCEL_SHEET_TITLE_BUSINESS_NAME, EXCEL_SHEET_TITLE_SEX,
                EXCEL_SHEET_TITLE_DOCUMENT_TYPE,
                EXCEL_SHEET_TITLE_DOCUMENT_NUMBER,
                EXCEL_SHEET_TITLE_KIND_PERSON,
                EXCEL_SHEET_TITLE_ISSUING_ENTITY, EXCEL_SHEET_TITLE_DATE_ISSUE,
                EXCEL_SHEET_TITLE_NPN
            ],
            EXCEL_SHEET_NAME_GROUP: [
                EXCEL_SHEET_TITLE_NPN, EXCEL_SHEET_TITLE_DOCUMENT_TYPE,
                EXCEL_SHEET_TITLE_DOCUMENT_NUMBER, EXCEL_SHEET_TITLE_ID_GROUP
            ],
            EXCEL_SHEET_NAME_RIGHT: [
                EXCEL_SHEET_TITLE_TYPE,
                EXCEL_SHEET_TITLE_PARTY_DOCUMENT_NUMBER,
                EXCEL_SHEET_TITLE_GROUP, EXCEL_SHEET_TITLE_NPN,
                EXCEL_SHEET_TITLE_SOURCE_TYPE,
                EXCEL_SHEET_TITLE_DESCRIPTION_SOURCE,
                EXCEL_SHEET_TITLE_STATE_SOURCE,
                EXCEL_SHEET_TITLE_OFFICIALITY_SOURCE,
                EXCEL_SHEET_TITLE_STORAGE_PATH
            ]
        }

        self.txt_help_page.setHtml(self.help_strings.DLG_IMPORT_FROM_EXCEL)
        self.txt_help_page.anchorClicked.connect(self.save_template)

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        #self.buttonBox.rejected.connect(self.rejected)
        self.buttonBox.helpRequested.connect(self.show_help)
        self.btn_browse_file.clicked.connect(
            make_file_selector(
                self.txt_excel_path,
                QCoreApplication.translate(
                    "ImportFromExcelDialog",
                    "Select the Excel file with data in the intermediate structure"
                ),
                QCoreApplication.translate("ImportFromExcelDialog",
                                           'Excel File (*.xlsx *.xls)')))
        self.buttonBox.button(QDialogButtonBox.Ok).setText(
            QCoreApplication.translate("ImportFromExcelDialog", "Import"))

        self.initialize_feedback()
        self.restore_settings()

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        # self.tabWidget.currentWidget().layout().setContentsMargins(0, 0, 0, 0)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
Ejemplo n.º 7
0
    def __init__(self, iface, db, qgis_utils, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.iface = iface
        self._db = db
        self.qgis_utils = qgis_utils
        self.log = QgsApplication.messageLog()
        self.help_strings = HelpStrings()

        self.fields = {
            'interesado': [
                'nombre1', 'nombre2', 'apellido1', 'apellido2', 'razon social',
                'sexo persona', 'tipo documento', 'numero de documento',
                'tipo persona', 'organo emisor del documento',
                'fecha emision del documento'
            ],
            'predio': [
                'departamento', 'municipio', 'zona', 'matricula predio',
                'numero predial nuevo', 'numero predial viejo',
                'nombre predio', 'avaluo', 'tipo predio'
            ],
            'agrupacion': [
                'numero predial nuevo', 'tipo documento',
                'numero de documento', 'id agrupación'
            ],
            'derecho': [
                'tipo', 'número documento Interesado', 'agrupación',
                'numero predial nuevo', 'tipo de fuente',
                'Descripción de la fuente',
                'estado_disponibilidad de la fuente', 'Es oficial la fuente',
                'Ruta de Almacenamiento de la fuente'
            ]
        }

        self.txt_help_page.setHtml(self.help_strings.DLG_IMPORT_FROM_EXCEL)
        self.txt_help_page.anchorClicked.connect(self.save_template)

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.rejected.connect(self.rejected)
        self.buttonBox.helpRequested.connect(self.show_help)
        self.btn_browse_file.clicked.connect(
            make_file_selector(
                self.txt_excel_path,
                QCoreApplication.translate(
                    "DialogImportFromExcel",
                    "Select the Excel file with data in the intermediate structure"
                ),
                QCoreApplication.translate("DialogImportFromExcel",
                                           'Excel File (*.xlsx *.xls)')))
        self.buttonBox.button(QDialogButtonBox.Ok).setText(
            QCoreApplication.translate("DialogImportFromExcel", "Import"))

        self.progress.setVisible(False)
        self.restore_settings()

        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.setLayout(QGridLayout())
        # self.tabWidget.currentWidget().layout().setContentsMargins(0, 0, 0, 0)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)
    def __init__(self, ):
        QWidget.__init__(self)
        self.setupUi(self)
        self.logger = Logger()
        self.app = AppInterface()

        self.validators = Validators()

        self.restore_settings()

        self.btn_browse_file_blo.clicked.connect(
            make_file_selector(
                self.txt_file_path_blo,
                QCoreApplication.translate(
                    "CobolDataSourceWidget",
                    "Select the BLO .lis file with Cobol data "),
                QCoreApplication.translate("CobolDataSourceWidget",
                                           'lis File (*.lis)'),
                folder_setting_key=self.app.settings.COBOL_FILES_DIR_KEY))

        self.btn_browse_file_uni.clicked.connect(
            make_file_selector(
                self.txt_file_path_uni,
                QCoreApplication.translate(
                    "CobolDataSourceWidget",
                    "Select the UNI .lis file with Cobol data "),
                QCoreApplication.translate("CobolDataSourceWidget",
                                           'lis File (*.lis)'),
                folder_setting_key=self.app.settings.COBOL_FILES_DIR_KEY))

        self.btn_browse_file_ter.clicked.connect(
            make_file_selector(
                self.txt_file_path_ter,
                QCoreApplication.translate(
                    "CobolDataSourceWidget",
                    "Select the TER .lis file with Cobol data "),
                QCoreApplication.translate("CobolDataSourceWidget",
                                           'lis File (*.lis)'),
                folder_setting_key=self.app.settings.COBOL_FILES_DIR_KEY))

        self.btn_browse_file_pro.clicked.connect(
            make_file_selector(
                self.txt_file_path_pro,
                QCoreApplication.translate(
                    "CobolDataSourceWidget",
                    "Select the PRO .lis file with Cobol data "),
                QCoreApplication.translate("CobolDataSourceWidget",
                                           'lis File (*.lis)'),
                folder_setting_key=self.app.settings.COBOL_FILES_DIR_KEY))

        self.btn_browse_file_gdb.clicked.connect(
            make_folder_selector(
                self.txt_file_path_gdb,
                QCoreApplication.translate("CobolDataSourceWidget",
                                           "Open GDB folder"), None,
                self.app.settings.COBOL_FILES_DIR_KEY))

        file_validator_blo = FileValidator(pattern='*.lis', allow_empty=True)
        file_validator_lis = FileValidator(pattern='*.lis',
                                           allow_non_existing=False)
        dir_validator_gdb = DirValidator(pattern='*.gdb',
                                         allow_non_existing=False)

        self.txt_file_path_blo.setValidator(file_validator_blo)
        self.txt_file_path_uni.setValidator(file_validator_lis)
        self.txt_file_path_ter.setValidator(file_validator_lis)
        self.txt_file_path_pro.setValidator(file_validator_lis)
        self.txt_file_path_gdb.setValidator(dir_validator_gdb)

        self.txt_file_path_blo.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_uni.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_ter.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_pro.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_gdb.textChanged.connect(
            self.validators.validate_line_edits)

        self.txt_file_path_blo.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_uni.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_ter.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_pro.textChanged.connect(
            self.emit_input_data_changed)
        self.txt_file_path_gdb.textChanged.connect(
            self.emit_input_data_changed)

        # Trigger validations right now
        self.txt_file_path_blo.textChanged.emit(self.txt_file_path_blo.text())
        self.txt_file_path_uni.textChanged.emit(self.txt_file_path_uni.text())
        self.txt_file_path_ter.textChanged.emit(self.txt_file_path_ter.text())
        self.txt_file_path_pro.textChanged.emit(self.txt_file_path_pro.text())
        self.txt_file_path_gdb.textChanged.emit(self.txt_file_path_gdb.text())
    def __init__(self, db, conn_manager, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self._db = db
        self.conn_manager = conn_manager
        self.parent = parent

        self.logger = Logger()
        self.app = AppInterface()
        self.validators = Validators()

        self.names = self._db.names
        self._dialog_mode = None
        self._running_tool = False
        self._db_was_changed = False  # To postpone calling refresh gui until we close this dialog instead of settings
        self.tool_name = ""
        self.gdb_layer_paths = dict()
        self.alphanumeric_file_paths = dict()

        # Initialize
        self.initialize_feedback()

        # Set MessageBar for QDialog
        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

        # Set connections
        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.button(QDialogButtonBox.Ok).setText(
            QCoreApplication.translate("MissingSuppliesBaseDialog", "Import"))
        self.finished.connect(self.finished_slot)

        self.btn_browse_file_predio.clicked.connect(
            make_file_selector(
                self.txt_file_path_predio,
                QCoreApplication.translate(
                    "MissingSuppliesBaseDialog",
                    "Select the Predio .csv file with SNC data "),
                QCoreApplication.translate("MissingSuppliesBaseDialog",
                                           'CSV File (*.csv)')))

        self.btn_browse_file_uni.clicked.connect(
            make_file_selector(
                self.txt_file_path_uni,
                QCoreApplication.translate(
                    "MissingSuppliesBaseDialog",
                    "Select the UNI .lis file with Cobol data "),
                QCoreApplication.translate("MissingSuppliesBaseDialog",
                                           'lis File (*.lis)')))

        self.btn_browse_file_gdb.clicked.connect(
            make_folder_selector(self.txt_file_path_gdb,
                                 title=QCoreApplication.translate(
                                     'MissingSuppliesBaseDialog',
                                     'Open GDB folder'),
                                 parent=None))

        self.btn_browse_file_folder_supplies.clicked.connect(
            make_folder_selector(self.txt_file_path_folder_supplies,
                                 title=QCoreApplication.translate(
                                     "MissingCobolSuppliesDialog",
                                     "Select folder to save data"),
                                 parent=None))

        # Set validations
        file_validator_predio = FileValidator(pattern='*.csv',
                                              allow_non_existing=False)
        file_validator_lis = FileValidator(pattern='*.lis',
                                           allow_non_existing=False)
        dir_validator_gdb = DirValidator(pattern='*.gdb',
                                         allow_non_existing=False)
        dir_validator_folder = DirValidator(pattern=None, allow_empty_dir=True)

        self.txt_file_path_predio.setValidator(file_validator_predio)
        self.txt_file_path_uni.setValidator(file_validator_lis)
        self.txt_file_path_gdb.setValidator(dir_validator_gdb)
        self.txt_file_path_folder_supplies.setValidator(dir_validator_folder)

        self.txt_file_path_predio.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_uni.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_gdb.textChanged.connect(
            self.validators.validate_line_edits)
        self.txt_file_path_folder_supplies.textChanged.connect(
            self.validators.validate_line_edits)

        self.txt_file_path_predio.textChanged.connect(self.input_data_changed)
        self.txt_file_path_uni.textChanged.connect(self.input_data_changed)
        self.txt_file_path_gdb.textChanged.connect(self.input_data_changed)
        self.txt_file_path_folder_supplies.textChanged.connect(
            self.input_data_changed)
    def __init__(self, qgis_utils, db, conn_manager, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.qgis_utils = qgis_utils
        self._db = db
        self.conn_manager = conn_manager
        self.parent = parent
        self.logger = Logger()

        self._dialog_mode = None
        self._running_tool = False
        self._etl_result = False
        self.tool_name = ""
        self.names = self._db.names
        self._db_was_changed = False  # To postpone calling refresh gui until we close this dialog instead of settings
        self.validators = Validators()
        self.initialize_feedback()

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.button(QDialogButtonBox.Ok).setText(QCoreApplication.translate("CobolBaseDialog", "Import"))
        self.finished.connect(self.finished_slot)

        self._layers = dict()
        self.initialize_layers()

        self.btn_browse_file_blo.clicked.connect(
            make_file_selector(self.txt_file_path_blo, QCoreApplication.translate("CobolBaseDialog",
                        "Select the BLO .lis file with Cobol data "),
                        QCoreApplication.translate("CobolBaseDialog", 'lis File (*.lis)')))

        self.btn_browse_file_uni.clicked.connect(
            make_file_selector(self.txt_file_path_uni, QCoreApplication.translate("CobolBaseDialog",
                        "Select the UNI .lis file with Cobol data "),
                        QCoreApplication.translate("CobolBaseDialog", 'lis File (*.lis)')))

        self.btn_browse_file_ter.clicked.connect(
            make_file_selector(self.txt_file_path_ter, QCoreApplication.translate("CobolBaseDialog",
                        "Select the TER .lis file with Cobol data "),
                        QCoreApplication.translate("CobolBaseDialog", 'lis File (*.lis)')))

        self.btn_browse_file_pro.clicked.connect(
            make_file_selector(self.txt_file_path_pro, QCoreApplication.translate("CobolBaseDialog",
                        "Select the PRO .lis file with Cobol data "),
                        QCoreApplication.translate("CobolBaseDialog", 'lis File (*.lis)')))

        self.btn_browse_file_gdb.clicked.connect(
                make_folder_selector(self.txt_file_path_gdb, title=QCoreApplication.translate(
                'CobolBaseDialog', 'Open GDB folder'), parent=None))

        file_validator_blo = FileValidator(pattern='*.lis', allow_empty=True)
        file_validator_lis = FileValidator(pattern='*.lis', allow_non_existing=False)
        dir_validator_gdb = DirValidator(pattern='*.gdb', allow_non_existing=False)
       
        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

        self.txt_file_path_blo.setValidator(file_validator_blo)
        self.txt_file_path_uni.setValidator(file_validator_lis)
        self.txt_file_path_ter.setValidator(file_validator_lis)
        self.txt_file_path_pro.setValidator(file_validator_lis)
        self.txt_file_path_gdb.setValidator(dir_validator_gdb)

        self.txt_file_path_blo.textChanged.connect(self.validators.validate_line_edits)
        self.txt_file_path_uni.textChanged.connect(self.validators.validate_line_edits)
        self.txt_file_path_ter.textChanged.connect(self.validators.validate_line_edits)
        self.txt_file_path_pro.textChanged.connect(self.validators.validate_line_edits)
        self.txt_file_path_gdb.textChanged.connect(self.validators.validate_line_edits)

        self.txt_file_path_blo.textChanged.connect(self.input_data_changed)
        self.txt_file_path_uni.textChanged.connect(self.input_data_changed)
        self.txt_file_path_ter.textChanged.connect(self.input_data_changed)
        self.txt_file_path_pro.textChanged.connect(self.input_data_changed)
        self.txt_file_path_gdb.textChanged.connect(self.input_data_changed)
    def __init__(self, controller, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self._controller = controller
        self.parent = parent

        self.logger = Logger()
        self.app = AppInterface()
        self.validators = Validators()

        self._dialog_mode = None
        self._running_tool = False        
        self.tool_name = QCoreApplication.translate("XTFModelConverterDialog", "XTF Model Converter")
 
        # Initialize
        self.initialize_progress()

        # Set MessageBar for QDialog
        self.bar = QgsMessageBar()
        self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

        # Set connections
        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.button(QDialogButtonBox.Ok).setText(QCoreApplication.translate("XTFModelConverterDialog", "Convert"))
        self.finished.connect(self.finished_slot)

        self.btn_browse_file_source_xtf.clicked.connect(
            make_file_selector(self.txt_source_xtf, QCoreApplication.translate("XTFModelConverterDialog",
                        "Select the INTERLIS Transfer File .xtf file you want to convert"),
                        QCoreApplication.translate("XTFModelConverterDialog", 'Transfer file (*.xtf)')))

        self.btn_browse_file_target_xtf.clicked.connect(
            make_save_file_selector(self.txt_target_xtf, QCoreApplication.translate(
                "XTFModelConverterDialog", "Set the output path of the coverted INTERLIS Transfer File"),
                                    QCoreApplication.translate("XTFModelConverterDialog", 'Transfer file (*.xtf)'),
                                    extension='.xtf'))

        self._controller.progress_changed.connect(self.progress.setValue)

        self.restore_settings()

        # Set validations
        file_validator_xtf_in = FileValidator(pattern='*.xtf', allow_non_existing=False)
        file_validator_xtf_out = FileValidator(pattern='*.xtf', allow_non_existing=True)

        self.txt_source_xtf.setValidator(file_validator_xtf_in)
        self.txt_target_xtf.setValidator(file_validator_xtf_out)

        self.txt_source_xtf.textChanged.connect(self.validators.validate_line_edits)
        self.txt_target_xtf.textChanged.connect(self.validators.validate_line_edits)

        self.txt_source_xtf.textChanged.connect(self.update_model_converters)
        self.txt_source_xtf.textChanged.connect(self.xtf_paths_changed)  # Enable/disable convert button
        self.txt_target_xtf.textChanged.connect(self.xtf_paths_changed)  # Enable/disable convert button
        self.cbo_model_converter.currentIndexChanged.connect(self.selected_converter_changed)  # Need new wizard pages?

        # Trigger validators now
        self.txt_source_xtf.textChanged.emit(self.txt_source_xtf.text())
        self.txt_target_xtf.textChanged.emit(self.txt_target_xtf.text())