mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Add saved status in model.
This commit is contained in:
1 parent
b786bb44e2
commit
d328806916
21 files changed
+215
-54
No files matched your search
@@ -5,9 +5,11 @@ from tools import trace, timer, old_pamhyr_date_to_timestamp
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
class LateralContribution(object):
|
||||
def __init__(self, name:str = ""):
|
||||
def __init__(self, name:str = "", status = None):
|
||||
super(LateralContribution, self).__init__()
|
||||
|
||||
self._status = status
|
||||
|
||||
self._name = name
|
||||
self._type = ""
|
||||
self._edge = None
|
||||
@@ -36,6 +38,7 @@ class LateralContribution(object):
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
self._status.modified()
|
||||
|
||||
@property
|
||||
def lctype(self):
|
||||
@@ -48,6 +51,7 @@ class LateralContribution(object):
|
||||
@edge.setter
|
||||
def edge(self, edge):
|
||||
self._edge = edge
|
||||
self._status.modified()
|
||||
|
||||
def has_edge(self):
|
||||
return self._edge is not None
|
||||
@@ -97,10 +101,12 @@ class LateralContribution(object):
|
||||
def add(self, index:int):
|
||||
value = (self._default_0, self._default_1)
|
||||
self._data.insert(index, value)
|
||||
self._status.modified()
|
||||
return value
|
||||
|
||||
def insert(self, index:int, value):
|
||||
self._data.insert(index, value)
|
||||
self._status.modified()
|
||||
|
||||
def delete_i(self, indexes):
|
||||
self._data = list(
|
||||
@@ -112,6 +118,7 @@ class LateralContribution(object):
|
||||
)
|
||||
)
|
||||
)
|
||||
self._status.modified()
|
||||
|
||||
def delete(self, els):
|
||||
self._data = list(
|
||||
@@ -120,12 +127,14 @@ class LateralContribution(object):
|
||||
self.data
|
||||
)
|
||||
)
|
||||
self._status.modified()
|
||||
|
||||
def sort(self, _reverse=False, key=None):
|
||||
if key is None:
|
||||
self._data.sort(reverse=_reverse)
|
||||
else:
|
||||
self._data.sort(reverse=_reverse, key=key)
|
||||
self._status.modified()
|
||||
|
||||
def get_i(self, index):
|
||||
return self.data[index]
|
||||
@@ -141,6 +150,7 @@ class LateralContribution(object):
|
||||
v = list(self._data[index])
|
||||
v[column] = self._types[column](value)
|
||||
self._data[index] = tuple(v)
|
||||
self._status.modified()
|
||||
|
||||
def set_i_0(self, index:int, value):
|
||||
self._set_i_c_v(index, 0, value)
|
||||
@@ -160,6 +170,7 @@ class LateralContribution(object):
|
||||
for ind, v in self.data:
|
||||
new._set_i_c_v(ind, j, v[i])
|
||||
|
||||
self._status.modified()
|
||||
return new
|
||||
|
||||
def move_up(self, index):
|
||||
@@ -167,9 +178,11 @@ class LateralContribution(object):
|
||||
next = index - 1
|
||||
d = self._data
|
||||
d[index], d[next] = d[next], d[index]
|
||||
self._status.modified()
|
||||
|
||||
def move_down(self, index):
|
||||
if index >= 0:
|
||||
prev = index + 1
|
||||
d = self._data
|
||||
d[index], d[prev] = d[prev], d[index]
|
||||
self._status.modified()
|
||||
Reference in new issue
Block a user