Beispiel #1
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()
Beispiel #2
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())
    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, iface, qgis_utils, conn_manager, context):
        QDialog.__init__(self)
        self.setupUi(self)

        QgsGui.instance().enableAutoGeometryRestore(self)
        self.iface = iface
        self.conn_manager = conn_manager
        self.db_source = context.get_db_sources()[0]
        self.db = self.conn_manager.get_db_connector_from_source(
            self.db_source)
        self.qgis_utils = qgis_utils
        self.logger = Logger()

        self.java_utils = JavaUtils()
        self.java_utils.download_java_completed.connect(
            self.download_java_complete)
        self.java_utils.download_java_progress_changed.connect(
            self.download_java_progress_change)

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

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

        # There may be 1 case where we need to emit a db_connection_changed from the Export 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 ED 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_save_file_selector(
                self.xtf_file_line_edit,
                title=QCoreApplication.translate("DialogExportData",
                                                 "Save in XTF Transfer File"),
                file_filter=QCoreApplication.translate(
                    "DialogExportData",
                    "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.validators = Validators()
        fileValidator = FileValidator(
            pattern=['*.' + ext for ext in self.ValidExtensions],
            allow_non_existing=True)
        self.xtf_file_line_edit.setPlaceholderText(
            QCoreApplication.translate("DialogExportData",
                                       "[Name of the XTF to be created]"))
        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())

        self.connection_setting_button.clicked.connect(self.show_settings)

        self.connection_setting_button.setText(
            QCoreApplication.translate("DialogExportData",
                                       "Connection Settings"))

        # LOG
        self.log_config.setTitle(
            QCoreApplication.translate("DialogExportData", "Show log"))
        self.log_config.setFlat(True)

        self.buttonBox.accepted.disconnect()
        self.buttonBox.accepted.connect(self.accepted)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Cancel)
        self._accept_button = self.buttonBox.addButton(
            QCoreApplication.translate("DialogExportData", "Export data"),
            QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(QDialogButtonBox.Help)
        self.buttonBox.helpRequested.connect(self.show_help)

        self.update_connection_info()
        self.update_model_names()
        self.restore_configuration()
    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())