IC: Fix row display.

mesh
Pierre-Antoine Rouby 2023-05-30 17:31:40 +02:00
parent 74b914001b
commit 5a900578c8
4 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@ from tools import trace, timer
class Data(object):
def __init__(self, status = None):
super(Data, self).__init()
super(Data, self).__init__()
self._status = status
@ -17,7 +17,7 @@ class Data(object):
self._cote = 0.0
self._tiran = 0.0
def __getitems__(self, key):
def __getitem__(self, key):
val = None
if key == "name":
@ -35,7 +35,7 @@ class Data(object):
return val
def __setitems__(self, key, value):
def __setitem__(self, key, value):
if key == "name":
self._name = str(value)
elif key == "comment":

View File

@ -34,3 +34,4 @@ class InitialConditionsDict(object):
def new(self, reach):
new = InitialConditions(reach = reach, status = self._status)
self.set(reach, new)
return new

View File

@ -16,14 +16,15 @@ class SetCommand(QUndoCommand):
self._ics = ics
self._row = row
self._column = column
self._old = self._ics.get(self._row)[column]
self._new = new_value
def undo(self):
self._ics.get(self._row)[column] = self._old
self._ics.get(self._row)[self._column] = self._old
def redo(self):
self._ics.get(self._row)[column] = self._new
self._ics.get(self._row)[self._column] = self._new
class AddCommand(QUndoCommand):
def __init__(self, ics, index):

View File

@ -131,7 +131,7 @@ class InitialConditionsWindow(ASubMainWindow, ListedSubWindow):
def add(self):
rows = self.index_selected_rows()
if self._ics.len(tab) == 0 or len(rows) == 0:
if len(self._ics) == 0 or len(rows) == 0:
self._table.add(0)
else:
self._table.add(rows[0])