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 # Window.py -- Pamhyr
# Copyright (C) 2023 INRAE # Copyright (C) 2023-2024 INRAE
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -60,19 +60,20 @@ class EditSedimentLayersWindow(PamhyrWindow): ...@@ -60,19 +60,20 @@ class EditSedimentLayersWindow(PamhyrWindow):
sl=None, parent=None): sl=None, parent=None):
self._sl = sl self._sl = sl
name = self._sl.name sl_name = self._sl.name
if name == "": if sl_name == "":
name = _translate("SedimentLayers", "(no name)") sl_name = _translate("SedimentLayers", "(no name)")
trad = SedimentEditTranslate()
name = ( name = (
self._pamhyr_name + " - " + study.name + " - " + name trad[self._pamhyr_name] + " - " + study.name + " - " + sl_name
) )
super(EditSedimentLayersWindow, self).__init__( super(EditSedimentLayersWindow, self).__init__(
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=SedimentEditTranslate(), trad=trad,
parent=parent parent=parent
) )
......
...@@ -11,7 +11,11 @@ class SedimentEditTranslate(SedimentTranslate): ...@@ -11,7 +11,11 @@ class SedimentEditTranslate(SedimentTranslate):
def __init__(self): def __init__(self):
super(SedimentEditTranslate, self).__init__() 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"] = { self._sub_dict["table_headers"] = {
"name": _translate("SedimentLayers", "Name"), "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 -*- # -*- coding: utf-8 -*-
import logging import logging
...@@ -49,13 +65,14 @@ class ProfileSedimentLayersWindow(PamhyrWindow): ...@@ -49,13 +65,14 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
self._profile = profile self._profile = profile
self._reach = profile.reach self._reach = profile.reach
name = self.compute_name(study) trad = SedimentProfileTranslate()
name = self.compute_name(study, trad)
super(ProfileSedimentLayersWindow, self).__init__( super(ProfileSedimentLayersWindow, self).__init__(
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=SedimentProfileTranslate(), trad=trad,
parent=parent parent=parent
) )
...@@ -65,7 +82,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow): ...@@ -65,7 +82,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
self.ui.setWindowTitle(self._title) self.ui.setWindowTitle(self._title)
def compute_name(self, study): def compute_name(self, study, trad):
rname = self._reach.name rname = self._reach.name
if rname == "": if rname == "":
rname = _translate("SedimentLayers", "(no name)") rname = _translate("SedimentLayers", "(no name)")
...@@ -78,7 +95,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow): ...@@ -78,7 +95,7 @@ class ProfileSedimentLayersWindow(PamhyrWindow):
) )
return ( return (
self._pamhyr_name + " - " trad[self._pamhyr_name] + " - "
+ study.name + " - " + study.name + " - "
+ rname + " - " + pname + 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 -*- # -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
...@@ -11,6 +27,10 @@ class SedimentProfileTranslate(SedimentReachTranslate): ...@@ -11,6 +27,10 @@ class SedimentProfileTranslate(SedimentReachTranslate):
def __init__(self): def __init__(self):
super(SedimentProfileTranslate, self).__init__() super(SedimentProfileTranslate, self).__init__()
self._dict["Profile sediment layers"] = _translate(
"SedimentLayers", "Profile sediment layers"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"x": _translate("SedimentLayers", "X (m)"), "x": _translate("SedimentLayers", "X (m)"),
"y": _translate("SedimentLayers", "Y (m)"), "y": _translate("SedimentLayers", "Y (m)"),
......
...@@ -24,9 +24,9 @@ class SLDialog(PamhyrDialog): ...@@ -24,9 +24,9 @@ class SLDialog(PamhyrDialog):
_pamhyr_ui = "SLDialog" _pamhyr_ui = "SLDialog"
_pamhyr_name = "SL" _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__( super(SLDialog, self).__init__(
title=self._pamhyr_name, title=trad[self._pamhyr_name],
study=study, study=study,
config=config, config=config,
parent=parent parent=parent
......
...@@ -53,8 +53,9 @@ class ReachSedimentLayersWindow(PamhyrWindow): ...@@ -53,8 +53,9 @@ class ReachSedimentLayersWindow(PamhyrWindow):
else: else:
self._reach = reach self._reach = reach
trad = SedimentReachTranslate()
name = ( name = (
self._pamhyr_name + " - " + trad[self._pamhyr_name] + " - " +
study.name + " - " + study.name + " - " +
self._reach.name self._reach.name
) )
...@@ -63,7 +64,7 @@ class ReachSedimentLayersWindow(PamhyrWindow): ...@@ -63,7 +64,7 @@ class ReachSedimentLayersWindow(PamhyrWindow):
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=SedimentReachTranslate(), trad=trad,
parent=parent parent=parent
) )
...@@ -165,6 +166,7 @@ class ReachSedimentLayersWindow(PamhyrWindow): ...@@ -165,6 +166,7 @@ class ReachSedimentLayersWindow(PamhyrWindow):
def apply_sl_each_profile(self): def apply_sl_each_profile(self):
slw = SLDialog( slw = SLDialog(
study=self._study, study=self._study,
trad=self._trad,
parent=self parent=self
) )
if slw.exec(): 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 -*- # -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
...@@ -11,6 +27,13 @@ class SedimentReachTranslate(SedimentTranslate): ...@@ -11,6 +27,13 @@ class SedimentReachTranslate(SedimentTranslate):
def __init__(self): def __init__(self):
super(SedimentReachTranslate, self).__init__() 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["nd"] = _translate("SedimentLayers", "Not defined")
self._dict["kp"] = _translate("SedimentLayers", "Kp (m)") self._dict["kp"] = _translate("SedimentLayers", "Kp (m)")
self._dict["height"] = _translate("SedimentLayers", "Height (m)") self._dict["height"] = _translate("SedimentLayers", "Height (m)")
......
...@@ -59,15 +59,16 @@ class SedimentLayersWindow(PamhyrWindow): ...@@ -59,15 +59,16 @@ class SedimentLayersWindow(PamhyrWindow):
def __init__(self, study=None, config=None, parent=None): def __init__(self, study=None, config=None, parent=None):
self._sediment_layers = study.river.sediment_layers self._sediment_layers = study.river.sediment_layers
trad = SedimentTranslate()
name = ( name = (
self._pamhyr_name + " - " + study.name trad[self._pamhyr_name] + " - " + study.name
) )
super(SedimentLayersWindow, self).__init__( super(SedimentLayersWindow, self).__init__(
title=name, title=name,
study=study, study=study,
config=config, config=config,
trad=SedimentTranslate(), trad=trad,
parent=parent parent=parent
) )
......
...@@ -11,6 +11,10 @@ class SedimentTranslate(PamhyrTranslate): ...@@ -11,6 +11,10 @@ class SedimentTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(SedimentTranslate, self).__init__() super(SedimentTranslate, self).__init__()
self._dict["Sediment Layers List"] = _translate(
"SedimentLayers", "Sediment Layers List"
)
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"name": _translate("SedimentLayers", "Name"), "name": _translate("SedimentLayers", "Name"),
"comment": _translate("SedimentLayers", "Comment"), "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