def show_feature_relation(self): # Get feature_type and feature_id feature_type = qt_tools.getWidgetText( self.dlg_feature_delete, self.dlg_feature_delete.feature_type) feature_id = qt_tools.getWidgetText(self.dlg_feature_delete, self.dlg_feature_delete.feature_id) if feature_id in (None, "null"): message = f"Select one" self.controller.show_warning(message, parameter=feature_type) return feature = '"type":"' + feature_type + '"' extras = '"feature_id":"' + feature_id + '"' body = self.create_body(feature=feature, extras=extras) result = self.controller.get_json('gw_fct_getfeaturerelation', body, log_sql=True) if not result: return # Construct message result result_msg = '' for value in result['body']['data']['info']['values']: result_msg += value['message'] + '\n\n' qt_tools.setWidgetText(self.dlg_feature_delete, self.dlg_feature_delete.txt_feature_infolog, result_msg) # Enable button delete feature if result_msg != '': self.dlg_feature_delete.btn_delete.setEnabled(True)
def delete_feature_relation(self): # Get feature_type and feature_id feature_type = qt_tools.getWidgetText( self.dlg_feature_delete, self.dlg_feature_delete.feature_type) feature_id = qt_tools.getWidgetText(self.dlg_feature_delete, self.dlg_feature_delete.feature_id) feature = '"type":"' + feature_type + '"' extras = '"feature_id":"' + feature_id + '"' body = self.create_body(feature=feature, extras=extras) complet_result = self.controller.get_json('gw_fct_feature_delete', body, log_sql=True) if not complet_result: self.controller.show_message( "Function gw_fct_feature_delete executed with no result ", 3) return # Populate tab info change_tab = False data = complet_result['body']['data'] for k, v in list(data.items()): if str(k) == "info": change_tab = self.add_layer.populate_info_text( self.dlg_feature_delete, data) self.dlg_feature_delete.btn_cancel.setText('Accept') # Close dialog if not change_tab: self.close_dialog(self.dlg_feature_delete)
def save_settings_values(self): """ Save QGIS settings related with csv options """ set_parser_value('csv2Pg', 'txt_file_csv', qt_tools.getWidgetText(self.dlg_csv, 'txt_file_csv')) set_parser_value( 'csv2Pg', 'cmb_unicode_list', qt_tools.getWidgetText(self.dlg_csv, 'cmb_unicode_list')) set_parser_value('csv2Pg', 'rb_semicolon', f"{self.dlg_csv.rb_semicolon.isChecked()}")
def check_fields(self): file_inp = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_file_inp) file_rpt = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_file_rpt) result_name = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_result_name, False, False) # Control export INP if qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_export): if self.check_inp_chk(file_inp) is False: return False # Control execute epa software if self.check_rpt() is False: return False # Control import result if qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_import_result): if file_rpt is None: msg = "Select valid RPT file" self.controller.show_warning(msg, parameter=str(file_rpt)) return False if not qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_exec): if not os.path.exists(file_rpt): msg = "File RPT not found" self.controller.show_warning(msg, parameter=str(file_rpt)) return False else: if self.check_rpt() is False: return False # Control result name if result_name == '': self.dlg_go2epa.txt_result_name.setStyleSheet( "border: 1px solid red") msg = "This parameter is mandatory. Please, set a value" self.controller.show_details(msg, title="Rpt fail", inf_text=None) return False sql = (f"SELECT result_id FROM rpt_cat_result " f"WHERE result_id = '{result_name}' LIMIT 1") row = self.controller.get_row(sql) if row: msg = "Result name already exists, do you want overwrite?" answer = self.controller.ask_question(msg, title="Alert") if not answer: return False return True
def activate_relations(self): """ Force user to set doc_id and doc_type """ doc_id = qt_tools.getWidgetText(self.dlg_add_doc, self.dlg_add_doc.doc_id, False, False) doc_type = qt_tools.getWidgetText(self.dlg_add_doc, self.dlg_add_doc.doc_type, False, False) if doc_id in (None, '', 'null') or doc_type in (None, '', 'null'): self.dlg_add_doc.tabWidget.setTabEnabled(1, False) else: self.dlg_add_doc.tabWidget.setTabEnabled(1, True)
def save_settings_values(self): """ Save QGIS settings related with csv options """ cur_user = self.controller.get_current_user() self.controller.plugin_settings_set_value("Csv2Pg_txt_file_csv_" + cur_user, qt_tools.getWidgetText(self.dlg_csv, 'txt_file_csv')) self.controller.plugin_settings_set_value("Csv2Pg_cmb_unicode_list_" + cur_user, qt_tools.getWidgetText(self.dlg_csv, 'cmb_unicode_list')) self.controller.plugin_settings_set_value("Csv2Pg_rb_comma_" + cur_user, bool(self.dlg_csv.rb_comma.isChecked())) self.controller.plugin_settings_set_value("Csv2Pg_rb_semicolon_" + cur_user, bool(self.dlg_csv.rb_semicolon.isChecked()))
def edit_change_elem_type_accept(self): """ Update current type of node and save changes in database """ project_type = self.controller.get_project_type() node_node_type_new = qt_tools.getWidgetText(self.dlg_chg_node_type, self.dlg_chg_node_type.node_node_type_new) node_nodecat_id = qt_tools.getWidgetText(self.dlg_chg_node_type, self.dlg_chg_node_type.node_nodecat_id) layer = False if node_node_type_new != "null": if (node_nodecat_id != "null" and node_nodecat_id is not None and project_type == 'ws') or (project_type == 'ud'): # Update field 'nodecat_id' sql = (f"UPDATE v_edit_node SET nodecat_id = '{node_nodecat_id}' " f"WHERE node_id = '{self.node_id}'") self.controller.execute_sql(sql) if project_type == 'ud': sql = (f"UPDATE v_edit_node SET node_type = '{node_node_type_new}' " f"WHERE node_id = '{self.node_id}'") self.controller.execute_sql(sql) # Set active layer layer = self.controller.get_layer_by_tablename('v_edit_node') if layer: self.iface.setActiveLayer(layer) message = "Values has been updated" self.controller.show_info(message) else: message = "Field catalog_id required!" self.controller.show_warning(message) return else: message = "The node has not been updated because no catalog has been selected" self.controller.show_warning(message) # Close form close_dialog(self.dlg_chg_node_type) # Refresh map canvas self.refresh_map_canvas() # Check if the expression is valid expr_filter = f"node_id = '{self.node_id}'" (is_valid, expr) = check_expression(expr_filter, self.controller) # @UnusedVariable if not is_valid: return if layer: self.open_custom_form(layer, expr)
def delete_feature_at_plan(self, dialog, geom_type, list_id): """ Delete features_id to table plan_@geom_type_x_psector""" value = qt_tools.getWidgetText(dialog, dialog.psector_id) sql = (f"DELETE FROM plan_psector_x_{geom_type} " f"WHERE {geom_type}_id IN ({list_id}) AND psector_id = '{value}'") self.controller.execute_sql(sql)
def set_completer_result(self, widget, viewname, field_name): """ Set autocomplete of widget 'feature_id' getting id's from selected @viewname """ result_name = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_result_name) # Adding auto-completion to a QLineEdit self.completer = QCompleter() self.completer.setCaseSensitivity(Qt.CaseInsensitive) widget.setCompleter(self.completer) model = QStringListModel() sql = f"SELECT {field_name} FROM {viewname}" rows = self.controller.get_rows(sql) if rows: for i in range(0, len(rows)): aux = rows[i] rows[i] = str(aux[0]) model.setStringList(rows) self.completer.setModel(model) if result_name in rows: self.dlg_go2epa.chk_only_check.setEnabled(True)
def get_records_geom_type(dialog, table_object, geom_type, ids=None, list_ids=None, layers=None): """ Get records of @geom_type associated to selected @table_object """ object_id = qt_tools.getWidgetText(dialog, table_object + "_id") table_relation = table_object + "_x_" + geom_type widget_name = "tbl_" + table_relation exists = global_vars.controller.check_table(table_relation) if not exists: global_vars.controller.log_info(f"Not found: {table_relation}") return ids, layers, list_ids sql = (f"SELECT {geom_type}_id " f"FROM {table_relation} " f"WHERE {table_object}_id = '{object_id}'") rows = global_vars.controller.get_rows(sql, log_info=False) if rows: for row in rows: list_ids[geom_type].append(str(row[0])) ids.append(str(row[0])) expr_filter = get_expr_filter(geom_type, list_ids=list_ids, layers=layers) set_table_model(dialog, widget_name, geom_type, expr_filter) return ids, layers, list_ids
def populate_info_text(dialog, data, force_tab=True, reset_text=True, tab_idx=1, call_disable_tabs=True): """ Populate txt_infolog QTextEdit widget :param dialog: QDialog :param data: Json :param force_tab: Force show tab (boolean) :param reset_text: Reset(or not) text for each iteration (boolean) :param tab_idx: index of tab to force (integer) :param call_disable_tabs: set all tabs, except the last, enabled or disabled (boolean) :return: Text received from data (String) """ change_tab = False text = qt_tools.getWidgetText(dialog, dialog.txt_infolog, return_string_null=False) if reset_text: text = "" for item in data['info']['values']: if 'message' in item: if item['message'] is not None: text += str(item['message']) + "\n" if force_tab: change_tab = True else: text += "\n" qt_tools.setWidgetText(dialog, 'txt_infolog', text + "\n") qtabwidget = dialog.findChild(QTabWidget, 'mainTab') if qtabwidget is not None: if change_tab and qtabwidget is not None: qtabwidget.setCurrentIndex(tab_idx) if call_disable_tabs: disable_tabs(dialog) return text
def populate_info_text(self, dialog, data, force_tab=True, reset_text=True, tab_idx=1): change_tab = False text = qt_tools.getWidgetText(dialog, 'txt_infolog', return_string_null=False) if reset_text: text = "" for item in data['info']['values']: if 'message' in item: if item['message'] is not None: text += str(item['message']) + "\n" if force_tab: change_tab = True else: text += "\n" qt_tools.setWidgetText(dialog, 'txt_infolog', text + "\n") qtabwidget = dialog.findChild(QTabWidget, 'mainTab') if change_tab and qtabwidget is not None: qtabwidget.setCurrentIndex(tab_idx) return change_tab
def get_values_checked_param_user(self, chk, widget, field, value=None): elem = {} elem['widget'] = str(widget.objectName()) elem['chk'] = str(chk.objectName()) if type(widget) is QLineEdit: value = qt_tools.getWidgetText(self.dlg_config, widget, return_string_null=False) elem['widget_type'] = 'text' elif type(widget) is QComboBox: value = qt_tools.get_item_data(self.dlg_config, widget, 0) elem['widget_type'] = 'combo' elif type(widget) is QCheckBox: value = qt_tools.isChecked(self.dlg_config, chk) elem['widget_type'] = 'check' elif type(widget) is QDateEdit: value = qt_tools.getCalendarDate(self.dlg_config, widget) elem['widget_type'] = 'datetime' elif type(widget) is QgsDateTimeEdit: value = qt_tools.getCalendarDate(self.dlg_config, widget) elem['widget_type'] = 'datetime' elem['isChecked'] = str(qt_tools.isChecked(self.dlg_config, chk)) elem['value'] = value self.list_update.append(elem)
def check_connection(self): """ Check connection to database """ self.dlg_qm.cmb_language.clear() self.dlg_qm.lbl_info.clear() self.close_db() host = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_host) port = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_port) db = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_db) user = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_user) password = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_pass) status = self.init_db(host, port, db, user, password) if not status: self.dlg_qm.btn_translate.setEnabled(False) qt_tools.setWidgetText(self.dlg_qm, 'lbl_info', self.last_error) return self.populate_cmb_language()
def populate_catalog_id(self, geom_type): # Get widgets widget_metcat_id = self.dlg_catalog.findChild(QComboBox, 'matcat_id') widget_pn = self.dlg_catalog.findChild(QComboBox, 'pnom') widget_dn = self.dlg_catalog.findChild(QComboBox, 'dnom') widget_id = self.dlg_catalog.findChild(QComboBox, 'id') # Get values from combo parents metcat_value = qt_tools.getWidgetText(self.dlg_catalog, widget_metcat_id) pn_value = qt_tools.getWidgetText(self.dlg_catalog, widget_pn) dn_value = qt_tools.getWidgetText(self.dlg_catalog, widget_dn) exists = self.controller.check_function('gw_api_get_catalog_id') if exists: sql = f"SELECT gw_api_get_catalog_id('{metcat_value}', '{pn_value}', '{dn_value}', '{geom_type}', 9)" row = self.controller.get_row(sql) self.populate_combo(widget_id, row[0]['catalog_id'][0])
def clicked_event(self): # Create the dialog and signals self.dlg_feature_delete = FeatureDelete() load_settings(self.dlg_feature_delete) # Populate combo feature type sql = 'SELECT DISTINCT(feature_type) AS id, feature_type AS idval FROM cat_feature' rows = self.controller.get_rows(sql) qt_tools.set_item_data(self.dlg_feature_delete.feature_type, rows, 1) # Set active layer layer_name = 'v_edit_' + qt_tools.getWidgetText( self.dlg_feature_delete, self.dlg_feature_delete.feature_type).lower() layer = self.controller.get_layer_by_tablename(layer_name) self.iface.setActiveLayer(layer) self.controller.set_layer_visible(layer) # Disable button delete feature self.dlg_feature_delete.btn_delete.setEnabled(False) # Configure feature_id as typeahead completer = QCompleter() model = QStringListModel() self.filter_typeahead(self.dlg_feature_delete.feature_id, completer, model) # Set listeners self.dlg_feature_delete.feature_id.textChanged.connect( partial(self.filter_typeahead, self.dlg_feature_delete.feature_id, completer, model)) # Set button snapping self.dlg_feature_delete.btn_snapping.clicked.connect( partial(self.set_active_layer)) self.dlg_feature_delete.btn_snapping.clicked.connect( partial(self.selection_init)) set_icon(self.dlg_feature_delete.btn_snapping, "137") # Set listeners self.dlg_feature_delete.btn_cancel.clicked.connect( partial(close_dialog, self.dlg_feature_delete)) self.dlg_feature_delete.rejected.connect( disconnect_signal_selection_changed) self.dlg_feature_delete.rejected.connect( partial(save_settings, self.dlg_feature_delete)) self.dlg_feature_delete.btn_relations.clicked.connect( partial(self.show_feature_relation)) self.dlg_feature_delete.btn_delete.clicked.connect( partial(self.delete_feature_relation)) self.dlg_feature_delete.feature_type.currentIndexChanged.connect( partial(self.set_active_layer)) # Open dialog open_dialog(self.dlg_feature_delete, dlg_name='feature_delete')
def reload_qtable(self, dialog, geom_type): """ Reload QtableView """ value = qt_tools.getWidgetText(dialog, dialog.psector_id) expr = f"psector_id = '{value}'" qtable = qt_tools.getWidget(dialog, f'tbl_psector_x_{geom_type}') self.fill_table_by_expr(qtable, f"plan_psector_x_{geom_type}", expr) self.set_table_columns(dialog, qtable, f"plan_psector_x_{geom_type}") self.refresh_map_canvas()
def write_to_csv(self, dialog, folder_path=None, all_rows=None): with open(folder_path, "w") as output: writer = csv.writer(output, lineterminator='\n') writer.writerows(all_rows) self.controller.plugin_settings_set_value( "search_csv_path", qt_tools.getWidgetText(dialog, 'txt_path')) message = "The csv file has been successfully exported" self.controller.show_info(message)
def go2epa_accept(self): """ Save INP, RPT and result name into GSW file """ # Save user values self.save_user_values() self.dlg_go2epa.txt_infolog.clear() self.dlg_go2epa.txt_file_rpt.setStyleSheet(None) status = self.check_fields() if status is False: return # Get widgets values self.result_name = qt_tools.getWidgetText( self.dlg_go2epa, self.dlg_go2epa.txt_result_name, False, False) self.net_geom = qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_only_check) self.export_inp = qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_export) self.export_subcatch = qt_tools.isChecked( self.dlg_go2epa, self.dlg_go2epa.chk_export_subcatch) self.file_inp = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_file_inp) self.exec_epa = qt_tools.isChecked(self.dlg_go2epa, self.dlg_go2epa.chk_exec) self.file_rpt = qt_tools.getWidgetText(self.dlg_go2epa, self.dlg_go2epa.txt_file_rpt) self.import_result = qt_tools.isChecked( self.dlg_go2epa, self.dlg_go2epa.chk_import_result) # Check for sector selector if self.export_inp: sql = "SELECT sector_id FROM selector_sector LIMIT 1" row = self.controller.get_row(sql) if row is None: msg = "You need to select some sector" self.controller.show_info_box(msg) return # Set background task 'Go2Epa' description = f"Go2Epa" self.task_go2epa = GwGo2EpaTask(description, self) QgsApplication.taskManager().addTask(self.task_go2epa) QgsApplication.taskManager().triggerTask(self.task_go2epa)
def open_catalog(self): # Get feature_type feature_type = qt_tools.getWidgetText(self.dlg_chg_node_type, self.dlg_chg_node_type.node_node_type_new) if feature_type is 'null': msg = "New node type is null. Please, select a valid value." self.controller.show_info_box(msg, "Info") return self.catalog = GwCatalog() self.catalog.api_catalog(self.dlg_chg_node_type, 'node_nodecat_id', 'node', feature_type)
def filter_by_text(self, dialog, table, widget_txt, tablename): result_select = qt_tools.getWidgetText(dialog, widget_txt) if result_select != 'null': expr = f" name ILIKE '%{result_select}%'" # Refresh model with selected filter table.model().setFilter(expr) table.model().select() else: fill_table(table, tablename)
def export_to_csv(self, dialog, qtable_1=None, qtable_2=None, path=None): folder_path = qt_tools.getWidgetText(dialog, path) if folder_path is None or folder_path == 'null': path.setStyleSheet("border: 1px solid red") return path.setStyleSheet(None) if folder_path.find('.csv') == -1: folder_path += '.csv' if qtable_1: model_1 = qtable_1.model() else: return model_2 = None if qtable_2: model_2 = qtable_2.model() # Convert qtable values into list all_rows = [] headers = [] for i in range(0, model_1.columnCount()): headers.append(str(model_1.headerData(i, Qt.Horizontal))) all_rows.append(headers) for rows in range(0, model_1.rowCount()): row = [] for col in range(0, model_1.columnCount()): row.append(str(model_1.data(model_1.index(rows, col)))) all_rows.append(row) if qtable_2 is not None: headers = [] for i in range(0, model_2.columnCount()): headers.append(str(model_2.headerData(i, Qt.Horizontal))) all_rows.append(headers) for rows in range(0, model_2.rowCount()): row = [] for col in range(0, model_2.columnCount()): row.append(str(model_2.data(model_2.index(rows, col)))) all_rows.append(row) # Write list into csv file try: if os.path.exists(folder_path): msg = "Are you sure you want to overwrite this file?" answer = self.controller.ask_question(msg, "Overwrite") if answer: self.write_to_csv(dialog, folder_path, all_rows) else: self.write_to_csv(dialog, folder_path, all_rows) except: msg = "File path doesn't exist or you dont have permission or file is opened" self.controller.show_warning(msg) pass
def filter_by_id(self, table, widget_txt, tablename): id_ = qt_tools.getWidgetText(self.dlg_work, widget_txt) if id_ != 'null': expr = f" arc_id = '{id_}'" # Refresh model with selected filter table.model().setFilter(expr) table.model().select() else: self.fill_table_relations(table, self.schema_name + "." + tablename)
def open_web_browser(dialog, widget=None): """ Display url using the default browser """ if widget is not None: url = qt_tools.getWidgetText(dialog, widget) if url == 'null': url = 'http://www.giswater.org' else: url = 'http://www.giswater.org' webbrowser.open(url)
def filter_typeahead(self, widget, completer, model): # Get feature_type and feature_id feature_type = qt_tools.getWidgetText( self.dlg_feature_delete, self.dlg_feature_delete.feature_type) feature_id = qt_tools.getWidgetText(self.dlg_feature_delete, self.dlg_feature_delete.feature_id) # Get child layer sql = (f"SELECT array_agg({feature_type}_id) FROM {feature_type} " f"WHERE {feature_type}_id LIKE '%{feature_id}%' LIMIT 10") rows_typeahead = self.controller.get_rows(sql) rows_typeahead = rows_typeahead[0][0] if rows_typeahead is None: model.setStringList(['']) return set_completer_object_api(completer, model, widget, rows_typeahead) self.dlg_feature_delete.feature_id.setStyleSheet(None)
def update_location_cmb(self): element_type = qt_tools.getWidgetText(self.dlg_add_element, self.dlg_add_element.element_type) sql = (f"SELECT location_type, location_type FROM man_type_location" f" WHERE feature_type = 'ELEMENT' " f" AND (featurecat_id = '{element_type}' OR featurecat_id is null)" f" ORDER BY location_type") rows = self.controller.get_rows(sql, log_sql=True) qt_tools.set_item_data(self.dlg_add_element.location_type, rows, add_empty=True) if rows: qt_tools.set_combo_itemData(self.dlg_add_element.location_type, rows[0][0], 0)
def workcat_filter_by_text(self, dialog, qtable, widget_txt, table_name, workcat_id, field_id): """ Filter list of workcats by workcat_id and field_id """ result_select = qt_tools.getWidgetText(dialog, widget_txt) if result_select != 'null': expr = (f"workcat_id = '{workcat_id}'" f" and {field_id} ILIKE '%{result_select}%'") else: expr = f"workcat_id ILIKE '%{workcat_id}%'" self.workcat_fill_table(qtable, table_name, expr=expr) set_table_columns(dialog, qtable, table_name)
def filter_catalog(self): node_node_type_new = qt_tools.getWidgetText(self.dlg_chg_node_type, self.dlg_chg_node_type.node_node_type_new) if node_node_type_new == "null": return # Populate catalog_id sql = f"SELECT DISTINCT(id), id FROM cat_node WHERE nodetype_id = '{node_node_type_new}' ORDER BY id" rows = self.controller.get_rows(sql) qt_tools.set_item_data(self.dlg_chg_node_type.node_nodecat_id, rows, 1)
def populate_cmb_language(self): """ Populate combo with languages values """ self.dlg_qm.btn_translate.setEnabled(True) host = qt_tools.getWidgetText(self.dlg_qm, self.dlg_qm.txt_host) qt_tools.setWidgetText(self.dlg_qm, 'lbl_info', f'Connected to {host}') sql = "SELECT user_language, py_language, xml_language, py_file FROM i18n.cat_language" rows = self.get_rows(sql) qt_tools.set_item_data(self.dlg_qm.cmb_language, rows, 0) cur_user = self.controller.get_current_user() language = self.controller.plugin_settings_value('qm_lang_language' + cur_user) qt_tools.set_combo_itemData(self.dlg_qm.cmb_language, language, 0)
def write_csv(self, dialog, temp_tablename): """ Write csv in postgres and call gw_fct_utils_csv2pg function """ self.save_settings_values() insert_status = True if not self.validate_params(dialog): return fid_aux = qt_tools.get_item_data(dialog, dialog.cmb_import_type, 0) self.delete_table_csv(temp_tablename, fid_aux) path = qt_tools.getWidgetText(dialog, dialog.txt_file_csv) label_aux = qt_tools.getWidgetText(dialog, dialog.txt_import, return_string_null=False) delimiter = self.get_delimiter(dialog) _unicode = qt_tools.getWidgetText(dialog, dialog.cmb_unicode_list) try: with open(path, 'r', encoding=_unicode) as csvfile: insert_status = self.insert_into_db(dialog, csvfile, delimiter, _unicode) csvfile.close() del csvfile except Exception as e: self.controller.show_warning("EXCEPTION: " + str(e)) if insert_status is False: return extras = f'"importParam":"{label_aux}"' extras += f', "fid":"{fid_aux}"' body = create_body(extras=extras) result = self.controller.get_json(self.func_name, body) if not result: return else: if result['status'] == "Accepted": populate_info_text(dialog, result['body']['data']) msg = result['message']['text'] self.controller.show_info_box(msg)