Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #301 from USEPA/dev-ui-py3qt5
Browse files Browse the repository at this point in the history
MTP5r4
  • Loading branch information
TongZhai authored Aug 22, 2019
2 parents 4a7e77d + 44c17da commit d6c5b23
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/core/epanet/inp_reader_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,24 @@ def __init__(self):
def read_section(self, project, section_name, section_text):
section_name_upper = section_name.upper()
if section_name_upper == "[QUALITY]":
self.check_valid_node_id(project, 'QUALITY', section_text)
self.defer_quality = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[COORDINATES]":
self.check_valid_node_id(project, 'COORDINATES', section_text)
self.defer_coordinates = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[VERTICES]":
self.check_valid_link_id(project, 'VERTICES', section_text)
self.defer_vertices = section_text
return
elif section_name_upper == "[TAGS]":
self.defer_tags = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[MIXING]":
self.check_valid_node_id(project, 'MIXING', section_text)
self.defer_mixing = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[EMITTERS]":
self.check_valid_node_id(project, 'EMITTERS', section_text)
self.defer_emitters = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[STATUS]":
self.check_valid_link_id(project, 'STATUS', section_text)
self.defer_status = section_text
return
elif section_name_upper == "[CALIBRATIONS]":
Expand All @@ -105,24 +99,30 @@ def read_section(self, project, section_name, section_text):

def finished_reading(self, project):
if self.defer_quality:
self.check_valid_node_id(project, 'QUALITY', self.defer_quality)
QualityReader.read(self.defer_quality, project)
self.defer_quality = None
if self.defer_coordinates:
self.check_valid_node_id(project, 'COORDINATES', self.defer_coordinates)
CoordinatesReader.read(self.defer_coordinates, project)
self.defer_coordinates = None
if self.defer_vertices:
self.check_valid_link_id(project, 'VERTICES', self.defer_vertices)
VerticesReader.read(self.defer_vertices, project)
self.defer_vertices = None
if self.defer_tags:
TagsReader.read(self.defer_tags, project)
self.defer_tags = None
if self.defer_mixing:
self.check_valid_node_id(project, 'MIXING', self.defer_mixing)
MixingReader.read(self.defer_mixing, project)
self.defer_mixing = None
if self.defer_emitters:
self.check_valid_node_id(project, 'EMITTERS', self.defer_emitters)
EmittersReader.read(self.defer_emitters, project)
self.defer_emitters = None
if self.defer_status:
self.check_valid_link_id(project, 'STATUS', self.defer_status)
StatusReader.read(self.defer_status, project)
self.defer_status = None
project.metric = project.options.hydraulics.flow_units in flow_units_metric
Expand Down
4 changes: 2 additions & 2 deletions src/core/swmm/hydraulics/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ def __init__(self):
Junction.__init__(self)

## StorageCurveType: FUNCTIONAL or TABULAR
self.storage_curve_type = StorageCurveType.TABULAR
self.storage_curve_type = StorageCurveType.FUNCTIONAL

## Storage Curve containing the relationship between
## surface area and storage depth
self.storage_curve = "None"

## A-value in the functional relationship
## between surface area and storage depth.
self.coefficient = '0'
self.coefficient = '1000'

## B-value in the functional relationship
## between surface area and storage depth.
Expand Down
18 changes: 12 additions & 6 deletions src/core/swmm/inp_reader_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,30 +188,30 @@ def read_section(self, project, section_name, section_text):
elif infiltration.startswith("CURVE"):
self.read_infiltration = SectionReaderAsList(section_name, CurveNumberInfiltrationReader)
elif section_name_upper == "[SUBAREAS]":
self.check_valid_subcatchment_id(project, 'SUBAREAS', section_text)
# self.check_valid_subcatchment_id(project, 'SUBAREAS', section_text)
self.defer_subareas = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[COORDINATES]":
self.check_valid_node_id(project, 'COORDINATES', section_text)
# self.check_valid_node_id(project, 'COORDINATES', section_text)
self.defer_coordinates = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[SYMBOLS]":
self.check_valid_raingage_id(project, 'SYMBOLS', section_text)
# self.check_valid_raingage_id(project, 'SYMBOLS', section_text)
self.defer_symbols = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[TAGS]":
self.defer_tags = section_text
return # Skip read_section, defer until finished_reading is called.
elif section_name_upper == "[LOSSES]":
self.check_valid_link_id(project, 'LOSSES', section_text)
# self.check_valid_link_id(project, 'LOSSES', section_text)
self.defer_losses = section_text
return
elif section_name_upper == "[VERTICES]":
self.check_valid_link_id(project, 'VERTICES', section_text)
# self.check_valid_link_id(project, 'VERTICES', section_text)
self.defer_vertices = section_text
return
elif section_name_upper == "[POLYGONS]":
self.check_valid_subcatchment_id(project, 'POLYGONS', section_text)
# self.check_valid_subcatchment_id(project, 'POLYGONS', section_text)
self.defer_polygons = section_text
return
elif section_name_upper == "[GROUNDWATER]":
Expand Down Expand Up @@ -262,24 +262,30 @@ def read_section(self, project, section_name, section_text):

def finished_reading(self, project):
if self.defer_subareas:
self.check_valid_subcatchment_id(project, 'SUBAREAS', self.defer_subareas)
SubareasReader.read(self.defer_subareas, project)
self.defer_subareas = None
if self.defer_coordinates:
self.check_valid_node_id(project, 'COORDINATES', self.defer_coordinates)
CoordinatesReader.read(self.defer_coordinates, project)
self.defer_coordinates = None
if self.defer_symbols:
self.check_valid_raingage_id(project, 'SYMBOLS', self.defer_symbols)
SymbolsReader.read(self.defer_symbols, project)
self.defer_symbols = None
if self.defer_tags:
TagsReader.read(self.defer_tags, project)
self.defer_tags = None
if self.defer_losses:
self.check_valid_link_id(project, 'LOSSES', self.defer_losses)
LossesReader.read(self.defer_losses, project)
self.defer_losses = None
if self.defer_vertices:
self.check_valid_link_id(project, 'VERTICES', self.defer_vertices)
VerticesReader.read(self.defer_vertices, project)
self.defer_vertices = None
if self.defer_polygons:
self.check_valid_subcatchment_id(project, 'POLYGONS', self.defer_polygons)
PolygonsReader.read(self.defer_polygons, project)
self.defer_polygons = None
project.metric = project.options.flow_units in flow_units_metric
Expand Down
10 changes: 8 additions & 2 deletions src/ui/frmMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,7 @@ def on_load(self, tree_top_item_list):
layout.addWidget(self.obj_tree)
self.tabProject.setLayout(layout)
self.setWindowTitle(self.model)
self.dockw_more.setEnabled(False)

def toggle_toolbar(self, eventArg):
tbname, is_checked = eventArg.split(',')
Expand Down Expand Up @@ -2285,14 +2286,18 @@ def save_project(self, file_name=None):
self.project.file_name = new_name
return
if file_name.endswith('*'):
file_name = file_name[-1]
file_name = file_name[:-1]
self.project.file_name = file_name
path_only, file_only = os.path.split(file_name)
self.setWindowTitle(self.model + " - " + file_only)

if self.model == "SWMM":
self.set_project_map_extent()

if self.project_settings.general_preferences['AutoBackup'] > 0:
from shutil import copyfile
copyfile(file_name, file_name + ".bak")
if os.path.exists(file_name):
copyfile(file_name, file_name + ".bak")

project_writer = self.project_writer_type()
project_writer.write_file(self.project, file_name)
Expand Down Expand Up @@ -2342,6 +2347,7 @@ def save_project_as(self):
path_only, file_only = os.path.split(file_name)
try:
self.save_project(file_name)
self.project.file_name = file_name
self.setWindowTitle(self.model + " - " + file_only)
if path_only != directory:
self.program_settings.setValue("ProjectDir", path_only)
Expand Down

0 comments on commit d6c5b23

Please sign in to comment.