Skip to content

Commit

Permalink
Merge pull request #182 from QGEP/basketPreparationRound2
Browse files Browse the repository at this point in the history
Move more code to export utils
  • Loading branch information
ponceta authored Nov 21, 2024
2 parents 674a439 + 09e51e6 commit 27ba967
Show file tree
Hide file tree
Showing 11 changed files with 946 additions and 3,491 deletions.
30 changes: 13 additions & 17 deletions qgepqwat2ili/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from logging import INFO, FileHandler, Formatter

from . import config, utils
from .qgep.export import qgep_export
from .qgep.import_ import qgep_import
from .qgep.export import qgep_export_kek
from .qgep.import_ import qgep_import_kek
from .qgep.mapping import get_qgep_mapping
from .qgep.model_abwasser import Base as BaseAbwasser
from .qgep.model_qgep import Base as BaseQgep
from .qgepdss.export import qgep_export as qgepdss_export
from .qgepdss.import_ import qgep_import as qgepdss_import
from .qgepsia405.export import qgep_export as qgepsia405_export
from .qgepsia405.import_ import qgep_import as qgepsia405_import
from .qgepdss.export import qgep_export_dss
from .qgepdss.import_ import qgep_import_dss
from .qgepsia405.export import qgep_export_sia405
from .qgepsia405.import_ import qgep_import_sia405
from .qwat.export import qwat_export
from .qwat.import_ import qwat_import
from .qwat.mapping import get_qwat_mapping
Expand Down Expand Up @@ -211,25 +211,21 @@ def main(args):
# add model dependency
if args.export_sia405:
# SIA405_ABWASSER_2015_LV95
qgepsia405_export(
qgep_export_sia405(
selection=args.selection.split(",") if args.selection else None,
labels_file=args.labels_file,
orientation=args.labels_orientation,
)
elif args.export_dss:
# DSS_2015_LV95 expor5t
qgepdss_export(
qgep_export_dss(
selection=args.selection.split(",") if args.selection else None,
labels_file=args.labels_file,
orientation=args.labels_orientation,
)
else:
# VSA_KEK_2019_LV95 export

# qgep_export(selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file)
# 4.4.2023 with labels_orientation
# qgep_export(selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation if args.labels_orientation else 0)
qgep_export(
qgep_export_kek(
selection=args.selection.split(",") if args.selection else None,
labels_file=args.labels_file,
orientation=args.labels_orientation,
Expand Down Expand Up @@ -290,8 +286,8 @@ def main(args):
utils.ili2db.import_xtf_data(
SCHEMA, args.path, make_log_path(log_path, "iliimport")
)
print("qgep_import: " + SCHEMA + "/" + ILI_MODEL)
qgep_import()
print("qgep_import_kek: " + SCHEMA + "/" + ILI_MODEL)
qgep_import_kek()
elif impmodel == "SIA405_ABWASSER_2015_LV95":
ABWASSER_SIA405_SCHEMA = config.ABWASSER_SIA405_SCHEMA
ABWASSER_SIA405_ILI_MODEL = config.ABWASSER_SIA405_ILI_MODEL
Expand All @@ -311,7 +307,7 @@ def main(args):
+ "/"
+ ABWASSER_SIA405_ILI_MODEL
)
qgepsia405_import()
qgep_import_sia405()

elif impmodel == "DSS_2015_LV95":
ABWASSER_DSS_SCHEMA = config.ABWASSER_DSS_SCHEMA
Expand All @@ -327,7 +323,7 @@ def main(args):
ABWASSER_DSS_SCHEMA, args.path, make_log_path(log_path, "iliimport")
)
print("qgepdss_import: " + ABWASSER_DSS_SCHEMA + "/" + ABWASSER_DSS_ILI_MODEL)
qgepdss_import()
qgep_import_dss()

else:
print(
Expand Down
32 changes: 13 additions & 19 deletions qgepqwat2ili/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

from ....utils.qgeplayermanager import QgepLayerManager
from .. import config
from ..qgep.export import qgep_export
from ..qgep.import_ import qgep_import
from ..qgep.export import qgep_export_kek
from ..qgep.import_ import qgep_import_kek

# 12.7.2022 additional models
from ..qgepdss.export import qgep_export as qgepdss_export
from ..qgepdss.import_ import qgep_import as qgepdss_import
from ..qgepdss.export import qgep_export_dss
from ..qgepdss.import_ import qgep_import_dss

# 28.3.2023 additional import for sia405, export to be discussed further
from ..qgepsia405.export import qgep_export as qgepsia405_export
from ..qgepsia405.import_ import qgep_import as qgepsia405_import
from ..qgepsia405.export import qgep_export_sia405
from ..qgepsia405.import_ import qgep_import_sia405
from ..utils.ili2db import ( # neu 22.7.2022; get_xtf_model,; neu 31.3.2023; neu 12.4.2023
check_fk_dataowner_null,
check_fk_operator_null,
Expand Down Expand Up @@ -288,22 +288,18 @@ def action_import(plugin):
log_handler.setLevel(logging.INFO)
log_handler.setFormatter(logging.Formatter("%(levelname)-8s %(message)s"))
with LoggingHandlerContext(log_handler):
# qgep_import(
# precommit_callback=import_dialog.init_with_session,
# )

progress_dialog.setLabelText("Loading import wizard - please be patient...")
# 24.3.2023 added model dependency
if imodel == "VSA_KEK_2019_LV95":
qgep_import(
qgep_import_kek(
precommit_callback=import_dialog.init_with_session,
)
elif imodel == "SIA405_ABWASSER_2015_LV95":
qgepsia405_import(
qgep_import_sia405(
precommit_callback=import_dialog.init_with_session,
)
elif imodel == "DSS_2015_LV95":
qgepdss_import(
qgep_import_dss(
precommit_callback=import_dialog.init_with_session,
)
else:
Expand Down Expand Up @@ -662,10 +658,8 @@ def action_do_export():
logger.info(f"Start Exporting with selection {str(export_dialog.selected_ids)}")

if emodel == "VSA_KEK_2019_LV95":
logger.info("Start Exporting VSA_KEK_2019_LV95 - qgep_export")
# qgep_export(selection=export_dialog.selected_ids, labels_file=labels_file_path)
# 3.4.2023 neu mit eorientation
qgep_export(
logger.info("Start Exporting VSA_KEK_2019_LV95")
qgep_export_kek(
selection=export_dialog.selected_ids,
labels_file=labels_file_path,
orientation=eorientation,
Expand All @@ -675,7 +669,7 @@ def action_do_export():
logger.info("Start Exporting SIA405_ABWASSER_2015_LV95 - qgepsia405_export")
# qgepsia405_export(selection=export_dialog.selected_ids, labels_file=labels_file_path)
# 3.4.2023 neu mit eorientation
qgepsia405_export(
qgep_export_sia405(
selection=export_dialog.selected_ids,
labels_file=labels_file_path,
orientation=eorientation,
Expand All @@ -684,7 +678,7 @@ def action_do_export():
logger.info("Start Exporting DSS_2015_LV95 - qgepdss_export")
# qgepdss_export(selection=export_dialog.selected_ids, labels_file=labels_file_path)
# 3.4.2023 neu mit eorientation
qgepdss_export(
qgep_export_dss(
selection=export_dialog.selected_ids,
labels_file=labels_file_path,
orientation=eorientation,
Expand Down
Loading

0 comments on commit 27ba967

Please sign in to comment.