Skip to content

Commit

Permalink
Small adaptations to run better automate tests (SWMM.INP export/impor…
Browse files Browse the repository at this point in the history
…t) (#1512)
  • Loading branch information
rpachaly authored Aug 20, 2024
1 parent a44f45c commit dad799f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions flo2d/gui/storm_drain_editor_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,13 +984,15 @@ def import_storm_drain_INP_file(self, mode, show_end_message):
swmm_file = last_dir + r"\SWMM.INP"
if not os.path.isfile(swmm_file):
return False
else:
elif mode == "Choose":
# Show dialog to import SWMM.INP or cancel its import:
swmm_file, __ = QFileDialog.getOpenFileName(
None, "Select SWMM input file to import data", directory=last_dir, filter="(*.inp *.INP*)"
)
if not swmm_file:
return False
else:
swmm_file = mode

s.setValue("FLO-2D/lastSWMMDir", os.path.dirname(swmm_file))

Expand Down Expand Up @@ -2977,7 +2979,7 @@ def import_INP_action(self):
else:
return "Cancel"

def export_storm_drain_INP_file(self, hdf5_dir=None, hdf5_file=None, set_dat_dir=False):
def export_storm_drain_INP_file(self, hdf5_dir=None, hdf5_file=None, set_dat_dir=False, specific_path=""):
"""
Writes <name>.INP file
(<name> exists or is given by user in initial file dialog).
Expand Down Expand Up @@ -3014,7 +3016,10 @@ def export_storm_drain_INP_file(self, hdf5_dir=None, hdf5_file=None, set_dat_dir
if not swmm_dir:
return
else:
swmm_dir = last_dir
if specific_path != "":
swmm_dir = specific_path
else:
swmm_dir = last_dir

swmm_file = swmm_dir + r"\SWMM.INP"
if os.path.isfile(swmm_file):
Expand Down

0 comments on commit dad799f

Please sign in to comment.