def __init__(self, qgis_utils, db, conn_manager, parent=None): CobolBaseDialog.__init__(self, qgis_utils, db, conn_manager, parent) self.qgis_utils = qgis_utils self._db = db self.conn_manager = conn_manager self.parent = parent self.names_gpkg = '' self.progress_configuration(0, 2) # Start from: 0, number of steps: 2 self._running_tool = False self.tool_name = QCoreApplication.translate("MissingCobolSupplies", "Missing Supplies") self.setWindowTitle( QCoreApplication.translate("MissingCobolSupplies", "Find missing Cobol supplies")) load_ui('supplies/wig_missing_cobol_supplies_export.ui', self.target_data) self.target_data.setVisible(True) self.disable_widgets() self.target_data.btn_browse_file_folder_supplies.clicked.connect( make_folder_selector( self.target_data.txt_file_path_folder_supplies, title=QCoreApplication.translate("MissingCobolSupplies", "Select folder to save data"), parent=None)) dir_validator_folder = DirValidator(pattern=None, allow_empty_dir=True) self.target_data.txt_file_path_folder_supplies.setValidator( dir_validator_folder) self.target_data.txt_file_path_folder_supplies.textChanged.connect( self.validators.validate_line_edits) self.target_data.txt_file_path_folder_supplies.textChanged.connect( self.input_data_changed) self.restore_settings() self.target_data.txt_file_path_folder_supplies.setText( QSettings().value('Asistente-LADM_COL/etl_cobol/folder_path', '')) # Trigger validations right now 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()) self.target_data.txt_file_path_folder_supplies.textChanged.emit( self.target_data.txt_file_path_folder_supplies.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_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, 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)