mirror of https://gitlab.com/pamhyr/pamhyr2
more pep8
parent
3b8a49d429
commit
a317cd849f
|
|
@ -118,4 +118,3 @@ class TableModel(PamhyrTableModel):
|
|||
)
|
||||
|
||||
self.endRemoveRows()
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ from PyQt5.QtWidgets import (
|
|||
QMessageBox, QUndoCommand, QUndoStack,
|
||||
)
|
||||
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS \
|
||||
import BoundaryConditionAdisTS
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
|
@ -43,15 +44,24 @@ class SetDataCommand(QUndoCommand):
|
|||
|
||||
def undo(self):
|
||||
if self._column == 0:
|
||||
self._data._data[self._index] = (self._old,self._data._data[self._index][1])
|
||||
self._data._data[self._index] = (
|
||||
self._old, self._data._data[self._index][1]
|
||||
)
|
||||
else:
|
||||
self._data._data[self._index] = (self._data._data[self._index][0], self._old)
|
||||
self._data._data[self._index] = (
|
||||
self._data._data[self._index][0], self._old
|
||||
)
|
||||
|
||||
def redo(self):
|
||||
if self._column == 0:
|
||||
self._data._data[self._index] = (self._new,self._data._data[self._index][1])
|
||||
self._data._data[self._index] = (
|
||||
self._new, self._data._data[self._index][1]
|
||||
)
|
||||
else:
|
||||
self._data._data[self._index] = (self._data._data[self._index][0], self._new)
|
||||
self._data._data[self._index] = (
|
||||
self._data._data[self._index][0], self._new
|
||||
)
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, data, index):
|
||||
|
|
@ -66,10 +76,13 @@ class AddCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
if self._new is None:
|
||||
self._new = self._data._data.insert(self._index, (self._data._types[0](0), self._data._types[1](0.0)))
|
||||
self._new = self._data._data.insert(self._index, (
|
||||
self._data._types[0](0), self._data._types[1](0.0)
|
||||
))
|
||||
else:
|
||||
self._data._data.insert(self._index, self._new)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -89,7 +102,3 @@ class DelCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
for row in self._rows:
|
||||
del self._data._data[row]
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Window.py -- Pamhyr
|
||||
# Window.py -- Pamhyr
|
||||
# Copyright (C) 2023-2024 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -52,6 +52,7 @@ _translate = QCoreApplication.translate
|
|||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class EditBoundaryConditionWindow(PamhyrWindow):
|
||||
_pamhyr_ui = "EditBoundaryConditionsAdisTS"
|
||||
_pamhyr_name = "Edit Boundary Conditions AdisTS"
|
||||
|
|
@ -72,7 +73,9 @@ class EditBoundaryConditionWindow(PamhyrWindow):
|
|||
|
||||
if self._data is not None:
|
||||
n = self._data.node
|
||||
node_name = next(filter(lambda x: x.id == n, self._study.river._nodes)).name
|
||||
node_name = next(filter(
|
||||
lambda x: x.id == n, self._study.river._nodes
|
||||
)).name
|
||||
name += (
|
||||
f" - {study.name} " +
|
||||
f"({node_name})"
|
||||
|
|
|
|||
|
|
@ -37,5 +37,6 @@ class BCETranslate(BCTranslate):
|
|||
"time": self._dict["time"],
|
||||
"date": self._dict["date"],
|
||||
"rate": _translate("BoundaryConditionAdisTS", "Rate"),
|
||||
"concentration": _translate("BoundaryConditionAdisTS", "Concentration"),
|
||||
"concentration": _translate("BoundaryConditionAdisTS",
|
||||
"Concentration"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
|
||||
|
||||
class TableModel(PamhyrTableModel):
|
||||
def __init__(self, pollutant=None, bc_list =None, trad=None, **kwargs):
|
||||
def __init__(self, pollutant=None, bc_list=None, trad=None, **kwargs):
|
||||
self._trad = trad
|
||||
self._bc_list = bc_list
|
||||
self._pollutant = pollutant
|
||||
|
|
@ -122,7 +122,7 @@ class TableModel(PamhyrTableModel):
|
|||
def data(self, index, role):
|
||||
if len(self._lst) != 0:
|
||||
data = list(filter(lambda x: x.pollutant == self._pollutant,
|
||||
self._lst))
|
||||
self._lst))
|
||||
else:
|
||||
data = []
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,11 @@ from PyQt5.QtWidgets import (
|
|||
QMessageBox, QUndoCommand, QUndoStack,
|
||||
)
|
||||
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionsAdisTSList import BoundaryConditionsAdisTSList
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS \
|
||||
import BoundaryConditionAdisTS
|
||||
from Model.BoundaryConditionsAdisTS.BoundaryConditionsAdisTSList \
|
||||
import BoundaryConditionsAdisTSList
|
||||
|
||||
|
||||
class SetNodeCommand(QUndoCommand):
|
||||
def __init__(self, bcs, index, node):
|
||||
|
|
@ -41,6 +44,7 @@ class SetNodeCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._bcs[self._index].node = self._new
|
||||
|
||||
|
||||
class SetTypeCommand(QUndoCommand):
|
||||
def __init__(self, bcs, index, _type):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -57,6 +61,7 @@ class SetTypeCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._bcs[self._index].type = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, pollutant, bcs_list, bcs, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -96,4 +101,3 @@ class DelCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
for row in self._rows:
|
||||
del self._bcs[row]
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ from View.BoundaryConditionsAdisTS.Table import (
|
|||
|
||||
from View.Network.GraphWidget import GraphWidget
|
||||
from View.BoundaryConditionsAdisTS.translate import BCAdisTSTranslate
|
||||
from View.BoundaryConditionsAdisTS.Edit.Window import EditBoundaryConditionWindow
|
||||
from View.BoundaryConditionsAdisTS.Edit.Window \
|
||||
import EditBoundaryConditionWindow
|
||||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
|
@ -106,7 +107,7 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
|
|||
"node": self._delegate_node,
|
||||
},
|
||||
trad=self._trad,
|
||||
bc_list = self._study.river.boundary_conditions_adists,
|
||||
bc_list=self._study.river.boundary_conditions_adists,
|
||||
undo=self._undo_stack,
|
||||
pollutant=self._pollutant,
|
||||
data=self._study.river
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from View.Translate import MainTranslate
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class BCAdisTSTranslate(MainTranslate):
|
||||
def __init__(self):
|
||||
super(BCAdisTSTranslate, self).__init__()
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ _translate = QCoreApplication.translate
|
|||
|
||||
|
||||
class ComboBoxDelegate(QItemDelegate):
|
||||
def __init__(self, data=None, ic_spec_lst=None, trad=None, parent=None, mode="reaches"):
|
||||
def __init__(self, data=None, ic_spec_lst=None,
|
||||
trad=None, parent=None, mode="reaches"):
|
||||
super(ComboBoxDelegate, self).__init__(parent)
|
||||
|
||||
self._data = data
|
||||
|
|
@ -61,7 +62,9 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
if self._mode == "rk":
|
||||
reach_id = self._ic_spec_lst[index.row()].reach
|
||||
|
||||
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
|
||||
reach = next(filter(
|
||||
lambda edge: edge.id == reach_id, self._data.edges()
|
||||
))
|
||||
|
||||
if reach_id is not None:
|
||||
val = list(
|
||||
|
|
@ -136,7 +139,9 @@ class D90TableModel(PamhyrTableModel):
|
|||
n = self._lst[row].reach
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
return next(filter(lambda edge: edge.id == n, self._river.edges())).name
|
||||
return next(filter(
|
||||
lambda edge: edge.id == n, self._river.edges()
|
||||
)).name
|
||||
elif self._headers[column] is "start_rk":
|
||||
n = self._lst[row].start_rk
|
||||
if n is None:
|
||||
|
|
@ -173,7 +178,8 @@ class D90TableModel(PamhyrTableModel):
|
|||
print(self._river.edge(value).id)
|
||||
self._undo.push(
|
||||
SetCommandSpec(
|
||||
self._lst, row, self._headers[column], self._river.edge(value).id
|
||||
self._lst, row, self._headers[column],
|
||||
self._river.edge(value).id
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
@ -214,4 +220,3 @@ class D90TableModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ logger = logging.getLogger()
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class D90TableDefaultModel(PamhyrTableModel):
|
||||
def __init__(self, **kwargs):
|
||||
super(D90TableDefaultModel, self).__init__(**kwargs)
|
||||
|
|
@ -92,4 +93,3 @@ class D90TableDefaultModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class SetCommand(QUndoCommand):
|
|||
elif self._column == "d90":
|
||||
self._data[self._row].d90 = self._new
|
||||
|
||||
|
||||
class SetCommandSpec(QUndoCommand):
|
||||
def __init__(self, data, row, column, new_value):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -109,6 +110,7 @@ class SetCommandSpec(QUndoCommand):
|
|||
elif self._column == "d90":
|
||||
self._data[self._row].d90 = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -127,6 +129,7 @@ class AddCommand(QUndoCommand):
|
|||
else:
|
||||
self._data.insert(self._index, self._new)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -134,7 +137,7 @@ class DelCommand(QUndoCommand):
|
|||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._rows = rows
|
||||
#self._data = data
|
||||
# self._data = data
|
||||
|
||||
self._ic = []
|
||||
for row in rows:
|
||||
|
|
@ -147,4 +150,3 @@ class DelCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
self._data.delete_i(self._rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
|
||||
table_default.setModel(self._table)
|
||||
table_default.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
table_default.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
table_default.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
table_default.setAlternatingRowColors(True)
|
||||
|
||||
layout = self.find(QVBoxLayout, f"verticalLayout_1")
|
||||
|
|
@ -165,7 +167,9 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
|
||||
self.table_spec.setModel(self._table_spec)
|
||||
self.table_spec.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
self.table_spec.setAlternatingRowColors(True)
|
||||
|
||||
selectionModel = self.table_spec.selectionModel()
|
||||
|
|
@ -180,7 +184,7 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
self.table_spec.scrollTo(index)
|
||||
|
||||
def index_selected_row(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
rows = table.selectionModel()\
|
||||
.selectedRows()
|
||||
|
|
@ -191,7 +195,7 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
return rows[0].row()
|
||||
|
||||
def index_selected_rows(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
return list(
|
||||
# Delete duplicate
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ _translate = QCoreApplication.translate
|
|||
|
||||
|
||||
class ComboBoxDelegate(QItemDelegate):
|
||||
def __init__(self, data=None, ic_spec_lst=None, trad=None, parent=None, mode="reaches"):
|
||||
def __init__(self, data=None, ic_spec_lst=None,
|
||||
trad=None, parent=None, mode="reaches"):
|
||||
super(ComboBoxDelegate, self).__init__(parent)
|
||||
|
||||
self._data = data
|
||||
|
|
@ -61,7 +62,9 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
if self._mode == "rk":
|
||||
reach_id = self._ic_spec_lst[index.row()].reach
|
||||
|
||||
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
|
||||
reach = next(filter(
|
||||
lambda edge: edge.id == reach_id, self._data.edges()
|
||||
))
|
||||
|
||||
if reach_id is not None:
|
||||
val = list(
|
||||
|
|
@ -138,7 +141,9 @@ class DIFTableModel(PamhyrTableModel):
|
|||
n = self._lst[row].reach
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
return next(filter(lambda edge: edge.id == n, self._river.edges())).name
|
||||
return next(filter(
|
||||
lambda edge: edge.id == n, self._river.edges()
|
||||
)).name
|
||||
elif self._headers[column] is "start_rk":
|
||||
n = self._lst[row].start_rk
|
||||
if n is None:
|
||||
|
|
@ -185,7 +190,10 @@ class DIFTableModel(PamhyrTableModel):
|
|||
print(self._river.edge(value).id)
|
||||
self._undo.push(
|
||||
SetCommandSpec(
|
||||
self._lst, row, self._headers[column], self._river.edge(value).id
|
||||
self._lst,
|
||||
row,
|
||||
self._headers[column],
|
||||
self._river.edge(value).id
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
@ -226,4 +234,3 @@ class DIFTableModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ logger = logging.getLogger()
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class DIFTableDefaultModel(PamhyrTableModel):
|
||||
def __init__(self, **kwargs):
|
||||
super(DIFTableDefaultModel, self).__init__(**kwargs)
|
||||
|
|
@ -105,4 +106,3 @@ class DIFTableDefaultModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class SetCommand(QUndoCommand):
|
|||
elif self._column == "c":
|
||||
self._data[self._row].c = self._new
|
||||
|
||||
|
||||
class SetCommandSpec(QUndoCommand):
|
||||
def __init__(self, data, row, column, new_value):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -133,6 +134,7 @@ class SetCommandSpec(QUndoCommand):
|
|||
elif self._column == "c":
|
||||
self._data[self._row].c = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -151,6 +153,7 @@ class AddCommand(QUndoCommand):
|
|||
else:
|
||||
self._data.insert(self._index, self._new)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -158,7 +161,7 @@ class DelCommand(QUndoCommand):
|
|||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._rows = rows
|
||||
#self._data = data
|
||||
# self._data = data
|
||||
|
||||
self._ic = []
|
||||
for row in rows:
|
||||
|
|
@ -171,4 +174,3 @@ class DelCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
self._data.delete_i(self._rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,9 @@ class DIFAdisTSWindow(PamhyrWindow):
|
|||
|
||||
table_default.setModel(self._table)
|
||||
table_default.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
table_default.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
table_default.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
table_default.setAlternatingRowColors(True)
|
||||
|
||||
layout = self.find(QVBoxLayout, f"verticalLayout_1")
|
||||
|
|
@ -157,7 +159,8 @@ class DIFAdisTSWindow(PamhyrWindow):
|
|||
self._table_spec = DIFTableModel(
|
||||
table_view=self.table_spec,
|
||||
table_headers=self._trad.get_dict("table_headers_spec"),
|
||||
editable_headers=["method", "reach", "start_rk", "end_rk", "dif", "b", "c"],
|
||||
editable_headers=["method", "reach", "start_rk",
|
||||
"end_rk", "dif", "b", "c"],
|
||||
delegates={
|
||||
"method": self._delegate_method,
|
||||
"reach": self._delegate_reach,
|
||||
|
|
@ -172,7 +175,9 @@ class DIFAdisTSWindow(PamhyrWindow):
|
|||
|
||||
self.table_spec.setModel(self._table_spec)
|
||||
self.table_spec.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
self.table_spec.setAlternatingRowColors(True)
|
||||
|
||||
selectionModel = self.table_spec.selectionModel()
|
||||
|
|
@ -187,7 +192,7 @@ class DIFAdisTSWindow(PamhyrWindow):
|
|||
self.table_spec.scrollTo(index)
|
||||
|
||||
def index_selected_row(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
rows = table.selectionModel()\
|
||||
.selectedRows()
|
||||
|
|
@ -198,7 +203,7 @@ class DIFAdisTSWindow(PamhyrWindow):
|
|||
return rows[0].row()
|
||||
|
||||
def index_selected_rows(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
return list(
|
||||
# Delete duplicate
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ class MoveCommand(QUndoCommand):
|
|||
else:
|
||||
self._ics.move_down(self._i)
|
||||
|
||||
|
||||
class InsertCommand(QUndoCommand):
|
||||
def __init__(self, ics, row, ic):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -154,6 +155,7 @@ class InsertCommand(QUndoCommand):
|
|||
for ic in self._ic:
|
||||
self._ics.insert(self._row, ic)
|
||||
|
||||
|
||||
class DuplicateCommand(QUndoCommand):
|
||||
def __init__(self, ics, rows, ic):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ _translate = QCoreApplication.translate
|
|||
|
||||
|
||||
class ComboBoxDelegate(QItemDelegate):
|
||||
def __init__(self, data=None, ic_spec_lst=None, trad=None, parent=None, mode="reaches"):
|
||||
def __init__(self, data=None, ic_spec_lst=None,
|
||||
trad=None, parent=None, mode="reaches"):
|
||||
super(ComboBoxDelegate, self).__init__(parent)
|
||||
|
||||
self._data = data
|
||||
|
|
@ -61,7 +62,8 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
if self._mode == "rk":
|
||||
reach_id = self._ic_spec_lst[index.row()].reach
|
||||
|
||||
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
|
||||
reach = next(filter(lambda edge: edge.id == reach_id,
|
||||
self._data.edges()))
|
||||
|
||||
if reach_id is not None:
|
||||
val = list(
|
||||
|
|
@ -136,7 +138,9 @@ class InitialConditionTableModel(PamhyrTableModel):
|
|||
n = self._lst[row].reach
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
return next(filter(lambda edge: edge.id == n, self._river.edges())).name
|
||||
return next(filter(
|
||||
lambda edge: edge.id == n, self._river.edges()
|
||||
)).name
|
||||
elif self._headers[column] is "start_rk":
|
||||
n = self._lst[row].start_rk
|
||||
if n is None:
|
||||
|
|
@ -193,7 +197,8 @@ class InitialConditionTableModel(PamhyrTableModel):
|
|||
print(self._river.edge(value).id)
|
||||
self._undo.push(
|
||||
SetCommandSpec(
|
||||
self._lst, row, self._headers[column], self._river.edge(value).id
|
||||
self._lst, row, self._headers[column],
|
||||
self._river.edge(value).id
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
@ -234,4 +239,3 @@ class InitialConditionTableModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ logger = logging.getLogger()
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class InitialConditionTableDefaultModel(PamhyrTableModel):
|
||||
def __init__(self, **kwargs):
|
||||
super(InitialConditionTableDefaultModel, self).__init__(**kwargs)
|
||||
|
|
@ -107,4 +108,3 @@ class InitialConditionTableDefaultModel(PamhyrTableModel):
|
|||
def redo(self):
|
||||
self._undo.redo()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ from PyQt5.QtWidgets import (
|
|||
QMessageBox, QUndoCommand, QUndoStack,
|
||||
)
|
||||
|
||||
from Model.InitialConditionsAdisTS.InitialConditionsAdisTS import InitialConditionsAdisTS
|
||||
from Model.InitialConditionsAdisTS.InitialConditionsAdisTSList import InitialConditionsAdisTSList
|
||||
from Model.InitialConditionsAdisTS.InitialConditionsAdisTS \
|
||||
import InitialConditionsAdisTS
|
||||
from Model.InitialConditionsAdisTS.InitialConditionsAdisTSList \
|
||||
import InitialConditionsAdisTSList
|
||||
|
||||
|
||||
class SetCommand(QUndoCommand):
|
||||
|
|
@ -76,6 +78,7 @@ class SetCommand(QUndoCommand):
|
|||
elif self._column == "ed":
|
||||
self._data[self._row].ed = self._new
|
||||
|
||||
|
||||
class SetCommandSpec(QUndoCommand):
|
||||
def __init__(self, data, row, column, new_value):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -151,6 +154,7 @@ class SetCommandSpec(QUndoCommand):
|
|||
elif self._column == "rate":
|
||||
self._data[self._row].rate = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -169,6 +173,7 @@ class AddCommand(QUndoCommand):
|
|||
else:
|
||||
self._data.insert(self._index, self._new)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -176,7 +181,7 @@ class DelCommand(QUndoCommand):
|
|||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._rows = rows
|
||||
#self._data = data
|
||||
# self._data = data
|
||||
|
||||
self._ic = []
|
||||
for row in rows:
|
||||
|
|
@ -189,4 +194,3 @@ class DelCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
self._data.delete_i(self._rows)
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
|||
|
||||
table_default.setModel(self._table)
|
||||
table_default.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
table_default.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
table_default.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
table_default.setAlternatingRowColors(True)
|
||||
|
||||
layout = self.find(QVBoxLayout, f"verticalLayout_1")
|
||||
|
|
@ -151,7 +153,9 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
|||
self._table_spec = InitialConditionTableModel(
|
||||
table_view=self.table_spec,
|
||||
table_headers=self._trad.get_dict("table_headers_spec"),
|
||||
editable_headers=["name", "reach", "start_rk", "end_rk", "concentration", "eg", "em", "ed", "rate"],
|
||||
editable_headers=["name", "reach", "start_rk",
|
||||
"end_rk", "concentration",
|
||||
"eg", "em", "ed", "rate"],
|
||||
delegates={
|
||||
"reach": self._delegate_reach,
|
||||
"start_rk": self._delegate_rk,
|
||||
|
|
@ -165,7 +169,9 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
|||
|
||||
self.table_spec.setModel(self._table_spec)
|
||||
self.table_spec.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
self.table_spec.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Stretch
|
||||
)
|
||||
self.table_spec.setAlternatingRowColors(True)
|
||||
|
||||
selectionModel = self.table_spec.selectionModel()
|
||||
|
|
@ -180,7 +186,7 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
|||
self.table_spec.scrollTo(index)
|
||||
|
||||
def index_selected_row(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
rows = table.selectionModel()\
|
||||
.selectedRows()
|
||||
|
|
@ -191,7 +197,7 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
|||
return rows[0].row()
|
||||
|
||||
def index_selected_rows(self):
|
||||
#table = self.find(QTableView, f"tableView")
|
||||
# table = self.find(QTableView, f"tableView")
|
||||
table = self.table_spec
|
||||
return list(
|
||||
# Delete duplicate
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ _translate = QCoreApplication.translate
|
|||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class Plot(PamhyrPlot):
|
||||
def __init__(self, mode="time", data=None,
|
||||
trad=None, canvas=None, toolbar=None,
|
||||
|
|
|
|||
|
|
@ -120,4 +120,3 @@ class TableModel(PamhyrTableModel):
|
|||
)
|
||||
|
||||
self.endRemoveRows()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ from PyQt5.QtWidgets import (
|
|||
QMessageBox, QUndoCommand, QUndoStack,
|
||||
)
|
||||
|
||||
from Model.LateralContributionsAdisTS.LateralContributionAdisTS import LateralContributionAdisTS
|
||||
from Model.LateralContributionsAdisTS.LateralContributionAdisTS \
|
||||
import LateralContributionAdisTS
|
||||
|
||||
|
||||
class SetDataCommand(QUndoCommand):
|
||||
|
|
@ -39,15 +40,23 @@ class SetDataCommand(QUndoCommand):
|
|||
|
||||
def undo(self):
|
||||
if self._column == 0:
|
||||
self._data._data[self._index] = (self._old, self._data._data[self._index][1])
|
||||
self._data._data[self._index] = (
|
||||
self._old, self._data._data[self._index][1]
|
||||
)
|
||||
else:
|
||||
self._data._data[self._index] = (self._data._data[self._index][0], self._old)
|
||||
self._data._data[self._index] = (
|
||||
self._data._data[self._index][0], self._old
|
||||
)
|
||||
|
||||
def redo(self):
|
||||
if self._column == 0:
|
||||
self._data._data[self._index] = (self._new, self._data._data[self._index][1])
|
||||
self._data._data[self._index] = (
|
||||
self._new, self._data._data[self._index][1]
|
||||
)
|
||||
else:
|
||||
self._data._data[self._index] = (self._data._data[self._index][0], self._new)
|
||||
self._data._data[self._index] = (
|
||||
self._data._data[self._index][0], self._new
|
||||
)
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
|
|
@ -63,10 +72,15 @@ class AddCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
if self._new is None:
|
||||
self._new = self._data._data.insert(self._index, (self._data._types[0](0), self._data._types[1](0.0)))
|
||||
self._new = self._data._data.insert(
|
||||
self._index, (
|
||||
self._data._types[0](0), self._data._types[1](0.0)
|
||||
)
|
||||
)
|
||||
else:
|
||||
self._data._data.insert(self._index, self._new)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ class EditLateralContributionAdisTSWindow(PamhyrWindow):
|
|||
|
||||
if self._data is not None:
|
||||
if self._data.edge is not None:
|
||||
edge_name = next(filter(lambda edge: edge.id == self._data.edge, self._study.river.edges())).name
|
||||
edge_name = next(filter(
|
||||
lambda edge: edge.id == self._data.edge,
|
||||
self._study.river.edges()
|
||||
)).name
|
||||
else:
|
||||
edge_name = trad['not_associated']
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,9 @@ class TableModel(PamhyrTableModel):
|
|||
n = self._lst[row].edge
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
return next(filter(lambda edge: edge.id == n, self._data.edges())).name
|
||||
return next(filter(
|
||||
lambda edge: edge.id == n, self._data.edges()
|
||||
)).name
|
||||
elif self._headers[column] == "begin_rk":
|
||||
return str(self._lst[row].begin_rk)
|
||||
elif self._headers[column] == "end_rk":
|
||||
|
|
@ -155,7 +157,9 @@ class TableModel(PamhyrTableModel):
|
|||
if self._headers[column] == "edge":
|
||||
self._undo.push(
|
||||
SetEdgeCommand(
|
||||
self._lcs_list, self._lst, row, self._data.edge(value).id
|
||||
self._lcs_list, self._lst,
|
||||
row,
|
||||
self._data.edge(value).id
|
||||
)
|
||||
)
|
||||
elif self._headers[column] == "begin_rk":
|
||||
|
|
@ -200,7 +204,3 @@ class TableModel(PamhyrTableModel):
|
|||
|
||||
self.endRemoveRows()
|
||||
self.layoutChanged.emit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@ from PyQt5.QtWidgets import (
|
|||
QMessageBox, QUndoCommand, QUndoStack,
|
||||
)
|
||||
|
||||
from Model.LateralContributionsAdisTS.LateralContributionAdisTS import LateralContributionAdisTS
|
||||
from Model.LateralContributionsAdisTS.LateralContributionsAdisTSList import (
|
||||
LateralContributionsAdisTSList
|
||||
)
|
||||
from Model.LateralContributionsAdisTS.LateralContributionAdisTS \
|
||||
import LateralContributionAdisTS
|
||||
from Model.LateralContributionsAdisTS.LateralContributionsAdisTSList \
|
||||
import LateralContributionsAdisTSList
|
||||
|
||||
|
||||
class SetBeginCommand(QUndoCommand):
|
||||
def __init__(self, lcs, lcs_lst, index, new_value):
|
||||
|
|
@ -78,6 +79,7 @@ class SetEdgeCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._lcs_lst[self._index].edge = self._new
|
||||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, pollutant, lcs, lcs_lst, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -117,4 +119,3 @@ class DelCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
for row in self._rows:
|
||||
del self._lcs[row]
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ from View.LateralContributionsAdisTS.Table import (
|
|||
|
||||
from View.Tools.Plot.PamhyrCanvas import MplCanvas
|
||||
from View.Geometry.PlotXY import PlotXY
|
||||
from View.LateralContributionsAdisTS.translate import (
|
||||
LCTranslate,
|
||||
)
|
||||
from View.LateralContributionsAdisTS.Edit.Window import EditLateralContributionAdisTSWindow
|
||||
from View.LateralContributionsAdisTS.translate \
|
||||
import LCTranslate
|
||||
from View.LateralContributionsAdisTS.Edit.Window \
|
||||
import EditLateralContributionAdisTSWindow
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
|
@ -138,12 +138,11 @@ class LateralContributionAdisTSWindow(PamhyrWindow):
|
|||
self.find(QAction, "action_edit").triggered.connect(self.edit)
|
||||
|
||||
table = self.find(QTableView, f"tableView")
|
||||
table.selectionModel()\
|
||||
.selectionChanged\
|
||||
.connect(self._set_current_reach)
|
||||
table.selectionModel().selectionChanged.connect(
|
||||
self._set_current_reach
|
||||
)
|
||||
|
||||
self._table.dataChanged\
|
||||
.connect(self._set_current_reach)
|
||||
self._table.dataChanged.connect(self._set_current_reach)
|
||||
|
||||
def index_selected_row(self):
|
||||
table = self.find(QTableView, f"tableView")
|
||||
|
|
@ -177,7 +176,8 @@ class LateralContributionAdisTSWindow(PamhyrWindow):
|
|||
.edge
|
||||
|
||||
if edge_id:
|
||||
edge = next(filter(lambda e: e.id == edge_id, self._study.river.edges()))
|
||||
edge = next(filter(lambda e: e.id == edge_id,
|
||||
self._study.river.edges()))
|
||||
data = edge.reach
|
||||
lc = self._lcs.lst[rows[0]]
|
||||
highlight = (lc.begin_rk, lc.end_rk)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from View.Translate import MainTranslate
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class LCTranslate(MainTranslate):
|
||||
def __init__(self):
|
||||
super(LCTranslate, self).__init__()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,10 @@ from View.AdditionalFiles.Window import AddFileListWindow
|
|||
from View.REPLines.Window import REPLineListWindow
|
||||
from View.SolverParameters.Window import SolverParametersWindow
|
||||
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
|
||||
from View.RunSolver.WindowAdisTS import SelectSolverWindowAdisTS, SolverLogWindowAdisTS
|
||||
from View.RunSolver.WindowAdisTS import (
|
||||
SelectSolverWindowAdisTS,
|
||||
SolverLogWindowAdisTS
|
||||
)
|
||||
from View.CheckList.Window import CheckListWindow
|
||||
from View.CheckList.WindowAdisTS import CheckListWindowAdisTS
|
||||
from View.Results.Window import ResultsWindow
|
||||
|
|
@ -247,7 +250,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
"action_menu_dif": self.open_dif,
|
||||
"action_menu_d90": self.open_d90,
|
||||
"action_menu_pollutants": self.open_pollutants,
|
||||
"action_menu_run_adists":self.select_run_solver_adists,
|
||||
"action_menu_run_adists": self.select_run_solver_adists,
|
||||
"action_menu_output_rk": self.open_output_rk_adists,
|
||||
"action_menu_config": self.open_configure,
|
||||
"action_menu_new": self.open_new_study,
|
||||
|
|
@ -1296,10 +1299,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
if self._study is None:
|
||||
return
|
||||
|
||||
#solver = next(filter(lambda x: x._type == "adistswc", self.conf.solvers))
|
||||
#solver = next(filter(lambda x: x.name == "AdisTS-WC", self.conf.solvers))
|
||||
#print(solver._type)
|
||||
#self.run_solver(solver)
|
||||
# solver = next(filter(lambda x: x._type == "adistswc",
|
||||
# self.conf.solvers))
|
||||
# solver = next(filter(lambda x: x.name == "AdisTS-WC",
|
||||
# self.conf.solvers))
|
||||
# print(solver._type)
|
||||
# self.run_solver(solver)
|
||||
|
||||
run = SelectSolverWindowAdisTS(
|
||||
study=self._study,
|
||||
|
|
@ -1549,7 +1554,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
options |= QFileDialog.DontUseNativeDialog
|
||||
|
||||
dialog = QFileDialog(self, options=options)
|
||||
dialog.setFileMode(QFileDialog.DirectoryOnly) ##QFileDialog.FileMode.ExistingFile)
|
||||
dialog.setFileMode(QFileDialog.DirectoryOnly)
|
||||
# QFileDialog.FileMode.ExistingFile)
|
||||
|
||||
if self._last_solver is None:
|
||||
dialog.setDirectory(
|
||||
|
|
@ -1567,10 +1573,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
||||
solver_name = dir_path.split("/")[-2]
|
||||
print("dir solver name path:", solver_name)
|
||||
solver_results = next(filter(lambda x: x.name == solver_name, self.conf.solvers))
|
||||
solver_results = next(filter(lambda x: x.name == solver_name,
|
||||
self.conf.solvers))
|
||||
print("solver type:", solver_results._type)
|
||||
print("dir path bis:", dir_path)
|
||||
solver_results_adists = solver_results.results(self._study, repertory=dir_path[:-10], qlog=None)#self._output)
|
||||
solver_results_adists = solver_results.results(
|
||||
self._study,
|
||||
repertory=dir_path[:-10], qlog=None) # self._output)
|
||||
print("results adists", solver_results_adists)
|
||||
logger.info(f"Select results: {dir_path}")
|
||||
if len(bin_list) >= 2 and ("total_sediment.bin" in bin_list):
|
||||
|
|
@ -1581,7 +1590,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
else:
|
||||
dlg = QDialog(self)
|
||||
dlg.setWindowTitle("AdisTS Results")
|
||||
layout = QVBoxLayout()
|
||||
layout = QVBoxLayout()
|
||||
message = QLabel("AdisTS Results not found")
|
||||
layout.addWidget(message)
|
||||
dlg.setLayout(layout)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
.get(index.row()) \
|
||||
.reach
|
||||
|
||||
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
|
||||
reach = next(filter(
|
||||
lambda edge: edge.id == reach_id, self._data.edges()
|
||||
))
|
||||
|
||||
if reach_id is not None:
|
||||
val = list(
|
||||
|
|
@ -130,7 +132,9 @@ class TableModel(PamhyrTableModel):
|
|||
n = self._lst.get(row).reach
|
||||
if n is None:
|
||||
return self._trad['not_associated']
|
||||
return next(filter(lambda edge: edge.id == n, self._data.edges())).name
|
||||
return next(filter(
|
||||
lambda edge: edge.id == n, self._data.edges())
|
||||
).name
|
||||
elif self._headers[column] == "rk":
|
||||
n = self._lst.get(row).rk
|
||||
if n is None:
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class SetDataCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._data.data[self._index][self._column] = self._new
|
||||
|
||||
|
||||
class PasteCommand(QUndoCommand):
|
||||
def __init__(self, data, row, hs):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ logger = logging.getLogger()
|
|||
|
||||
_translate = QCoreApplication.translate
|
||||
|
||||
|
||||
class TableModel(PamhyrTableModel):
|
||||
def _setup_lst(self):
|
||||
self._lst = self._data._Pollutants
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class SetNameCommand(QUndoCommand):
|
|||
def redo(self):
|
||||
self._pollutants_lst.get(self._index).name = self._new
|
||||
|
||||
|
||||
class SetEnabledCommand(QUndoCommand):
|
||||
def __init__(self, pollutants_lst, index, enabled):
|
||||
QUndoCommand.__init__(self)
|
||||
|
|
@ -76,7 +77,9 @@ class AddCommand(QUndoCommand):
|
|||
|
||||
def redo(self):
|
||||
if self._new is None:
|
||||
self._new = self._pollutants_lst.new(self._pollutants_lst, self._index)
|
||||
self._new = self._pollutants_lst.new(
|
||||
self._pollutants_lst, self._index
|
||||
)
|
||||
self._new._data = [[0, 0., 0., 0., 0., 0., 0., 0., 0.]]
|
||||
self._new_ic_adists = self._data.new(self._index, self._new.id)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ from View.Pollutants.Edit.Window import EditPolluantWindow
|
|||
|
||||
from View.InitialConditionsAdisTS.Window import InitialConditionsAdisTSWindow
|
||||
from View.BoundaryConditionsAdisTS.Window import BoundaryConditionAdisTSWindow
|
||||
from View.LateralContributionsAdisTS.Window import LateralContributionAdisTSWindow
|
||||
from View.LateralContributionsAdisTS.Window \
|
||||
import LateralContributionAdisTSWindow
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
|
@ -106,9 +107,12 @@ class PollutantsWindow(PamhyrWindow):
|
|||
self.find(QAction, "action_add").triggered.connect(self.add)
|
||||
self.find(QAction, "action_delete").triggered.connect(self.delete)
|
||||
self.find(QAction, "action_edit").triggered.connect(self.edit)
|
||||
self.find(QAction, "action_initial_conditions").triggered.connect(self.initial_conditions)
|
||||
self.find(QAction, "action_boundary_conditions").triggered.connect(self.boundary_conditions)
|
||||
self.find(QAction, "action_lateral_contributions").triggered.connect(self.lateral_contrib)
|
||||
self.find(QAction, "action_initial_conditions"
|
||||
).triggered.connect(self.initial_conditions)
|
||||
self.find(QAction, "action_boundary_conditions"
|
||||
).triggered.connect(self.boundary_conditions)
|
||||
self.find(QAction, "action_lateral_contributions"
|
||||
).triggered.connect(self.lateral_contrib)
|
||||
self._checkbox.clicked.connect(self._set_structure_state)
|
||||
|
||||
table = self.find(QTableView, "tableView")
|
||||
|
|
@ -231,7 +235,9 @@ class PollutantsWindow(PamhyrWindow):
|
|||
)
|
||||
return
|
||||
|
||||
bound = BoundaryConditionAdisTSWindow(study=self._study, pollutant=pollutant_id, parent=self)
|
||||
bound = BoundaryConditionAdisTSWindow(
|
||||
study=self._study, pollutant=pollutant_id, parent=self
|
||||
)
|
||||
bound.show()
|
||||
|
||||
def lateral_contrib(self):
|
||||
|
|
@ -274,6 +280,3 @@ class PollutantsWindow(PamhyrWindow):
|
|||
|
||||
def update(self):
|
||||
self._set_checkbox_state()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,9 +79,11 @@ class SelectSolverWindow(PamhyrDialog):
|
|||
self.select_last_solver()
|
||||
|
||||
def setup_combobox(self):
|
||||
#solvers = self._config.solvers
|
||||
#solvers mage
|
||||
solvers = list(filter(lambda x: "adists" not in x._type, self._config.solvers))
|
||||
# solvers = self._config.solvers
|
||||
# solvers mage
|
||||
solvers = list(filter(
|
||||
lambda x: "adists" not in x._type, self._config.solvers
|
||||
))
|
||||
solvers_name = list(
|
||||
map(
|
||||
self._format_solver_name,
|
||||
|
|
|
|||
|
|
@ -79,9 +79,11 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
|
|||
self.select_last_solver()
|
||||
|
||||
def setup_combobox(self):
|
||||
#solvers = self._config.solvers
|
||||
#solvers mage
|
||||
solvers = list(filter(lambda x: "mage" not in x._type, self._config.solvers))
|
||||
# solvers = self._config.solvers
|
||||
# solvers mage
|
||||
solvers = list(filter(
|
||||
lambda x: "mage" not in x._type, self._config.solvers
|
||||
))
|
||||
solvers_name = list(
|
||||
map(
|
||||
self._format_solver_name,
|
||||
|
|
@ -89,7 +91,9 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
|
|||
)
|
||||
)
|
||||
|
||||
solvers_mage = list(filter(lambda x: "mage" in x._type.lower(), self._config.solvers))
|
||||
solvers_mage = list(filter(
|
||||
lambda x: "mage" in x._type.lower(), self._config.solvers
|
||||
))
|
||||
solvers_mage_names = list(map(lambda x: x._name, solvers_mage))
|
||||
|
||||
solvers_dir = os.path.join(
|
||||
|
|
@ -100,14 +104,16 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
|
|||
|
||||
dir_solvers_List = os.listdir(solvers_dir)
|
||||
|
||||
display_mage_names = list(filter(lambda x: x in solvers_mage_names, dir_solvers_List))
|
||||
display_mage_names = list(filter(
|
||||
lambda x: x in solvers_mage_names, dir_solvers_List
|
||||
))
|
||||
|
||||
self.combobox_add_items("comboBox", solvers_name)
|
||||
self.combobox_add_items("comboBoxRepMage", display_mage_names)
|
||||
|
||||
def setup_connections(self):
|
||||
self.find(QPushButton, "pushButton_run").clicked.connect(self.accept)
|
||||
self.find(QPushButton, "pushButton_cancel")\
|
||||
self.find(QPushButton, "pushButton_cancel") \
|
||||
.clicked.connect(self.reject)
|
||||
|
||||
def select_last_solver(self):
|
||||
|
|
@ -155,6 +161,7 @@ class SelectSolverWindowAdisTS(PamhyrDialog):
|
|||
|
||||
super(SelectSolverWindowAdisTS, self).accept()
|
||||
|
||||
|
||||
class SolverLogWindowAdisTS(PamhyrWindow):
|
||||
_pamhyr_ui = "SolverLogAdisTS"
|
||||
_pamhyr_name = "Solver Log"
|
||||
|
|
@ -210,7 +217,9 @@ class SolverLogWindowAdisTS(PamhyrWindow):
|
|||
self.find(QAction, "action_stop").triggered.connect(self.stop)
|
||||
self.find(QAction, "action_log_file").triggered.connect(self.log_file)
|
||||
self.find(QAction, "action_results").triggered.connect(self.results)
|
||||
self.find(QAction, "action_results_Mage").triggered.connect(self.resultsMage)
|
||||
self.find(QAction, "action_results_Mage").triggered.connect(
|
||||
self.resultsMage
|
||||
)
|
||||
|
||||
self._alarm.timeout.connect(self.update)
|
||||
|
||||
|
|
@ -240,7 +249,9 @@ class SolverLogWindowAdisTS(PamhyrWindow):
|
|||
|
||||
def export(self):
|
||||
self._log(f" *** Export study {self._solver.name}", color="blue")
|
||||
ok = self._solver.export(self._study, self._workdir, self._mage_rep, qlog=self._output)
|
||||
ok = self._solver.export(
|
||||
self._study, self._workdir, self._mage_rep, qlog=self._output
|
||||
)
|
||||
self.update()
|
||||
|
||||
return ok
|
||||
|
|
@ -418,13 +429,16 @@ class SolverLogWindowAdisTS(PamhyrWindow):
|
|||
|
||||
def resultsMage(self):
|
||||
if self._results_mage is None:
|
||||
mage_solver = next(filter(lambda x: x._name == self._mage_rep, self._config.solvers))
|
||||
mage_solver = next(filter(
|
||||
lambda x: x._name == self._mage_rep, self._config.solvers
|
||||
))
|
||||
workdir_mage = os.path.join(
|
||||
os.path.dirname(self._study.filename),
|
||||
"_PAMHYR_",
|
||||
self._study.name.replace(" ", "_"),
|
||||
mage_solver.name.replace(" ", "_"),
|
||||
)
|
||||
|
||||
def reading_fn():
|
||||
self._results_mage = mage_solver.results(
|
||||
self._study, workdir_mage, qlog=self._output
|
||||
|
|
@ -448,4 +462,3 @@ class SolverLogWindowAdisTS(PamhyrWindow):
|
|||
parent=self,
|
||||
)
|
||||
log.show()
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,9 @@ class UnitTranslate(CommonWordTranslate):
|
|||
self._dict["unit_ac"] = _translate("Unit", "AC")
|
||||
self._dict["unit_bc"] = _translate("Unit", "BC")
|
||||
|
||||
self._dict["unit_concentration"] = _translate("Unit", "Concentration (g/l)")
|
||||
self._dict["unit_concentration"] = _translate(
|
||||
"Unit", "Concentration (g/l)"
|
||||
)
|
||||
self._dict["unit_wet_area"] = _translate("Unit", "Wet Area (m²)")
|
||||
self._dict["unit_wet_perimeter"] = _translate(
|
||||
"Unit", "Wet Perimeter (m)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue