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

Pamhyr: Factorize some translate.

Showing with 105 additions and 135 deletions
+105 -135
......@@ -18,7 +18,7 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
from View.BoundaryCondition.translate import BCTranslate
......@@ -36,9 +36,9 @@ class BCETranslate(BCTranslate):
self._sub_dict["table_headers"] = {
"x": _translate("BoundaryCondition", "X"),
"y": _translate("BoundaryCondition", "Y"),
"time": _translate("BoundaryCondition", "Time"),
"date": _translate("BoundaryCondition", "Date"),
"discharge": _translate("BoundaryCondition", "Discharge (m³/s)"),
"z": _translate("BoundaryCondition", "Z (m)"),
"time": self._dict["time"],
"date": self._dict["date"],
"discharge": self._dict["unit_discharge"],
"z": self._dict["unit_elevation"],
"solid": _translate("BoundaryCondition", "Solid (kg/s)"),
}
......@@ -18,7 +18,7 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
from Model.BoundaryCondition.BoundaryConditionTypes import (
NotDefined, PonctualContribution,
......@@ -38,7 +38,7 @@ BC_types = {
}
class BCTranslate(PamhyrTranslate):
class BCTranslate(MainTranslate):
def __init__(self):
super(BCTranslate, self).__init__()
......@@ -56,7 +56,7 @@ class BCTranslate(PamhyrTranslate):
}
self._sub_dict["table_headers"] = {
"name": _translate("BoundaryCondition", "Name"),
"type": _translate("BoundaryCondition", "Type"),
"name": self._dict["name"],
"type": self._dict["type"],
"node": _translate("BoundaryCondition", "Node")
}
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class CheckListTranslate(PamhyrTranslate):
class CheckListTranslate(MainTranslate):
def __init__(self):
super(CheckListTranslate, self).__init__()
......@@ -32,6 +32,6 @@ class CheckListTranslate(PamhyrTranslate):
)
self._sub_dict["table_headers"] = {
"name": _translate("CheckList", "Name"),
"name": self._dict["name"],
"status": _translate("CheckList", "Status"),
}
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class ConfigureTranslate(PamhyrTranslate):
class ConfigureTranslate(MainTranslate):
def __init__(self):
super(ConfigureTranslate, self).__init__()
......@@ -32,9 +32,9 @@ class ConfigureTranslate(PamhyrTranslate):
)
self._sub_dict["table_headers"] = {
"name": _translate("Configure", "Name"),
"type": _translate("Configure", "Type"),
"description": _translate("Configure", "Description"),
"name": self._dict["name"],
"type": self._dict["type"],
"description": self._dict["description"],
}
# Solvers
......
......@@ -18,18 +18,16 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class FrictionsTranslate(PamhyrTranslate):
class FrictionsTranslate(MainTranslate):
def __init__(self):
super(FrictionsTranslate, self).__init__()
self._dict["kp"] = _translate(
"Frictions", "Kp (m)"
)
self._dict["kp"] = self._dict["unit_kp"]
self._dict["stricklers"] = _translate(
"Frictions", "Stricklers"
)
......@@ -39,8 +37,8 @@ class FrictionsTranslate(PamhyrTranslate):
)
self._sub_dict["table_headers"] = {
# "name": _translate("Frictions", "Name"),
# "edge": _translate("Frictions", "Reach"),
# "name": self._dict["name"],
# "edge": self._dict["reach"],
"begin_kp": _translate("Frictions", "Begin kp (m)"),
"end_kp": _translate("Frictions", "End kp (m)"),
"begin_strickler": _translate("Frictions", "Begin strickler"),
......
......@@ -21,12 +21,6 @@ import logging
from tools import timer
from View.Tools.PamhyrPlot import PamhyrPlot
from PyQt5.QtCore import (
QCoreApplication
)
_translate = QCoreApplication.translate
logger = logging.getLogger()
......@@ -46,20 +40,12 @@ class PlotAC(PamhyrPlot):
self._auto_relim_update = True
self._autoscale_update = True
self.label_x = _translate(
"Geometry", "Transverse abscissa (m)"
)
self.label_y = _translate("Geometry", "Height (m)")
self.label_x = self._trad["transverse_abscissa"]
self.label_y = self._trad["unit_height"]
self.label_previous_plot_selected = _translate(
"Geometry", "Previous cross-section"
)
self.label_plot_selected = _translate(
"Geometry", "Cross-section"
)
self.label_next_plot_selected = _translate(
"Geometry", "Next cross-section"
)
self.label_previous_plot_selected = self._trad["prev_cs"]
self.label_plot_selected = self._trad["cs"]
self.label_next_plot_selected = self._trad["next_cs"]
self.previous_plot_selected = None
self.plot_selected = None
......
......@@ -21,12 +21,6 @@ import logging
from tools import timer
from View.Tools.PamhyrPlot import PamhyrPlot
from PyQt5.QtCore import (
QCoreApplication
)
_translate = QCoreApplication.translate
logger = logging.getLogger()
......@@ -48,8 +42,8 @@ class PlotKPZ(PamhyrPlot):
self.line_kp_zmin_zmax = None
self.line_kp_zmin_zmax_highlight = None
self.label_x = _translate("MainWindow_reach", "Kp (m)")
self.label_y = _translate("MainWindow_reach", "Height (m)")
self.label_x = self._trad["unit_kp"]
self.label_y = self._trad["unit_height"]
self.before_plot_selected = None
self.plot_selected = None
......
......@@ -40,8 +40,8 @@ class PlotXY(PamhyrPlot):
self.line_xy = []
self.line_gl = []
self.label_x = _translate("Geometry", "X (m)")
self.label_y = _translate("Geometry", "Y (m)")
self.label_x = self._trad["x"]
self.label_y = self._trad["y"]
self.before_plot_selected = None
self.plot_selected = None
......
......@@ -47,16 +47,18 @@ class Plot(PamhyrPlot):
self.line_xy = []
self.line_gl = []
self.label_x = self._trad["unit_kp"]
self.label_y = self._trad["unit_height"]
self.before_plot_selected = None
self.plot_selected = None
self.after_plot_selected = None
self._isometric_axis = False
@timer
def draw(self):
self.canvas.axes.cla()
self.canvas.axes.grid(
color='grey', linestyle='--', linewidth=0.5
)
self.init_axes()
x = self.data.get_station()
y = self.data.z()
......@@ -71,19 +73,10 @@ class Plot(PamhyrPlot):
gl = map(lambda p: p.name, self.data.points)
self.profile_line2D, = self.canvas.axes.plot(
x, y, color='r', lw=1.5,
markersize=7, marker='+',
x, y, color=self.color_plot,
lw=1.5, markersize=7, marker='+',
picker=30
)
self.canvas.axes.set_xlabel(
_translate("MainWindowProfile",
"Transverse abscissa (m)"),
color='black', fontsize=10
)
self.canvas.axes.set_ylabel(
_translate("MainWindowProfile", "Height (m)"),
color='black', fontsize=10
)
# Add label on graph
self.annotation = []
......@@ -142,10 +135,8 @@ class Plot(PamhyrPlot):
self.onclick_event.onclick
)
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
self.idle()
@timer
def update(self, ind=None):
logger.info("TODO: implemente update")
def update(self):
self.draw()
......@@ -18,7 +18,7 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
from View.Geometry.Translate import GeometryTranslate
_translate = QCoreApplication.translate
......@@ -33,9 +33,9 @@ class GeometryProfileTranslate(GeometryTranslate):
)
self._sub_dict["table_headers"] = {
"x": _translate("Geometry", "X (m)"),
"y": _translate("Geometry", "Y (m)"),
"z": _translate("Geometry", "Z (m)"),
"name": _translate("Geometry", "Name"),
"x": self._dict["x"],
"y": self._dict["y"],
"z": self._dict["z"],
"name": self._dict["name"],
"abs": _translate("Geometry", "Traversal abs (m)"),
}
......@@ -108,6 +108,7 @@ class ProfileWindow(PamhyrWindow):
self._plot = Plot(
canvas=self._canvas,
data=self._profile,
trad=self._trad,
toolbar=self._toolbar,
table=self.find(QTableView, "tableView")
)
......
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class GeometryTranslate(PamhyrTranslate):
class GeometryTranslate(MainTranslate):
def __init__(self):
super(GeometryTranslate, self).__init__()
......@@ -38,17 +38,28 @@ class GeometryTranslate(PamhyrTranslate):
"Geometry", "File mage meshed geometry (*.M *.m)")
self._dict["file_all"] = _translate("Geometry", "All file (*)")
self._dict["reach"] = _translate("Geometry", "reach")
self._dict["reachs"] = _translate("Geometry", "reachs")
self._dict["cross_section"] = _translate("Geometry", "cross-section")
self._dict["cross_sections"] = _translate("Geometry", "cross-sections")
self._dict["profile"] = _translate("Geometry", "cross-section")
self._dict["profiles"] = _translate("Geometry", "cross-sections")
self._dict["transverse_abscissa"] = _translate(
"Geometry", "Transverse abscissa (m)"
)
self._dict["prev_cs"] = _translate(
"Geometry", "Previous cross-section"
)
self._dict["cs"] = _translate("Geometry", "Cross-section")
self._dict["next_cs"] = _translate("Geometry", "Next cross-section")
self._dict["x"] = _translate("Geometry", "X (m)")
self._dict["y"] = _translate("Geometry", "Y (m)")
self._dict["z"] = _translate("Geometry", "Z (m)")
self._sub_dict["table_headers"] = {
"name": _translate("Geometry", "Name"),
"kp": _translate("Geometry", "KP (m)"),
"name": self._dict["name"],
"kp": self._dict["unit_kp"],
"poins": _translate("Geometry", "Points"),
}
......
......@@ -327,6 +327,7 @@ class GeometryWindow(PamhyrWindow):
self._plot_xy = PlotXY(
canvas=self._canvas_xy,
data=self._reach,
trad=self._trad,
toolbar=self._toolbar_xy
)
self._plot_xy.draw()
......@@ -344,6 +345,7 @@ class GeometryWindow(PamhyrWindow):
self._plot_kpc = PlotKPZ(
canvas=self._canvas_kpc,
data=self._reach,
trad=self._trad,
toolbar=self._toolbar_kpc
)
self._plot_kpc.draw()
......@@ -361,6 +363,7 @@ class GeometryWindow(PamhyrWindow):
self._plot_ac = PlotAC(
canvas=self._canvas_ac,
data=self._reach,
trad=self._trad,
toolbar=self._toolbar_ac,
)
self._plot_ac.draw()
......
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class BasicHydraulicStructuresTranslate(PamhyrTranslate):
class BasicHydraulicStructuresTranslate(MainTranslate):
def __init__(self):
super(BasicHydraulicStructuresTranslate, self).__init__()
......@@ -44,18 +44,10 @@ hydraulic structure values?"
# BHSValues translation
self._dict['width'] = _translate(
"BasicHydraulicStructures", "Width (m)"
)
self._dict['height'] = _translate(
"BasicHydraulicStructures", "Thickness (m)"
)
self._dict['elevation'] = _translate(
"BasicHydraulicStructures", "Elevation (m)"
)
self._dict['diameter'] = _translate(
"BasicHydraulicStructures", "Diameter (m)"
)
self._dict['width'] = self._dict["unit_width"]
self._dict['height'] = self._dict["unit_thickness"]
self._dict['elevation'] = self._dict["unit_elevation"]
self._dict['diameter'] = self._dict["unit_diameter"]
self._dict['discharge_coefficient'] = _translate(
"BasicHydraulicStructures", "Discharge coefficient"
)
......@@ -155,11 +147,11 @@ hydraulic structure values?"
# Tables
self._sub_dict["table_headers"] = {
"name": _translate("BasicHydraulicStructures", "Name"),
"type": _translate("BasicHydraulicStructures", "Type"),
"name": self._dict["name"],
"type": self._dict["type"],
}
self._sub_dict["table_headers_parameters"] = {
"name": _translate("BasicHydraulicStructures", "Name"),
"value": _translate("BasicHydraulicStructures", "Value"),
"name": self._dict["name"],
"value": self._dict["value"],
}
......@@ -20,12 +20,6 @@ from tools import timer
from View.Tools.PamhyrPlot import PamhyrPlot
from matplotlib import pyplot as plt
from PyQt5.QtCore import (
QCoreApplication
)
_translate = QCoreApplication.translate
class PlotAC(PamhyrPlot):
def __init__(self, canvas=None, trad=None, toolbar=None,
......@@ -42,8 +36,8 @@ class PlotAC(PamhyrPlot):
self._current_reach = reach
self._current_profile = profile
self.label_x = _translate("MainWindow_reach", "X (m)")
self.label_y = _translate("MainWindow_reach", "Elevation (m)")
self.label_x = self._trad["x"]
self.label_y = self._trad["unit_elevation"]
self._isometric_axis = False
......
......@@ -43,8 +43,8 @@ class PlotKPC(PamhyrPlot):
self._current_reach = reach
self._current_profile = profile
self.label_x = _translate("MainWindow_reach", "KP (m)")
self.label_y = _translate("MainWindow_reach", "Elevation (m)")
self.label_x = self._trad["unit_kp"]
self.label_y = self._trad["unit_elevation"]
self._isometric_axis = False
......
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class HydraulicStructuresTranslate(PamhyrTranslate):
class HydraulicStructuresTranslate(MainTranslate):
def __init__(self):
super(HydraulicStructuresTranslate, self).__init__()
......@@ -31,8 +31,10 @@ class HydraulicStructuresTranslate(PamhyrTranslate):
"HydraulicStructures", "Hydraulic Structures"
)
self._dict["x"] = _translate("HydraulicStructures", "X (m)")
self._sub_dict["table_headers"] = {
"name": _translate("HydraulicStructures", "Name"),
"reach": _translate("HydraulicStructures", "Reach"),
"kp": _translate("HydraulicStructures", "Kp (m)"),
"name": self._dict["name"],
"reach": self._dict["reach"],
"kp": self._dict["unit_kp"],
}
......@@ -52,8 +52,6 @@ from View.HydraulicStructures.BasicHydraulicStructures.Window import (
BasicHydraulicStructuresWindow
)
_translate = QCoreApplication.translate
logger = logging.getLogger()
......@@ -142,6 +140,7 @@ class HydraulicStructuresWindow(PamhyrWindow):
river=self._study.river,
reach=None,
profile=None,
trad=self._trad,
toolbar=self.toolbar
)
self.plot_kpc.draw()
......@@ -160,6 +159,7 @@ class HydraulicStructuresWindow(PamhyrWindow):
river=self._study.river,
reach=None,
profile=None,
trad=self._trad,
toolbar=self.toolbar_2
)
self.plot_ac.draw()
......
......@@ -18,12 +18,12 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
_translate = QCoreApplication.translate
class ICTranslate(PamhyrTranslate):
class ICTranslate(MainTranslate):
def __init__(self):
super(ICTranslate, self).__init__()
......@@ -34,18 +34,16 @@ class ICTranslate(PamhyrTranslate):
self._dict["Height"] = _translate(
"InitialCondition", "Height")
self._dict["elevation"] = _translate(
"InitialCondition", "Elevation (m)")
self._dict["discharge"] = _translate(
"InitialCondition", "Discharge (m³/s)")
self._dict["kp"] = _translate("InitialCondition", "KP (m)")
self._dict["elevation"] = self._dict["unit_elevation"]
self._dict["discharge"] = self._dict["unit_discharge"]
self._dict["kp"] = self._dict["unit_kp"]
self._sub_dict["table_headers"] = {
# "name": _translate("InitialCondition", "Name"),
"kp": _translate("InitialCondition", "KP (m)"),
"kp": self._dict["unit_kp"],
# "speed": _translate("InitialCondition", "Speed (m/s)"),
"discharge": _translate("InitialCondition", "Discharge (m³/s)"),
"elevation": _translate("InitialCondition", "Elevation (m)"),
"height": _translate("InitialCondition", "Height (m)"),
"discharge": self._dict["unit_discharge"],
"elevation": self._dict["unit_elevation"],
"height": self._dict["unit_height"],
# "comment": _translate("InitialCondition", "Comment"),
}
......@@ -18,7 +18,7 @@
from PyQt5.QtCore import QCoreApplication
from View.Tools.PamhyrTranslate import PamhyrTranslate
from View.Translate import MainTranslate
from View.LateralContribution.translate import LCTranslate
_translate = QCoreApplication.translate
......@@ -34,8 +34,8 @@ class LCETranslate(LCTranslate):
self._sub_dict["table_headers"] = {
"x": _translate("LateralContribution", "X"),
"y": _translate("LateralContribution", "Y"),
"time": _translate("LateralContribution", "Time"),
"date": _translate("LateralContribution", "Date"),
"discharge": _translate("LateralContribution", "Discharge (m³/s)"),
"z": _translate("LateralContribution", "Z (m)")
"time": self._dict["time"],
"date": self._dict["date"],
"discharge": self._dict["unit_discharge"],
"z": self._dict["unit_elevation"],
}
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