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

Section: Improve title.

Showing with 16 additions and 9 deletions
+16 -9
...@@ -38,14 +38,14 @@ _translate = QCoreApplication.translate ...@@ -38,14 +38,14 @@ _translate = QCoreApplication.translate
class SectionsWindow(ASubMainWindow, ListedSubWindow): class SectionsWindow(ASubMainWindow, ListedSubWindow):
def __init__(self, title="Sections", study=None, parent=None): def __init__(self, title="Sections", study=None, parent=None):
title = title + " - " + study.name
self._study = study self._study = study
self._current_reach = self._study.river._current_reach self._reach = self._study.river._current_reach
self._sections = self._current_reach.sections self._sections = self._reach.sections
self.setup_title(title)
super(SectionsWindow, self).__init__( super(SectionsWindow, self).__init__(
name=title, ui="Sections", parent=parent name=self._title, ui="Sections", parent=parent
) )
self.setup_sc() self.setup_sc()
...@@ -53,7 +53,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): ...@@ -53,7 +53,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow):
self.setup_graph() self.setup_graph()
self.setup_connections() 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): def setup_sc(self):
self._undo_stack = QUndoStack() self._undo_stack = QUndoStack()
...@@ -68,14 +75,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): ...@@ -68,14 +75,14 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow):
table = self.find(QTableView, f"tableView") table = self.find(QTableView, f"tableView")
self._table = TableModel( self._table = TableModel(
data = self._current_reach, data = self._reach,
study = self._study, study = self._study,
undo = self._undo_stack, undo = self._undo_stack,
) )
table.setModel(self._table) table.setModel(self._table)
self._delegate_stricklers = ComboBoxDelegate( self._delegate_stricklers = ComboBoxDelegate(
data = self._current_reach, data = self._reach,
study = self._study, study = self._study,
mode = "stricklers", mode = "stricklers",
parent=self parent=self
...@@ -142,7 +149,7 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow): ...@@ -142,7 +149,7 @@ class SectionsWindow(ASubMainWindow, ListedSubWindow):
highlight = None highlight = None
if len(rows) > 0: if len(rows) > 0:
edge = self._current_reach edge = self._reach
if edge: if edge:
data = edge.reach data = edge.reach
sec = self._sections.get(rows[0]) sec = self._sections.get(rows[0])
......
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