From f4fe03b1f1b39816df95b0e78d3b1d253543d02c Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Wed, 7 Jun 2023 11:34:55 +0200 Subject: [PATCH] Section: Improve title. --- src/View/Sections/Window.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/View/Sections/Window.py b/src/View/Sections/Window.py index 47c64880..979b3c1a 100644 --- a/src/View/Sections/Window.py +++ b/src/View/Sections/Window.py @@ -38,14 +38,14 @@ _translate = QCoreApplication.translate class SectionsWindow(ASubMainWindow, ListedSubWindow): def __init__(self, title="Sections", study=None, parent=None): - title = title + " - " + study.name - self._study = study - self._current_reach = self._study.river._current_reach - self._sections = self._current_reach.sections + self._reach = self._study.river._current_reach + self._sections = self._reach.sections + + self.setup_title(title) super(SectionsWindow, self).__init__( - name=title, ui="Sections", parent=parent + name=self._title, ui="Sections", parent=parent ) self.setup_sc() @@ -53,7 +53,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): self.setup_graph() self.setup_connections() - self.ui.setWindowTitle(title) + self.ui.setWindowTitle(self._title) + + def setup_title(self, title): + self._title = ( + title + " - " + + self._study.name + " - " + + self._reach.name + ) def setup_sc(self): self._undo_stack = QUndoStack() @@ -68,14 +75,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): table = self.find(QTableView, f"tableView") self._table = TableModel( - data = self._current_reach, + data = self._reach, study = self._study, undo = self._undo_stack, ) table.setModel(self._table) self._delegate_stricklers = ComboBoxDelegate( - data = self._current_reach, + data = self._reach, study = self._study, mode = "stricklers", parent=self @@ -142,7 +149,7 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): highlight = None if len(rows) > 0: - edge = self._current_reach + edge = self._reach if edge: data = edge.reach sec = self._sections.get(rows[0]) -- GitLab