mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
4 Commits
31fe765e51
...
41cffd13e0
| Author | SHA1 | Date |
|---|---|---|
|
|
41cffd13e0 | |
|
|
9270dd0ff1 | |
|
|
ba8a50e0b9 | |
|
|
fce034419d |
|
|
@ -278,7 +278,6 @@ class FrictionTableModel(PamhyrTableModel):
|
|||
if int(line[1]) == reach_id:
|
||||
data.append(line[1:])
|
||||
|
||||
print(data)
|
||||
new_data = []
|
||||
for d in data:
|
||||
new = None
|
||||
|
|
|
|||
|
|
@ -151,31 +151,32 @@ class ReplaceDataCommand(QUndoCommand):
|
|||
self._new_data = new_data
|
||||
self._old_rows = list(range(len(frictions)))
|
||||
self._new_rows = list(range(len(new_data)))
|
||||
self._new = []
|
||||
|
||||
self._old_friction = []
|
||||
for row in self._old_rows:
|
||||
self._old_friction.append((row, self._frictions.lst[row]))
|
||||
|
||||
self._new_friction = []
|
||||
for row in self._new_rows:
|
||||
new = Friction(status=self._frictions._status)
|
||||
d = new_data[row]
|
||||
new.edge = d[0]
|
||||
new.begin_rk = d[1]
|
||||
new.end_rk = d[2]
|
||||
new.begin_strickler = d[3]
|
||||
new.end_strickler = d[4]
|
||||
self._new_friction.append((row, new))
|
||||
|
||||
def undo(self):
|
||||
self._frictions.delete_i(self._new_rows)
|
||||
for row, el in self._old_friction:
|
||||
self._frictions.insert(row, el)
|
||||
|
||||
def redo(self):
|
||||
self._frictions.delete_i(self._old_rows)
|
||||
for row, el in self._new_friction:
|
||||
self._frictions.insert(row, el)
|
||||
if len(self._new) == 0:
|
||||
self._frictions.delete_i(self._old_rows)
|
||||
for row in self._new_rows:
|
||||
new = self._frictions.new(row)
|
||||
d = self._new_data[row]
|
||||
new.edge = d[0]
|
||||
new.begin_rk = d[1]
|
||||
new.end_rk = d[2]
|
||||
new.begin_strickler = d[3]
|
||||
new.end_strickler = d[4]
|
||||
self._new.append((row, new))
|
||||
else:
|
||||
for row, el in self._new:
|
||||
self._frictions.insert(row, el)
|
||||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class ComboBoxDelegate(QItemDelegate):
|
|||
def setModelData(self, editor, model, index):
|
||||
text = str(editor.currentText())
|
||||
|
||||
if self._mode == "rk":
|
||||
if self._mode == "rk" and self._data.reach is not None:
|
||||
profiles = list(
|
||||
filter(
|
||||
lambda p: p.display_name() == text,
|
||||
|
|
|
|||
|
|
@ -143,13 +143,13 @@ class DelCommand(QUndoCommand):
|
|||
self._tab = tab
|
||||
self._rows = rows
|
||||
|
||||
self._bc = []
|
||||
self._lc = []
|
||||
for row in rows:
|
||||
self._bc.append((row, self._lcs.get(self._tab, row)))
|
||||
self._bc.sort()
|
||||
self._lc.append((row, self._lcs.get(self._tab, row)))
|
||||
self._lc.sort()
|
||||
|
||||
def undo(self):
|
||||
for row, el in self._bc:
|
||||
for row, el in self._lc:
|
||||
self._lcs.insert(self._tab, row, el)
|
||||
|
||||
def redo(self):
|
||||
|
|
@ -219,14 +219,14 @@ class PasteCommand(QUndoCommand):
|
|||
self._lcs = lcs
|
||||
self._tab = tab
|
||||
self._row = row
|
||||
self._bc = deepcopy(bc)
|
||||
self._bc.reverse()
|
||||
self._lc = deepcopy(bc)
|
||||
self._lc.reverse()
|
||||
|
||||
def undo(self):
|
||||
self._lcs.delete(self._tab, self._bc)
|
||||
self._lcs.delete(self._tab, self._lc)
|
||||
|
||||
def redo(self):
|
||||
for bc in self._bc:
|
||||
for bc in self._lc:
|
||||
self._lcs.insert(self._tab, self._row, bc)
|
||||
|
||||
|
||||
|
|
@ -237,11 +237,11 @@ class DuplicateCommand(QUndoCommand):
|
|||
self._lcs = lcs
|
||||
self._tab = tab
|
||||
self._rows = rows
|
||||
self._bc = deepcopy(bc)
|
||||
self._bc.reverse()
|
||||
self._lc = deepcopy(bc)
|
||||
self._lc.reverse()
|
||||
|
||||
def undo(self):
|
||||
self._lcs.delete(self._tab, self._bc)
|
||||
self._lcs.delete(self._tab, self._lc)
|
||||
|
||||
def redo(self):
|
||||
for bc in self._lcs:
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue