mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "7a91969f410c9e192412541dfcba7980676ac746" and "a8f95e23861a6ad7f9db96dea5d868771ff56030" have entirely different histories.
7a91969f41
...
a8f95e2386
|
|
@ -46,21 +46,21 @@ _translate = QCoreApplication.translate
|
||||||
|
|
||||||
|
|
||||||
class ComboBoxDelegate(QItemDelegate):
|
class ComboBoxDelegate(QItemDelegate):
|
||||||
def __init__(self, data=None, d90_spec_lst=None,
|
def __init__(self, data=None, ic_spec_lst=None,
|
||||||
trad=None, parent=None, mode="reaches"):
|
trad=None, parent=None, mode="reaches"):
|
||||||
super(ComboBoxDelegate, self).__init__(parent)
|
super(ComboBoxDelegate, self).__init__(parent)
|
||||||
|
|
||||||
self._data = data
|
self._data = data
|
||||||
self._mode = mode
|
self._mode = mode
|
||||||
self._trad = trad
|
self._trad = trad
|
||||||
self._d90_spec_lst = d90_spec_lst
|
self._ic_spec_lst = ic_spec_lst
|
||||||
|
|
||||||
def createEditor(self, parent, option, index):
|
def createEditor(self, parent, option, index):
|
||||||
self.editor = QComboBox(parent)
|
self.editor = QComboBox(parent)
|
||||||
|
|
||||||
val = []
|
val = []
|
||||||
if self._mode == "rk":
|
if self._mode == "rk":
|
||||||
reach_id = self._d90_spec_lst[index.row()].reach
|
reach_id = self._ic_spec_lst[index.row()].reach
|
||||||
|
|
||||||
reach = next(filter(
|
reach = next(filter(
|
||||||
lambda edge: edge.id == reach_id, self._data.edges()
|
lambda edge: edge.id == reach_id, self._data.edges()
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,11 @@ class SetCommandSpec(QUndoCommand):
|
||||||
|
|
||||||
|
|
||||||
class AddCommand(QUndoCommand):
|
class AddCommand(QUndoCommand):
|
||||||
def __init__(self, data, d90_spec, index):
|
def __init__(self, data, ics_spec, index):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._data = data
|
self._data = data
|
||||||
self._d90_spec = d90_spec
|
self._ics_spec = ics_spec
|
||||||
self._index = index
|
self._index = index
|
||||||
self._new = None
|
self._new = None
|
||||||
|
|
||||||
|
|
@ -131,20 +131,21 @@ class AddCommand(QUndoCommand):
|
||||||
|
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
def __init__(self, data, d90_spec, rows):
|
def __init__(self, data, ics_spec, rows):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._data = data
|
self._data = data
|
||||||
self._d90_spec = d90_spec
|
self._ics_spec = ics_spec
|
||||||
self._rows = rows
|
self._rows = rows
|
||||||
|
# self._data = data
|
||||||
|
|
||||||
self._d90 = []
|
self._ic = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self._d90.append((row, self._d90_spec[row]))
|
self._ic.append((row, self._ics_spec[row]))
|
||||||
self._d90.sort()
|
self._ic.sort()
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
for row, el in self._d90:
|
for row, el in self._ic:
|
||||||
self._data.insert(row, el)
|
self._data.insert(row, el)
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
|
|
|
||||||
|
|
@ -138,14 +138,14 @@ class D90AdisTSWindow(PamhyrWindow):
|
||||||
self._delegate_reach = ComboBoxDelegate(
|
self._delegate_reach = ComboBoxDelegate(
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
data=self._study.river,
|
data=self._study.river,
|
||||||
d90_spec_lst=self._data[0]._data,
|
ic_spec_lst=self._data[0]._data,
|
||||||
parent=self,
|
parent=self,
|
||||||
mode="reaches"
|
mode="reaches"
|
||||||
)
|
)
|
||||||
self._delegate_rk = ComboBoxDelegate(
|
self._delegate_rk = ComboBoxDelegate(
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
data=self._study.river,
|
data=self._study.river,
|
||||||
d90_spec_lst=self._data[0]._data,
|
ic_spec_lst=self._data[0]._data,
|
||||||
parent=self,
|
parent=self,
|
||||||
mode="rk"
|
mode="rk"
|
||||||
)
|
)
|
||||||
|
|
@ -227,15 +227,15 @@ class D90AdisTSWindow(PamhyrWindow):
|
||||||
|
|
||||||
table = list(
|
table = list(
|
||||||
map(
|
map(
|
||||||
lambda ed90: list(
|
lambda eic: list(
|
||||||
map(
|
map(
|
||||||
lambda k: ed90[1][k],
|
lambda k: eic[1][k],
|
||||||
["rk", "discharge", "elevation"]
|
["rk", "discharge", "elevation"]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
filter(
|
filter(
|
||||||
lambda ed90: ed90[0] in rows,
|
lambda eic: eic[0] in rows,
|
||||||
enumerate(self._d90.lst())
|
enumerate(self._ics.lst())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -951,13 +951,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
elif res == QMessageBox.Cancel:
|
elif res == QMessageBox.Cancel:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def msg_results_warning(self, text="", info=""):
|
|
||||||
self.message_box(
|
|
||||||
window_title=self._trad["Warning"],
|
|
||||||
text=text,
|
|
||||||
informative_text=info
|
|
||||||
)
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# SUB WINDOWS MENU LIST #
|
# SUB WINDOWS MENU LIST #
|
||||||
#########################
|
#########################
|
||||||
|
|
@ -2040,22 +2033,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
|
|
||||||
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
bin_list = list(filter(lambda s: "bin" in s, dir_list))
|
||||||
if len(bin_list) < 1:
|
if len(bin_list) < 1:
|
||||||
self.msg_results_warning(
|
# TODO message
|
||||||
info=self._trad["mb_results_not_found"],
|
|
||||||
text=self._trad["mb_results_bin_not_found"]
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
path = os.path.normpath(dir_path)
|
path = os.path.normpath(dir_path)
|
||||||
solver_name = path.split(os.sep)[-2]
|
solver_name = path.split(os.sep)[-2]
|
||||||
solver_results = next(filter(lambda x: x.name == solver_name,
|
solver_results = next(filter(lambda x: x.name == solver_name,
|
||||||
self.conf.solvers), None)
|
self.conf.solvers))
|
||||||
if solver_results is None:
|
|
||||||
self.msg_results_warning(
|
|
||||||
info=self._trad["mb_results_not_found"],
|
|
||||||
text=self._trad["mb_results_folder_not_found"]
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
solver_results_adists = solver_results.results(
|
solver_results_adists = solver_results.results(
|
||||||
self._study,
|
self._study,
|
||||||
repertory=dir_path, qlog=None) # self._output)
|
repertory=dir_path, qlog=None) # self._output)
|
||||||
|
|
@ -2067,10 +2050,13 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
results=solver_results_adists,
|
results=solver_results_adists,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.msg_results_warning(
|
dlg = QDialog(self)
|
||||||
info=self._trad["mb_results_not_found"],
|
dlg.setWindowTitle("AdisTS Results")
|
||||||
text=self._trad["mb_results_bin_not_found"]
|
layout = QVBoxLayout()
|
||||||
)
|
message = QLabel("AdisTS Results not found")
|
||||||
|
layout.addWidget(message)
|
||||||
|
dlg.setLayout(layout)
|
||||||
|
dlg.exec()
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# DOCUMENTATION #
|
# DOCUMENTATION #
|
||||||
|
|
@ -2114,7 +2100,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
|
|
||||||
def open_doc_user(self):
|
def open_doc_user(self):
|
||||||
self.open_doc(
|
self.open_doc(
|
||||||
"https://gitlab.com/pamhyr/pamhyr2/-/wikis/home"
|
"https://gitlab.irstea.fr/theophile.terraz/pamhyr/-/wikis/home"
|
||||||
)
|
)
|
||||||
|
|
||||||
def open_doc_dev(self, ext="pdf"):
|
def open_doc_dev(self, ext="pdf"):
|
||||||
|
|
|
||||||
|
|
@ -283,17 +283,3 @@ class MainTranslate(UnitTranslate):
|
||||||
self._dict["Save"] = _translate("MainWindow", "Save")
|
self._dict["Save"] = _translate("MainWindow", "Save")
|
||||||
self._dict["Close"] = _translate("MainWindow", "Close")
|
self._dict["Close"] = _translate("MainWindow", "Close")
|
||||||
self._dict["Solver"] = _translate("MainWindow", "Solver")
|
self._dict["Solver"] = _translate("MainWindow", "Solver")
|
||||||
|
|
||||||
self._dict["mb_results_not_found"] = _translate(
|
|
||||||
"MainWindow", "Results can not be loaded"
|
|
||||||
)
|
|
||||||
self._dict["mb_results_folder_not_found"] = _translate(
|
|
||||||
"MainWindow",
|
|
||||||
"Results folder does not correspond to a Pamhyr2 solver name"
|
|
||||||
)
|
|
||||||
self._dict["mb_results_bin_not_found"] = _translate(
|
|
||||||
"MainWindow", "Results binary files not found"
|
|
||||||
)
|
|
||||||
self._dict["mb_results_total_bin_not_found"] = _translate(
|
|
||||||
"MainWindow", "total_sediment.bin file not found"
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue