mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
HS: Fix pep8 and minor change.
This commit is contained in:
1 parent
3ef4b40558
commit
ccb55ff4e1
5 files changed
+25
-24
No files matched your search
@@ -45,7 +45,9 @@ from View.HydraulicStructures.BasicHydraulicStructures.Table import (
|
||||
)
|
||||
|
||||
from View.Network.GraphWidget import GraphWidget
|
||||
from View.HydraulicStructures.BasicHydraulicStructures.Translate import BasicHydraulicStructuresTranslate
|
||||
from View.HydraulicStructures.BasicHydraulicStructures.Translate import (
|
||||
BasicHydraulicStructuresTranslate
|
||||
)
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
@@ -150,25 +152,25 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
table = self.find(QTableView, "tableView")
|
||||
table.selectionModel()\
|
||||
.selectionChanged\
|
||||
.connect(self.update)
|
||||
.selectionChanged\
|
||||
.connect(self.update)
|
||||
|
||||
self._table.layoutChanged.connect(self.update)
|
||||
|
||||
def index_selected(self):
|
||||
table = self.find(QTableView, "tableView")
|
||||
r = table.selectionModel()\
|
||||
.selectedRows()
|
||||
if len(r)>0:
|
||||
r = table.selectionModel().selectedRows()
|
||||
|
||||
if len(r) > 0:
|
||||
return r[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
def index_selected_row(self):
|
||||
table = self.find(QTableView, "tableView")
|
||||
r = table.selectionModel()\
|
||||
.selectedRows()
|
||||
if len(r)>0:
|
||||
r = table.selectionModel().selectedRows()
|
||||
|
||||
if len(r) > 0:
|
||||
return r[0].row()
|
||||
else:
|
||||
return None
|
||||
@@ -187,6 +189,7 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def add(self):
|
||||
rows = self.index_selected_rows()
|
||||
|
||||
if len(self._hs) == 0 or len(rows) == 0:
|
||||
self._table.add(0)
|
||||
else:
|
||||
@@ -194,6 +197,7 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def delete(self):
|
||||
rows = self.index_selected_rows()
|
||||
|
||||
if len(rows) == 0:
|
||||
return
|
||||
|
||||
@@ -213,6 +217,7 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def _set_checkbox_state(self):
|
||||
row = self.index_selected_row()
|
||||
|
||||
if row is None:
|
||||
self._checkbox.setEnabled(False)
|
||||
self._checkbox.setChecked(True)
|
||||
@@ -222,6 +227,7 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def _set_basic_structure_state(self):
|
||||
row = self.index_selected_row()
|
||||
|
||||
if row is not None:
|
||||
self._table.enabled(
|
||||
row,
|
||||
@@ -230,7 +236,3 @@ class BasicHydraulicStructuresWindow(PamhyrWindow):
|
||||
|
||||
def update(self):
|
||||
self._set_checkbox_state()
|
||||
self._update_clear_plot()
|
||||
|
||||
def _update_clear_plot(self):
|
||||
rows = self.index_selected_rows()
|
||||
Reference in new issue
Block a user