Skip to content

Commit

Permalink
Remove print statements
Browse files Browse the repository at this point in the history
Remove print statements
  • Loading branch information
ponceta committed Oct 18, 2024
1 parent 9112784 commit ed3efbf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 59 deletions.
58 changes: 29 additions & 29 deletions qgepqwat2ili/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def action_importc(plugin):
# neu 26.7.2023 analog action_import
global importc_dialog # avoid garbage collection

print("set flagskipvalidation_import")
# print("set flagskipvalidation_import")

iface.messageBar().pushMessage("Info", "action import", level=Qgis.Info)

importc_dialog = GuiImportc(plugin.iface.mainWindow())

# # 19.4.2023 add option for additional import configuration
def action_do_importc():
print("Open import dialog config")
# print("Open import dialog config")
if importc_dialog.skipvalidation_import:
importc_dialog.skipvalidation_import

Expand Down Expand Up @@ -149,7 +149,7 @@ def action_import(plugin):

# Check if validating is selected
if flagskipvalidation_import:
print("Validation will be skipped!")
# print("Validation will be skipped!")
progress_dialog.setLabelText("No validation of input file...")
else:
# Validating the input file
Expand Down Expand Up @@ -199,7 +199,7 @@ def action_import(plugin):
# 23.7.2022 rausgenommen - da in ili2db gesetzt
# imodel = import_dialog.label_importmodelname.text()
tmplabeltext = "Creating ili schema..." + imodel
print(tmplabeltext)
# print(tmplabeltext)
# breakpoint()
progress_dialog.setLabelText(tmplabeltext)

Expand Down Expand Up @@ -234,7 +234,7 @@ def action_import(plugin):
recreate_schema=True,
)
else:
# print(imodel)
# # print(imodel)
# breakpoint()
progress_dialog.close()
show_failure(
Expand Down Expand Up @@ -292,7 +292,7 @@ def action_import(plugin):
# imodel,
)
else:
# print(imodel)
# # print(imodel)
# breakpoint()
progress_dialog.close()
show_failure(
Expand Down Expand Up @@ -381,11 +381,11 @@ def action_do_export():

# neu 12.7.2022
emodel = export_dialog.comboBox_modelselection.currentText()
print(emodel)
# print(emodel)

# neu 3.4.2023 added float()
eorientation = float(export_dialog.comboBox_orientation.currentText())
print(eorientation)
# print(eorientation)

# Prepare file dialog
default_folder = QgsSettings().value(
Expand Down Expand Up @@ -425,15 +425,15 @@ def action_do_export():
check_organisation = False
check_organisation = check_organisation_subclass_data()
if check_organisation:
print("OK: Integrity checks organisation")
# print("OK: Integrity checks organisation")
show_success(
"Sucess",
"OK: Integrity checks organisation",
None,
)
else:
progress_dialog.close()
print("number of subclass elements of organisation NOT CORRECT")
# print("number of subclass elements of organisation NOT CORRECT")
show_failure(
"ERROR: number of subclass elements of organisation NOT CORRECT in schema qgep_od",
"Add missing obj_id in organisation subclasses so that number of subclass elements match organisation elements. See qgep logs tab for details.",
Expand All @@ -448,15 +448,15 @@ def action_do_export():
check_wastewater_structure = False
check_wastewater_structure = check_wastewater_structure_subclass_data()
if check_wastewater_structure:
print("OK: Integrity checks wastewater_structure")
# print("OK: Integrity checks wastewater_structure")
show_success(
"Sucess",
"OK: Integrity checks wastewater_structure",
None,
)
else:
progress_dialog.close()
print("ERROR: number of subclass elements of wastewater_structure NOT CORRECT")
# print("ERROR: number of subclass elements of wastewater_structure NOT CORRECT")
show_failure(
"ERROR: number of subclass elements of wastewater_structure NOT CORRECT in schema qgep_od",
"Add missing obj_id in wastewater_structure subclasses so that number of subclass elements match wastewater_structure elements. See qgep logs tab for details.",
Expand All @@ -469,16 +469,16 @@ def action_do_export():
check_identifier = False
check_identifier = check_identifier_null()
if check_identifier:
print("OK: Integrity checks identifiers not isNull")
# print("OK: Integrity checks identifiers is not NULL")
show_success(
"Sucess",
"OK: Integrity checks identifiers not isNull",
"OK: Integrity checks identifiers is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing identifiers")
# print("INFO: missing identifiers")
show_hint(
"INFO: Missing identifiers in schema qgep_od",
"Add missing identifiers to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -492,16 +492,16 @@ def action_do_export():
check_fk_owner = False
check_fk_owner = check_fk_owner_null()
if check_fk_owner:
print("OK: Integrity checks fk_owner not isNull")
# print("OK: Integrity checks fk_owner is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_owner not isNull",
"OK: Integrity checks fk_owner is not NULL",
None,
)

else:
progress_dialog.close()
print("ERROR: missing MANDATORY fk_owner")
# print("ERROR: missing MANDATORY fk_owner")
show_failure(
"ERROR: Missing MANDATORY fk_owner in schema qgep_od",
"Add missing MANDATORY fk_owner to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -514,16 +514,16 @@ def action_do_export():
check_fk_operator = False
check_fk_operator = check_fk_operator_null()
if check_fk_operator:
print("OK: Integrity checks fk_operator not isNull")
# print("OK: Integrity checks fk_operator is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_operator not isNull",
"OK: Integrity checks fk_operator is not NULL",
None,
)

else:
progress_dialog.close()
print("ERROR: missing MANDATORY fk_operator")
# print("ERROR: missing MANDATORY fk_operator")
show_failure(
"ERROR: Missing MANDATORY fk_operator in schema qgep_od",
"Add missing MANDATORY fk_operator to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -537,16 +537,16 @@ def action_do_export():
check_fk_dataowner = False
check_fk_dataowner = check_fk_dataowner_null()
if check_fk_dataowner:
print("OK: Integrity checks fk_dataowner not isNull")
# print("OK: Integrity checks fk_dataowner is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_dataowner not isNull",
"OK: Integrity checks fk_dataowner is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing fk_dataowner")
# print("INFO: missing fk_dataowner")
show_hint(
"INFO: Missing fk_dataowner in schema qgep_od",
"Add missing fk_dataowner to get a valid INTERLIS export file when converting to Release 2020 (will bei MANDATORY). See qgep logs tab for details.",
Expand All @@ -559,16 +559,16 @@ def action_do_export():
check_fk_provider = False
check_fk_provider = check_fk_provider_null()
if check_fk_provider:
print("OK: Integrity checks fk_provider not isNull")
# print("OK: Integrity checks fk_provider is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_provider not isNull",
"OK: Integrity checks fk_provider is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing fk_provider")
# print("INFO: missing fk_provider")
show_hint(
"INFO: Missing fk_provider in schema qgep_od",
"Add missing fk_provider to get a valid INTERLIS export file when converting to Release 2020 (will bei MANDATORY). See qgep logs tab for details.",
Expand Down Expand Up @@ -635,12 +635,12 @@ def action_do_export():
# neu 12.7.2022
progress_dialog.setLabelText(emodel)

# print("GFG printed immediately.")
# # print("GFG # printed immediately.")
# time.sleep(5.5)

# delays the execution
# for 5.5 secs.
# print("GFG printed after 5.5 secs.")
# # print("GFG # printed after 5.5 secs.")

progress_dialog.setValue(25)

Expand Down
33 changes: 3 additions & 30 deletions qgepqwat2ili/utils/ili2db.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def check_organisation_subclass_data():
logger.info(
f"ERROR: number of subclass elements of organisation NOT CORRECT in schema qgep_od: checksum = {organisation_count} (positiv number means missing entries, negativ means too many subclass entries)"
)
print(
f"ERROR: number of subclass elements of organisation NOT CORRECT in schema qgep_od: checksum = {organisation_count} (positiv number means missing entries, negativ means too many subclass entries)"
)

return organisation_subclass_check

Expand Down Expand Up @@ -90,9 +87,6 @@ def check_wastewater_structure_subclass_data():
logger.info(
f"ERROR: number of subclass elements of wastewater_structure NOT CORRECT in schema qgep_od: checksum = {wastewater_structure_count} (positiv number means missing entries, negativ means too many subclass entries)"
)
print(
f"ERROR: number of subclass elements of wastewater_structure NOT CORRECT in schema qgep_od: checksum = {wastewater_structure_count} (positiv number means missing entries, negativ means too many subclass entries)"
)

return wastewater_structure_subclass_check

Expand Down Expand Up @@ -265,7 +259,6 @@ def check_fk_operator_null():
logger.info(
f"ERROR: Missing mandatory fk_operator in qgep_od: {missing_fk_operator_count}"
)
print(f"ERROR: Missing mandatory fk_operator: {missing_fk_operator_count}")

return check_fk_operator_null

Expand Down Expand Up @@ -355,7 +348,6 @@ def check_fk_dataowner_null():
logger.info(
f"ERROR: Missing mandatory fk_dataowner in qgep_od: {missing_fk_dataowner_count}"
)
print(f"ERROR: Missing mandatory fk_dataowner: {missing_fk_dataowner_count}")

return check_fk_dataowner_null

Expand Down Expand Up @@ -444,7 +436,6 @@ def check_fk_provider_null():
logger.info(
f"ERROR: Missing mandatory fk_provider in qgep_od: {missing_fk_provider_count}"
)
print(f"ERROR: Missing mandatory fk_provider: {missing_fk_provider_count}")

return check_fk_provider_null

Expand Down Expand Up @@ -566,8 +557,7 @@ def get_xtf_model(xtf_file):
"""
Get XTF model from file
"""
logger.info("GET XTF MODEL... ")
print("xtf_file: " + xtf_file)
logger.info(f"GET XTF MODEL {xtf_file} ... ")
# logger.info("vorher" + imodel)
# funktioniert nicht
# global imodel # define imodel as global variable for import model name
Expand Down Expand Up @@ -597,42 +587,31 @@ def get_xtf_model(xtf_file):
else:
# checkdatasection = line.find('<DATASECTION>')
# logger.info(str(checkdatasection))
# print("checkdatasection (ili2db): " + str(checkdatasection))
checkmodelssection = line.find("<MODELS>")
logger.info(str(checkmodelssection))
print("checkmodelssection (ili2db): " + str(checkmodelssection))
logger.info("checkmodelssection " + str(checkmodelssection))
logger.info(str(line))
print(line)
else:
line2 = f.readline()
if not line2:
break
else:
logger.info(str(line2))
logger.info("line2: ", str(line2))
print(line2)
# logger.info(str(checkdatasection))
# print("checkdatasection (ili2db): " + str(checkdatasection))
logger.info("checkmodelssection2 " + str(checkmodelssection))
print("checkmodelssection2 (ili2db): " + str(checkmodelssection))
# strmodel = str(line2.strip())
strmodel = str(line2)
strmodel = strmodel.strip()
print("strmodel (ili2db): " + strmodel)
print(f"strmodel (ili2db): {strmodel}")
logger.info("strmodel: " + strmodel)
logger.info("strmodel: ", strmodel)
logger.info(f"strmodel: {strmodel}")
a = strmodel.find("</MODELS>")
logger.info("strmodel.find a </MODELS>: " + str(a))
print("strmodel.find a </MODELS>: " + str(a))
# if strmodel.find("</MODELS>") > -1:
if a == -1:
b = strmodel.find("<MODEL>")
logger.info(r"strmodel.find b \<MODEL: " + str(b))
print(r"strmodel.find b \<MODEL: " + str(b))
if strmodel.find("<MODEL") > -1:
print("strmodel (ili2db): " + strmodel)
logger.info("MODELS definition found in xtf: " + strmodel)
# <VSA_KEK_2019_LV95.KEK BID="VSA_KEK_2019_LV95.KEK">
# read string between < and . -> eg. VSA_KEK_2019_LV95
Expand All @@ -659,15 +638,12 @@ def get_xtf_model(xtf_file):
result = result.strip('"')
logger.info("MODEL found: " + str(result))
logger.info(result)
print("MODEL found: " + str(result) + "*")
model_list.append(result)
else:
print("goto next line")
logger.info("goto next line")
else:
print(r"<\/MODEL> found - stop checking!")
logger.info("</MODEL> found - stop checking!")
break
print(model_list)
logger.info("model_list:")
logger.info(str(model_list))

Expand All @@ -694,15 +670,13 @@ def get_xtf_model(xtf_file):
f.close()

logger.info("MODEL found: " + str(impmodel))
print("MODEL found: ", str(impmodel))

# neu 23.7.2022 return imodel from get_xtf_model so it can be called in _init_.py
return impmodel


def get_xtf_model2(xtf_file):
logger.info("GET XTF MODEL xml version... ")
print("xtf_file: " + xtf_file)
# logger.info("vorher" + imodel)
# funktioniert nicht
# global imodel # define imodel as global variable for import model name
Expand All @@ -722,7 +696,6 @@ def get_xtf_model2(xtf_file):
# from xml file
tree = ET.parse(xtf_file)
rootinterlis = tree.getroot()
print("rootinterlis.findall:", rootinterlis.findall("."))
logger.info("rootinterlis.findall:", rootinterlis.findall("."))

i = 0
Expand Down

0 comments on commit ed3efbf

Please sign in to comment.