Commit b1d0e6dc authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

SL: Add windows title translate.

Showing with 89 additions and 17 deletions
+89 -17
# Window.py -- Pamhyr
# Copyright (C) 2023 INRAE
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -60,19 +60,20 @@ class EditSedimentLayersWindow(PamhyrWindow):
sl=None, parent=None):
self._sl = sl
name = self._sl.name
if name == "":
name = _translate("SedimentLayers", "(no name)")
sl_name = self._sl.name
if sl_name == "":
sl_name = _translate("SedimentLayers", "(no name)")
trad = SedimentEditTranslate()
name = (
self._pamhyr_name + " - " + study.name + " - " + name
trad[self._pamhyr_name] + " - " + study.name + " - " + sl_name
)
super(EditSedimentLayersWindow, self).__init__(
title=name,
study=study,
config=config,
trad=SedimentEditTranslate(),
trad=trad,
parent=parent
)
......
......@@ -11,7 +11,11 @@ class SedimentEditTranslate(SedimentTranslate):
def __init__(self):
super(SedimentEditTranslate, self).__init__()
self._dict["height"] = _translate("SedimentLayers", "Thickness (m)"),
self._dict["Edit Sediment Layers"] = _translate(
"SedimentLayers", "Edit Sediment Layers"
)
self._dict["height"] = _translate("SedimentLayers", "Thickness (m)")
self._sub_dict["table_headers"] = {
"name": _translate("SedimentLayers", "Name"),
......
# Window.py -- Pamhyr
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import logging
......@@ -49,13 +65,14 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
self._profile = profile
self._reach = profile.reach
name = self.compute_name(study)
trad = SedimentProfileTranslate()
name = self.compute_name(study, trad)
super(ProfileSedimentLayersWindow, self).__init__(
title=name,
study=study,
config=config,
trad=SedimentProfileTranslate(),
trad=trad,
parent=parent
)
......@@ -65,7 +82,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
self.ui.setWindowTitle(self._title)
def compute_name(self, study):
def compute_name(self, study, trad):
rname = self._reach.name
if rname == "":
rname = _translate("SedimentLayers", "(no name)")
......@@ -78,7 +95,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
)
return (
self._pamhyr_name + " - "
trad[self._pamhyr_name] + " - "
+ study.name + " - "
+ rname + " - " + pname
)
......
# translate.py -- Pamhyr
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
......@@ -11,6 +27,10 @@ class SedimentProfileTranslate(SedimentReachTranslate):
def __init__(self):
super(SedimentProfileTranslate, self).__init__()
self._dict["Profile sediment layers"] = _translate(
"SedimentLayers", "Profile sediment layers"
)
self._sub_dict["table_headers"] = {
"x": _translate("SedimentLayers", "X (m)"),
"y": _translate("SedimentLayers", "Y (m)"),
......
......@@ -24,9 +24,9 @@ class SLDialog(PamhyrDialog):
_pamhyr_ui = "SLDialog"
_pamhyr_name = "SL"
def __init__(self, study=None, config=None, parent=None):
def __init__(self, study=None, config=None, trad=None, parent=None):
super(SLDialog, self).__init__(
title=self._pamhyr_name,
title=trad[self._pamhyr_name],
study=study,
config=config,
parent=parent
......
......@@ -53,8 +53,9 @@ class ReachSedimentLayersWindow(PamhyrWindow):
else:
self._reach = reach
trad = SedimentReachTranslate()
name = (
self._pamhyr_name + " - " +
trad[self._pamhyr_name] + " - " +
study.name + " - " +
self._reach.name
)
......@@ -63,7 +64,7 @@ class ReachSedimentLayersWindow(PamhyrWindow):
title=name,
study=study,
config=config,
trad=SedimentReachTranslate(),
trad=trad,
parent=parent
)
......@@ -165,6 +166,7 @@ class ReachSedimentLayersWindow(PamhyrWindow):
def apply_sl_each_profile(self):
slw = SLDialog(
study=self._study,
trad=self._trad,
parent=self
)
if slw.exec():
......
# translate.py -- Pamhyr
# Copyright (C) 2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
......@@ -11,6 +27,13 @@ class SedimentReachTranslate(SedimentTranslate):
def __init__(self):
super(SedimentReachTranslate, self).__init__()
self._dict["Reach sediment layers"] = _translate(
"SedimentLayers", "Reach sediment layers"
)
self._dict["SL"] = _translate(
"SedimentLayers", "Apply sediment layers to reach"
)
self._dict["nd"] = _translate("SedimentLayers", "Not defined")
self._dict["kp"] = _translate("SedimentLayers", "Kp (m)")
self._dict["height"] = _translate("SedimentLayers", "Height (m)")
......
......@@ -59,15 +59,16 @@ class SedimentLayersWindow(PamhyrWindow):
def __init__(self, study=None, config=None, parent=None):
self._sediment_layers = study.river.sediment_layers
trad = SedimentTranslate()
name = (
self._pamhyr_name + " - " + study.name
trad[self._pamhyr_name] + " - " + study.name
)
super(SedimentLayersWindow, self).__init__(
title=name,
study=study,
config=config,
trad=SedimentTranslate(),
trad=trad,
parent=parent
)
......
......@@ -11,6 +11,10 @@ class SedimentTranslate(PamhyrTranslate):
def __init__(self):
super(SedimentTranslate, self).__init__()
self._dict["Sediment Layers List"] = _translate(
"SedimentLayers", "Sediment Layers List"
)
self._sub_dict["table_headers"] = {
"name": _translate("SedimentLayers", "Name"),
"comment": _translate("SedimentLayers", "Comment"),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment