mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Compare commits
28
Commits
No files matched your search
+149
-29
@@ -20,6 +20,8 @@ stages:
|
||||
- test
|
||||
- build
|
||||
- package
|
||||
- hash
|
||||
- antivirus
|
||||
- release
|
||||
|
||||
#############
|
||||
@@ -148,23 +150,22 @@ test-pep8:
|
||||
# BUILD #
|
||||
#########
|
||||
|
||||
build-users-doc:
|
||||
stage: build
|
||||
tags:
|
||||
- linux
|
||||
needs:
|
||||
- job: set-version
|
||||
artifacts: true
|
||||
script:
|
||||
- cd ./doc/users/
|
||||
- ./build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- doc/users/documentation.pdf
|
||||
- doc/users/documentation.html
|
||||
- doc/users/images/
|
||||
allow_failure: true
|
||||
|
||||
# build-users-doc:
|
||||
# stage: build
|
||||
# tags:
|
||||
# - linux
|
||||
# needs:
|
||||
# - job: set-version
|
||||
# artifacts: true
|
||||
# script:
|
||||
# - cd ./doc/users/
|
||||
# - ./build.sh
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - doc/users/documentation.pdf
|
||||
# - doc/users/documentation.html
|
||||
# - doc/users/images/
|
||||
# allow_failure: true
|
||||
|
||||
build-td:
|
||||
stage: build
|
||||
@@ -231,8 +232,8 @@ build-linux:
|
||||
artifacts: true
|
||||
- job: build-developers-doc
|
||||
artifacts: true
|
||||
- job: build-users-doc
|
||||
artifacts: true
|
||||
# - job: build-users-doc
|
||||
# artifacts: true
|
||||
- job: build-td
|
||||
artifacts: true
|
||||
script:
|
||||
@@ -322,14 +323,15 @@ build-windows:
|
||||
artifacts: true
|
||||
- job: build-developers-doc
|
||||
artifacts: true
|
||||
- job: build-users-doc
|
||||
artifacts: true
|
||||
# - job: build-users-doc
|
||||
# artifacts: true
|
||||
- job: build-td
|
||||
artifacts: true
|
||||
script:
|
||||
- mkdir windows
|
||||
- cd windows
|
||||
# Setup env
|
||||
- python -m pip install -U pip
|
||||
- python -m pip install -r ..\requirements.txt
|
||||
- python -m pip install -U -r ..\requirements.txt
|
||||
# Run Pyinstaller
|
||||
@@ -403,6 +405,111 @@ windows-package-exe:
|
||||
- copy ..\packages\pamhyr.nsi pamhyr.nsi
|
||||
- .\make-windows-exe.bat
|
||||
|
||||
########
|
||||
# HASH #
|
||||
########
|
||||
|
||||
linux-build-hash:
|
||||
stage: hash
|
||||
tags:
|
||||
- release
|
||||
- linux
|
||||
needs:
|
||||
- job: build-linux
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd linux
|
||||
- sha256sum -b pamhyr/pamhyr/pamhyr > pamhyr/pamhyr/pamhyr.sha256
|
||||
artifacts:
|
||||
paths:
|
||||
- linux/pamhyr/pamhyr/pamhyr.sha256
|
||||
|
||||
windows-build-hash:
|
||||
stage: hash
|
||||
tags:
|
||||
- release
|
||||
- linux
|
||||
needs:
|
||||
- job: build-windows
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd windows
|
||||
- sha256sum -b pamhyr/pamhyr/pamhyr.exe > pamhyr/pamhyr/pamhyr.exe.sha256
|
||||
artifacts:
|
||||
paths:
|
||||
- windows/pamhyr/pamhyr/pamhyr.exe.sha256
|
||||
|
||||
pkg-hash:
|
||||
stage: hash
|
||||
tags:
|
||||
- release
|
||||
- linux
|
||||
needs:
|
||||
- job: linux-package-tar
|
||||
artifacts: true
|
||||
- job: windows-package-zip
|
||||
artifacts: true
|
||||
- job: windows-package-exe
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd windows
|
||||
- sha256sum -b pamhyr-windows.exe > pamhyr-windows.exe.sha256
|
||||
- sha256sum -b pamhyr-windows.zip > pamhyr-windows.zip.sha256
|
||||
- cd ..
|
||||
- cd linux
|
||||
- sha256sum -b pamhyr-gnulinux.tar.xz > pamhyr-gnulinux.tar.xz.sha256
|
||||
artifacts:
|
||||
paths:
|
||||
- windows/pamhyr-windows.exe.sha256
|
||||
- windows/pamhyr-windows.zip.sha256
|
||||
- linux/pamhyr-gnulinux.tar.xz.sha256
|
||||
|
||||
#############
|
||||
# ANTIVIRUS #
|
||||
#############
|
||||
|
||||
build-check-clamav:
|
||||
stage: antivirus
|
||||
tags:
|
||||
- release
|
||||
- linux
|
||||
needs:
|
||||
- job: build-linux
|
||||
artifacts: true
|
||||
- job: build-windows
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd packages
|
||||
- ./clamav-scan.sh builds
|
||||
allow_failure: true
|
||||
|
||||
pkg-check-clamav:
|
||||
stage: antivirus
|
||||
tags:
|
||||
- release
|
||||
- linux
|
||||
needs:
|
||||
- job: linux-package-tar
|
||||
artifacts: true
|
||||
- job: windows-package-zip
|
||||
artifacts: true
|
||||
- job: windows-package-exe
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd packages
|
||||
- ./clamav-scan.sh packages
|
||||
allow_failure: true
|
||||
|
||||
###########
|
||||
# RELEASE #
|
||||
###########
|
||||
@@ -419,10 +526,12 @@ tag-release:
|
||||
artifacts: true
|
||||
- job: windows-package-exe
|
||||
artifacts: true
|
||||
- job: build-users-doc
|
||||
artifacts: true
|
||||
# - job: build-users-doc
|
||||
# artifacts: true
|
||||
- job: build-developers-doc
|
||||
artifacts: true
|
||||
- job: pkg-hash
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
artifacts:
|
||||
@@ -430,33 +539,44 @@ tag-release:
|
||||
- linux/pamhyr-gnulinux.tar.xz
|
||||
- windows/pamhyr-windows.zip
|
||||
- windows/pamhyr-windows.exe
|
||||
- linux/pamhyr-gnulinux.tar.xz.sha256
|
||||
- windows/pamhyr-windows.zip.sha256
|
||||
- windows/pamhyr-windows.exe.sha256
|
||||
- doc/dev/documentation.pdf
|
||||
- doc/users/documentation.pdf
|
||||
# - doc/users/documentation.pdf
|
||||
script:
|
||||
- cd packages
|
||||
release:
|
||||
name: '$CI_COMMIT_TAG'
|
||||
description: 'Automatic release from tag $CI_COMMIT_TAG'
|
||||
description: '$CI_COMMIT_TAG_MESSAGE'
|
||||
tag_name: '$CI_COMMIT_TAG'
|
||||
ref: '$CI_COMMIT_SHA'
|
||||
assets:
|
||||
links:
|
||||
- name: 'GNU/Linux CHECKSUM SHA256 (tar.xz)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz.sha256'
|
||||
filepath: '/linux/pamhyr-gnulinux.tar.xz.sha256'
|
||||
link_type: 'package'
|
||||
- name: 'GNU/Linux (tar.xz)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz'
|
||||
filepath: '/linux/pamhyr-gnulinux.tar.xz'
|
||||
link_type: 'package'
|
||||
- name: 'Windows CHECKSUM SHA256 (exe)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe.sha256'
|
||||
filepath: '/windows/pamhyr-windows.exe.sha256'
|
||||
link_type: 'package'
|
||||
- name: 'Windows (exe)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe'
|
||||
filepath: '/windows/pamhyr-windows.exe'
|
||||
link_type: 'package'
|
||||
- name: 'Windows CHECKSUM SHA256 (zip)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip.sha256'
|
||||
filepath: '/windows/pamhyr-windows.zip.sha256'
|
||||
link_type: 'package'
|
||||
- name: 'Windows (zip)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip'
|
||||
filepath: '/windows/pamhyr-windows.zip'
|
||||
link_type: 'package'
|
||||
- name: 'User documentations (pdf)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/users/documentation.pdf'
|
||||
filepath: '/doc/users/documentation.pdf'
|
||||
link_type: 'other'
|
||||
- name: 'Dev documentations (pdf)'
|
||||
url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/dev/documentation.pdf'
|
||||
filepath: '/doc/dev/documentation.pdf'
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#! /bin/bash
|
||||
set +x
|
||||
|
||||
OPTS="-r -a -i"
|
||||
|
||||
if [ "$1" == "builds" ]; then
|
||||
FILES="../windows/ ../linux/"
|
||||
else
|
||||
FILES="../windows/pamhyr-windows.exe ../windows/pamhyr-windows.zip ../linux/pamhyr-gnulinux.tar.xz"
|
||||
fi
|
||||
|
||||
clamscan $OPTS $FILES | tee clamav.log
|
||||
|
||||
RES=$(cat clamav.log | grep "Infected files: 0")
|
||||
if [ -z "$RES" ]; then
|
||||
echo "Infected files"
|
||||
exit -1
|
||||
else
|
||||
echo "OK"
|
||||
exit 0
|
||||
fi
|
||||
+1
-1
@@ -294,7 +294,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||
proc = QProcess()
|
||||
proc.setWorkingDirectory(tmp)
|
||||
|
||||
logger.debug(f"mailleurTT '{st_file}, {m_file}, {str(step)}'")
|
||||
logger.debug(f"! mailleurTT {st_file} {m_file} {str(step)}")
|
||||
proc.start(
|
||||
self._exe_path(), [st_file, m_file, str(step)]
|
||||
)
|
||||
|
||||
@@ -200,6 +200,9 @@ class BoundaryCondition(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"B{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -26,11 +26,21 @@ logger = logging.getLogger()
|
||||
|
||||
|
||||
class Friction(SQLSubModel):
|
||||
def __init__(self, name: str = "", status=None):
|
||||
_id_cnt = 0
|
||||
|
||||
def __init__(self, id: int = -1, name: str = "",
|
||||
status=None):
|
||||
super(Friction, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
if id == -1:
|
||||
self.id = Friction._id_cnt
|
||||
else:
|
||||
self.id = id
|
||||
|
||||
Friction._id_cnt = max(self.id, Friction._id_cnt+1)
|
||||
|
||||
self._name = name
|
||||
self._edge = None
|
||||
self._begin_kp = 0.0
|
||||
@@ -42,13 +52,13 @@ class Friction(SQLSubModel):
|
||||
def _db_create(cls, execute):
|
||||
execute("""
|
||||
CREATE TABLE friction(
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
ind INTERGER NOT NULL,
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
ind INTEGER NOT NULL,
|
||||
begin_kp REAL NOT NULL,
|
||||
end_kp REAL NOT NULL,
|
||||
reach INTEGER NOT NULL,
|
||||
begin_strickler INTERGER,
|
||||
end_strickler INTERGER,
|
||||
begin_strickler INTEGER NOT NULL,
|
||||
end_strickler INTEGER NOT NULL,
|
||||
FOREIGN KEY(reach) REFERENCES river_reach(id),
|
||||
FOREIGN KEY(begin_strickler) REFERENCES stricklers(id),
|
||||
FOREIGN KEY(end_strickler) REFERENCES stricklers(id)
|
||||
@@ -70,28 +80,30 @@ class Friction(SQLSubModel):
|
||||
stricklers = data["stricklers"].stricklers
|
||||
|
||||
table = execute(
|
||||
"SELECT ind, begin_kp, end_kp, begin_strickler, end_strickler " +
|
||||
"SELECT id, ind, begin_kp, end_kp, " +
|
||||
"begin_strickler, end_strickler " +
|
||||
f"FROM friction WHERE reach = {reach.id}"
|
||||
)
|
||||
|
||||
for row in table:
|
||||
ind = row[0]
|
||||
id = row[0]
|
||||
ind = row[1]
|
||||
# Get stricklers
|
||||
if int(row[3]) == -1:
|
||||
if int(row[4]) == -1:
|
||||
bs = None
|
||||
else:
|
||||
bs = next(filter(lambda s: s.id == row[3], stricklers))
|
||||
bs = next(filter(lambda s: s.id == row[4], stricklers))
|
||||
|
||||
if int(row[4]) == -1:
|
||||
if int(row[5]) == -1:
|
||||
es = None
|
||||
else:
|
||||
es = next(filter(lambda s: s.id == row[4], stricklers))
|
||||
es = next(filter(lambda s: s.id == row[5], stricklers))
|
||||
|
||||
# Create friction
|
||||
sec = cls(status=status)
|
||||
sec.edge = reach
|
||||
sec.begin_kp = row[1]
|
||||
sec.end_kp = row[2]
|
||||
sec.begin_kp = row[2]
|
||||
sec.end_kp = row[3]
|
||||
sec.begin_strickler = bs
|
||||
sec.end_strickler = es
|
||||
|
||||
@@ -112,10 +124,11 @@ class Friction(SQLSubModel):
|
||||
|
||||
execute(
|
||||
"INSERT INTO " +
|
||||
"friction(ind, begin_kp, end_kp, " +
|
||||
"friction(id, ind, begin_kp, end_kp, " +
|
||||
"reach, begin_strickler, end_strickler) " +
|
||||
"VALUES (" +
|
||||
f"{ind}, {self._begin_kp}, {self._end_kp}, " +
|
||||
f"{self.id}, {ind}, " +
|
||||
f"{self._begin_kp}, {self._end_kp}, " +
|
||||
f"{self._edge.id}, " +
|
||||
f"{b_s_id}, {e_s_id}" +
|
||||
")"
|
||||
|
||||
@@ -158,6 +158,9 @@ class BasicHS(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"{self._type}{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -187,6 +187,9 @@ class HydraulicStructure(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"HS{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -200,6 +200,9 @@ class LateralContribution(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"L{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -152,6 +152,9 @@ class Reservoir(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"R{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -372,6 +372,12 @@ class River(Graph, SQLSubModel):
|
||||
except Exception as e:
|
||||
logger_exception(e)
|
||||
|
||||
def init_default(self):
|
||||
n1 = self.add_node(880.0, 950.0)
|
||||
n2 = self.add_node(1120.0, 1020.0)
|
||||
|
||||
e = self.add_edge(n1, n2)
|
||||
|
||||
@property
|
||||
def boundary_condition(self):
|
||||
return self._boundary_condition
|
||||
|
||||
@@ -37,6 +37,9 @@ class Layer(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"Layer{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
@@ -204,6 +207,9 @@ class SedimentLayer(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"SL{self.id + 1}"
|
||||
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
@@ -120,6 +120,8 @@ class Stricklers(SQLSubModel):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._name == "":
|
||||
return f"K{self.id + 1}"
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
|
||||
+8
-3
@@ -90,7 +90,7 @@ class Mage(CommandLineSolver):
|
||||
("mage_compute_reach_volume_balance", "y"),
|
||||
("mage_max_reach_volume_balance", "0.001"),
|
||||
("mage_min_reach_volume_to_check", "1000.0"),
|
||||
("mage_init_internal", " "),
|
||||
("mage_init_internal", "n"),
|
||||
]
|
||||
|
||||
return lst
|
||||
@@ -792,6 +792,10 @@ class Mage8(Mage):
|
||||
value = ("p" if value.lower() in ["y", "yes", "true"]
|
||||
else "")
|
||||
|
||||
logger.debug(
|
||||
f"export: PAR: {name}: {value} ({p.value})"
|
||||
)
|
||||
|
||||
f.write(f"{name} {value}\n")
|
||||
|
||||
return files
|
||||
@@ -1200,9 +1204,10 @@ class Mage8(Mage):
|
||||
logger.info(f"read_gra: ... end with {len(ts)} timestamp read")
|
||||
|
||||
@timer
|
||||
def results(self, study, repertory, qlog=None):
|
||||
def results(self, study, repertory, qlog=None, name=None):
|
||||
self._study = study
|
||||
name = study.name.replace(" ", "_")
|
||||
if name is None:
|
||||
name = study.name.replace(" ", "_")
|
||||
|
||||
results = super(Mage8, self).results(study, repertory, qlog, name=name)
|
||||
self.read_gra(study, repertory, results, qlog, name=name)
|
||||
|
||||
@@ -24,13 +24,13 @@ from Solver.Mage import Mage7, Mage8
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
solver_long_name = {
|
||||
"generic": "Generic",
|
||||
# "generic": "Generic",
|
||||
# "mage7": "Mage v7",
|
||||
"mage8": "Mage v8",
|
||||
}
|
||||
|
||||
solver_type_list = {
|
||||
"generic": GenericSolver,
|
||||
# "generic": GenericSolver,
|
||||
# "mage7": Mage7,
|
||||
"mage8": Mage8,
|
||||
}
|
||||
@@ -167,6 +167,7 @@ class CheckListWindow(PamhyrWindow):
|
||||
self.find(QPushButton, "pushButton_ok").setEnabled(True)
|
||||
if self._autorun:
|
||||
self._parent.solver_log(self._solver)
|
||||
self.end()
|
||||
|
||||
self.update_statusbar()
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ class GeometryTranslate(PamhyrTranslate):
|
||||
|
||||
self._dict["open_file"] = _translate("Geometry", "Open a file")
|
||||
self._dict["file_st"] = _translate(
|
||||
"Geometry", "File mage geometry (*.ST)")
|
||||
"Geometry", "File mage geometry (*.ST *.st)")
|
||||
self._dict["file_m"] = _translate(
|
||||
"Geometry", "File mage meshed geometry (*.M)")
|
||||
"Geometry", "File mage meshed geometry (*.M *.m)")
|
||||
self._dict["file_all"] = _translate("Geometry", "All file (*)")
|
||||
|
||||
self._dict["reach"] = _translate("Geometry", "reach")
|
||||
@@ -44,6 +44,6 @@ class GeometryTranslate(PamhyrTranslate):
|
||||
|
||||
self._sub_dict["table_headers"] = {
|
||||
"name": _translate("Geometry", "Name"),
|
||||
"kp": _translate("Geometry", "KP"),
|
||||
"kp": _translate("Geometry", "KP (m)"),
|
||||
"poins": _translate("Geometry", "Points"),
|
||||
}
|
||||
@@ -530,16 +530,16 @@ class GeometryWindow(PamhyrWindow):
|
||||
def _undo(self):
|
||||
self._table.undo()
|
||||
self.select_current_profile()
|
||||
self.update_plot_ac()
|
||||
self.update_plot_xy()
|
||||
self.update_plot_kpc()
|
||||
# self.update_plot_ac()
|
||||
# self.update_plot_xy()
|
||||
# self.update_plot_kpc()
|
||||
|
||||
def _redo(self):
|
||||
self._table.redo()
|
||||
self.select_current_profile()
|
||||
self.update_plot_ac()
|
||||
self.update_plot_xy()
|
||||
self.update_plot_kpc()
|
||||
# self.update_plot_ac()
|
||||
# self.update_plot_xy()
|
||||
# self.update_plot_kpc()
|
||||
|
||||
def export_to_file(self):
|
||||
settings = QSettings(
|
||||
|
||||
@@ -41,22 +41,22 @@ hydraulic structure values?"
|
||||
# BHSValues translation
|
||||
|
||||
self._dict['width'] = _translate(
|
||||
"BasicHydraulicStructures", "Width"
|
||||
"BasicHydraulicStructures", "Width (m)"
|
||||
)
|
||||
self._dict['height'] = _translate(
|
||||
"BasicHydraulicStructures", "Height"
|
||||
"BasicHydraulicStructures", "Thickness (m)"
|
||||
)
|
||||
self._dict['elevation'] = _translate(
|
||||
"BasicHydraulicStructures", "Elevation"
|
||||
"BasicHydraulicStructures", "Elevation (m)"
|
||||
)
|
||||
self._dict['diameter'] = _translate(
|
||||
"BasicHydraulicStructures", "Diameter"
|
||||
"BasicHydraulicStructures", "Diameter (m)"
|
||||
)
|
||||
self._dict['discharge_coefficient'] = _translate(
|
||||
"BasicHydraulicStructures", "Discharge coefficient"
|
||||
)
|
||||
self._dict['loading_elevation'] = _translate(
|
||||
"BasicHydraulicStructures", "Loading elevation"
|
||||
"BasicHydraulicStructures", "Upper elevation (m)"
|
||||
)
|
||||
self._dict['half-angle_tangent'] = _translate(
|
||||
"BasicHydraulicStructures", "Half-angle tangent"
|
||||
@@ -65,13 +65,13 @@ hydraulic structure values?"
|
||||
"BasicHydraulicStructures", "Maximal loading elevation"
|
||||
)
|
||||
self._dict['siltation_height'] = _translate(
|
||||
"BasicHydraulicStructures", "Siltation height"
|
||||
"BasicHydraulicStructures", "Siltation height (m)"
|
||||
)
|
||||
self._dict['top_of_the_vault'] = _translate(
|
||||
"BasicHydraulicStructures", "Top of the vault"
|
||||
"BasicHydraulicStructures", "Top of the vault (m)"
|
||||
)
|
||||
self._dict['bottom_of_the_vault'] = _translate(
|
||||
"BasicHydraulicStructures", "Bottom of the vault"
|
||||
"BasicHydraulicStructures", "Bottom of the vault (m)"
|
||||
)
|
||||
self._dict['opening'] = _translate(
|
||||
"BasicHydraulicStructures", "Opening"
|
||||
|
||||
@@ -30,5 +30,5 @@ class HydraulicStructuresTranslate(PamhyrTranslate):
|
||||
self._sub_dict["table_headers"] = {
|
||||
"name": _translate("HydraulicStructures", "Name"),
|
||||
"reach": _translate("HydraulicStructures", "Reach"),
|
||||
"kp": _translate("HydraulicStructures", "Kp"),
|
||||
"kp": _translate("HydraulicStructures", "Kp (m)"),
|
||||
}
|
||||
+51
-24
@@ -175,7 +175,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
self.findChild(QAction, action).setEnabled(enable)
|
||||
|
||||
def setup_sc(self):
|
||||
# self._run_sc = QShortcut(QKeySequence("F5"), self)
|
||||
self._run_sc = QShortcut(QKeySequence("F6"), self)
|
||||
return
|
||||
|
||||
def setup_connection(self):
|
||||
@@ -202,7 +202,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
"action_menu_initial_conditions": self.open_initial_conditions,
|
||||
"action_menu_edit_friction": self.open_frictions,
|
||||
"action_menu_edit_lateral_contribution": self.open_lateral_contrib,
|
||||
"action_menu_run_solver": self.run_solver,
|
||||
"action_menu_run_solver": self.select_and_run_solver,
|
||||
"action_menu_sediment_layers": self.open_sediment_layers,
|
||||
"action_menu_edit_reach_sediment_layers":
|
||||
self.open_reach_sediment_layers,
|
||||
@@ -222,7 +222,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
"action_toolBar_open": self.open_model,
|
||||
"action_toolBar_save": self.save_study,
|
||||
"action_toolBar_close": self.close_model,
|
||||
"action_toolBar_run_solver": self.run_solver,
|
||||
"action_toolBar_run_solver": self.run_lasest_solver,
|
||||
# Current actions
|
||||
"action_toolBar_network": self.open_network,
|
||||
"action_toolBar_geometry": self.open_geometry,
|
||||
@@ -243,7 +243,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
.triggered.connect(actions[action])
|
||||
# action.triggered.connect(actions[action])
|
||||
|
||||
# self._run_sc.activated.connect(self.run_solver)
|
||||
self._run_sc.activated.connect(self.run_lasest_solver)
|
||||
|
||||
def changeEvent(self, event):
|
||||
if event.type() == QEvent.LanguageChange:
|
||||
@@ -454,9 +454,21 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
"", "Pamhyr(*.pamhyr)"
|
||||
)
|
||||
|
||||
if file_name.rsplit(".", 1)[-1] == ".pamhyr":
|
||||
logger.debug(f"Save study as : {repr(file_name)}")
|
||||
if file_name == "":
|
||||
return
|
||||
|
||||
if file_name.rsplit(".", 1)[-1] == "pamhyr":
|
||||
logger.debug(
|
||||
"Pamhyr extention is present : " +
|
||||
f"{repr(file_name)}"
|
||||
)
|
||||
self._study.filename = file_name
|
||||
else:
|
||||
logger.debug(
|
||||
"Pamhyr extention is not present : " +
|
||||
f"{repr(file_name + '.pamhyr')}"
|
||||
)
|
||||
self._study.filename = file_name + ".pamhyr"
|
||||
|
||||
sql_request_count = self._study.sql_save_request_count()
|
||||
@@ -796,7 +808,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
)
|
||||
sl.show()
|
||||
|
||||
def run_solver(self):
|
||||
def run_lasest_solver(self):
|
||||
if self._last_solver is None:
|
||||
return
|
||||
|
||||
self.run_solver(self._last_solver)
|
||||
|
||||
def select_and_run_solver(self):
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
@@ -806,25 +824,29 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
parent=self
|
||||
)
|
||||
if run.exec():
|
||||
solver = run.solver
|
||||
self.run_solver(run.solver)
|
||||
|
||||
if self.sub_window_exists(
|
||||
CheckListWindow,
|
||||
data=[
|
||||
self._study,
|
||||
self.conf,
|
||||
solver
|
||||
]
|
||||
):
|
||||
return
|
||||
def run_solver(self, solver):
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
check = CheckListWindow(
|
||||
study=self._study,
|
||||
config=self.conf,
|
||||
solver=solver,
|
||||
parent=self
|
||||
)
|
||||
check.show()
|
||||
if self.sub_window_exists(
|
||||
CheckListWindow,
|
||||
data=[
|
||||
self._study,
|
||||
self.conf,
|
||||
solver
|
||||
]
|
||||
):
|
||||
return
|
||||
|
||||
check = CheckListWindow(
|
||||
study=self._study,
|
||||
config=self.conf,
|
||||
solver=solver,
|
||||
parent=self
|
||||
)
|
||||
check.show()
|
||||
|
||||
def solver_log(self, solver):
|
||||
sol = SolverLogWindow(
|
||||
@@ -843,15 +865,19 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
if self._last_results is None:
|
||||
results = solver.results(
|
||||
self._study,
|
||||
self._solver_workdir(solver)
|
||||
self._solver_workdir(solver),
|
||||
)
|
||||
|
||||
# Open from file
|
||||
if type(results) is str:
|
||||
logger.info(f"Open results from {os.path.dirname(results)}")
|
||||
|
||||
name = os.path.basename(results).replace(".BIN", "")
|
||||
|
||||
results = solver.results(
|
||||
self._study,
|
||||
os.path.dirname(results),
|
||||
name=name
|
||||
)
|
||||
|
||||
# No results available
|
||||
@@ -918,6 +944,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
|
||||
if dialog.exec_():
|
||||
file_name = dialog.selectedFiles()
|
||||
logger.info(f"Select results: {file_name}")
|
||||
self.open_solver_results(
|
||||
self._last_solver,
|
||||
results=file_name[0]
|
||||
|
||||
@@ -174,7 +174,8 @@ class EdgeItem(QGraphicsItem):
|
||||
return
|
||||
|
||||
# Select color
|
||||
color = Qt.darkBlue
|
||||
# color = Qt.darkBlue
|
||||
color = Qt.black
|
||||
if self.graph.selected_item() == self:
|
||||
color = Qt.red
|
||||
elif self.graph.current_edge() == self:
|
||||
|
||||
@@ -36,7 +36,7 @@ class CustomPlotTranslate(ResultsTranslate):
|
||||
"CustomPlot", "Kp (m)"
|
||||
)
|
||||
self._dict['elevation'] = _translate(
|
||||
"CustomPlot", "Elevation (m)"
|
||||
"CustomPlot", "Bed load elevation (m)"
|
||||
)
|
||||
self._dict['water_elevation'] = _translate(
|
||||
"CustomPlot", "Water elevation (m)"
|
||||
@@ -48,7 +48,7 @@ class CustomPlotTranslate(ResultsTranslate):
|
||||
# Unit corresponding long name (plot axes display)
|
||||
|
||||
self._dict['0-meter'] = _translate(
|
||||
"CustomPlot", "Elevation (m)"
|
||||
"CustomPlot", "Bed load elevation (m)"
|
||||
)
|
||||
self._dict['1-m3s'] = _translate(
|
||||
"CustomPlot", "Discharge (m³/s)"
|
||||
|
||||
@@ -225,8 +225,11 @@ class SolverLogWindow(PamhyrWindow):
|
||||
self._log_int(msg, color)
|
||||
|
||||
def _log_str(self, msg, color=None):
|
||||
if msg == "":
|
||||
return
|
||||
|
||||
logger.info(f"solver: {msg}")
|
||||
msg = msg.rsplit('\n')[0]
|
||||
msg = msg.rsplit('\n', 1)[0]
|
||||
|
||||
if color is not None:
|
||||
msg = f"<font color=\"{color}\">" + msg + "</font>"
|
||||
|
||||
@@ -11,12 +11,12 @@ class SedimentEditTranslate(SedimentTranslate):
|
||||
def __init__(self):
|
||||
super(SedimentEditTranslate, self).__init__()
|
||||
|
||||
self._dict["height"] = _translate("SedimentLayers", "Height (m)"),
|
||||
self._dict["height"] = _translate("SedimentLayers", "Thickness (m)"),
|
||||
|
||||
self._sub_dict["table_headers"] = {
|
||||
"name": _translate("SedimentLayers", "Name"),
|
||||
# "type": _translate("SedimentLayers", "Type"),
|
||||
"height": _translate("SedimentLayers", "Height"),
|
||||
"height": _translate("SedimentLayers", "Thickness (m)"),
|
||||
"d50": _translate("SedimentLayers", "D50"),
|
||||
"sigma": _translate("SedimentLayers", "Sigma"),
|
||||
"critical_constraint": _translate("SedimentLayers",
|
||||
|
||||
@@ -96,76 +96,6 @@ class TableModel(PamhyrTableModel):
|
||||
self.dataChanged.emit(index, index)
|
||||
return True
|
||||
|
||||
# def add(self, row, parent=QModelIndex()):
|
||||
# self.beginInsertRows(parent, row, row - 1)
|
||||
|
||||
# self._undo.push(
|
||||
# AddCommand(
|
||||
# self._lst, row
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.endInsertRows()
|
||||
# self.layoutChanged.emit()
|
||||
|
||||
# def delete(self, rows, parent=QModelIndex()):
|
||||
# self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||
|
||||
# self._undo.push(
|
||||
# DelCommand(
|
||||
# self._lst, rows
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.endRemoveRows()
|
||||
# self.layoutChanged.emit()
|
||||
|
||||
# def sort(self, _reverse, parent=QModelIndex()):
|
||||
# self.layoutAboutToBeChanged.emit()
|
||||
|
||||
# self._undo.push(
|
||||
# SortCommand(
|
||||
# self._lst, False
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.layoutAboutToBeChanged.emit()
|
||||
# self.layoutChanged.emit()
|
||||
|
||||
# def move_up(self, row, parent=QModelIndex()):
|
||||
# if row <= 0:
|
||||
# return
|
||||
|
||||
# target = row + 2
|
||||
|
||||
# self.beginMoveRows(parent, row - 1, row - 1, parent, target)
|
||||
|
||||
# self._undo_stack.push(
|
||||
# MoveCommand(
|
||||
# self._lst, "up", row
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.endMoveRows()
|
||||
# self.layoutChanged.emit()
|
||||
|
||||
# def move_down(self, index, parent=QModelIndex()):
|
||||
# if row > len(self._lst):
|
||||
# return
|
||||
|
||||
# target = row
|
||||
|
||||
# self.beginMoveRows(parent, row + 1, row + 1, parent, target)
|
||||
|
||||
# self._undo_stack.push(
|
||||
# MoveCommand(
|
||||
# self._lst, "down", row
|
||||
# )
|
||||
# )
|
||||
|
||||
# self.endMoveRows()
|
||||
# self.layoutChanged.emit()
|
||||
|
||||
def undo(self):
|
||||
self._undo.undo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
@@ -29,7 +29,7 @@ class StricklersTranslate(PamhyrTranslate):
|
||||
|
||||
self._sub_dict["table_headers"] = {
|
||||
"name": _translate("LateralContribution", "Name"),
|
||||
"minor": _translate("LateralContribution", "Minor bed"),
|
||||
"medium": _translate("LateralContribution", "Medium bed"),
|
||||
"minor": _translate("LateralContribution", "Main channel"),
|
||||
"medium": _translate("LateralContribution", "Floodway"),
|
||||
"comment": _translate("LateralContribution", "Comment"),
|
||||
}
|
||||
@@ -89,6 +89,8 @@ class NewStudyWindow(PamhyrDialog):
|
||||
|
||||
if self._study is None:
|
||||
study = Study.new(name, description)
|
||||
study.river.init_default()
|
||||
|
||||
if self.get_radio_button("radioButton_date"):
|
||||
date = self.get_datetime_edit("dateTimeEdit_date")
|
||||
study.use_date(date)
|
||||
|
||||
@@ -264,8 +264,8 @@
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
|
||||
@@ -35,13 +35,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_run">
|
||||
<property name="text">
|
||||
@@ -53,6 +46,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
<width>1152</width>
|
||||
<height>648</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -43,7 +43,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<width>1152</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
||||
+313
-214
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user