diff --git a/src/View/MainWindowTabGraph.py b/src/View/MainWindowTabGraph.py index 41f3401f..048d8328 100644 --- a/src/View/MainWindowTabGraph.py +++ b/src/View/MainWindowTabGraph.py @@ -13,7 +13,8 @@ from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar from View.PlotXY import PlotXY from View.Network.GraphWidget import GraphWidget -from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QWidget, QGroupBox, QLabel, QHBoxLayout, QVBoxLayout class WidgetGraph(QWidget): @@ -28,8 +29,18 @@ class WidgetGraph(QWidget): layout = QHBoxLayout(self) self._graph_widget = None - self._graph_layout = QVBoxLayout() - layout.addLayout(self._graph_layout, 1) + self._graph_group = QGroupBox( + self._trad["graph_network_title"], self + ) + self._graph_layout = QVBoxLayout(self._graph_group) + + self._graph_title = QLabel(self._graph_group) + self._graph_title.setTextFormat(Qt.PlainText) + self._graph_title.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + self._graph_title.setWordWrap(True) + self._graph_layout.addWidget(self._graph_title) + self._update_graph_title() + layout.addWidget(self._graph_group, 1) self.canvas = MplCanvas(width=5, height=4, dpi=100) self.canvas.setObjectName("canvas_graph") @@ -37,10 +48,13 @@ class WidgetGraph(QWidget): self.canvas, self, items=["home", "zoom", "save", "iso", "back/forward", "move"] ) - self._plot_layout = QVBoxLayout() + self._plot_group = QGroupBox( + self._trad["graph_geographic_title"], self + ) + self._plot_layout = QVBoxLayout(self._plot_group) self._plot_layout.addWidget(self.toolbar) - self._plot_layout.addWidget(self.canvas) - layout.addLayout(self._plot_layout, 1) + self._plot_layout.addWidget(self.canvas, 1) + layout.addWidget(self._plot_group, 1) self.plot = PlotXY( canvas=self.canvas, @@ -57,8 +71,15 @@ class WidgetGraph(QWidget): @study.setter def study(self, study): self._study = study + self._update_graph_title() + + def _update_graph_title(self): + self._graph_title.setText( + self._study.name if self._study is not None else "" + ) def update(self): + self._update_graph_title() if (self._graph_widget is not None and (self._study is None or self._graph_widget.graph is not self._study.river)): @@ -73,7 +94,7 @@ class WidgetGraph(QWidget): only_display=True, trad=self._trad, ) - self._graph_layout.addWidget(self._graph_widget) + self._graph_layout.addWidget(self._graph_widget, 1) elif self._graph_widget is not None: self._graph_widget.display_update() diff --git a/src/View/Translate.py b/src/View/Translate.py index fbf0687c..40f8efd8 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -178,6 +178,12 @@ class MainTranslate(UnitTranslate): self._dict["tab_graph_name"] = _translate( "MainWindow", "Graph" ) + self._dict["graph_network_title"] = _translate( + "MainWindow", "Hydrographic network" + ) + self._dict["graph_geographic_title"] = _translate( + "MainWindow", "Geographic view" + ) self._dict["open_debug"] = _translate( "MainWindow", "Open debug window"