mirror of https://gitlab.com/pamhyr/pamhyr2
debug IC import
parent
6c8a2013d9
commit
0569425df1
|
|
@ -38,7 +38,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel
|
||||||
from View.InitialConditions.UndoCommand import (
|
from View.InitialConditions.UndoCommand import (
|
||||||
SetCommand, AddCommand, DelCommand,
|
SetCommand, AddCommand, DelCommand,
|
||||||
SortCommand, MoveCommand, InsertCommand,
|
SortCommand, MoveCommand, InsertCommand,
|
||||||
DuplicateCommand, GenerateCommand,
|
DuplicateCommand, GenerateCommand, ReplaceDataCommand,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
@ -267,8 +267,8 @@ class InitialConditionTableModel(PamhyrTableModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
InsertCommand(
|
ReplaceDataCommand(
|
||||||
self._lst, index,
|
self._lst,
|
||||||
list(
|
list(
|
||||||
map(
|
map(
|
||||||
lambda d: self._lst.new_from_data(*d),
|
lambda d: self._lst.new_from_data(*d),
|
||||||
|
|
|
||||||
|
|
@ -198,3 +198,25 @@ class GenerateCommand(QUndoCommand):
|
||||||
self._param[1],
|
self._param[1],
|
||||||
self._option,
|
self._option,
|
||||||
self._param[2])
|
self._param[2])
|
||||||
|
|
||||||
|
|
||||||
|
class ReplaceDataCommand(QUndoCommand):
|
||||||
|
def __init__(self, ics, new_data):
|
||||||
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
|
self._ics = ics
|
||||||
|
self._copy = self._ics.data
|
||||||
|
self._new_data = new_data
|
||||||
|
self._rows = list(range(len(ics.data)))
|
||||||
|
self._new_rows = list(range(len(new_data)))
|
||||||
|
|
||||||
|
def undo(self):
|
||||||
|
self._ics.delete_i(self._new_rows)
|
||||||
|
for row, el in enumerate(self._copy):
|
||||||
|
self._ics.insert(row, el)
|
||||||
|
|
||||||
|
def redo(self):
|
||||||
|
self._ics.delete_i(self._rows)
|
||||||
|
for row, el in enumerate(self._new_data):
|
||||||
|
self._ics.insert(row, el)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,11 +276,14 @@ class InitialConditionsWindow(PamhyrWindow):
|
||||||
.replace(".BIN", "")
|
.replace(".BIN", "")
|
||||||
|
|
||||||
def reading():
|
def reading():
|
||||||
self._tmp_results = solver.results(
|
try:
|
||||||
self._study,
|
self._tmp_results = solver.results(
|
||||||
os.path.dirname(file_name),
|
self._study,
|
||||||
name=name
|
os.path.dirname(file_name),
|
||||||
)
|
name=name
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
dlg = ReadingResultsDialog(
|
dlg = ReadingResultsDialog(
|
||||||
reading_fn=reading,
|
reading_fn=reading,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue