pamhyr: Add saved status in model.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-05-15 11:37:53 +02:00
1 parent b786bb44e2
commit d328806916
21 files changed
+215 -54

No files matched your search

+17 -1
View File
@@ -9,9 +9,12 @@ class Profile(object):
def __init__(self, num: int = 0,
kp:float = 0.0, name:str = "",
code1: int = 0, code2: int = 0,
_type:str = "", reach = None):
_type:str = "", reach = None,
status = None):
super(Profile, self).__init__()
self._status = status
self._num = int(num)
self._code1 = int(code1)
self._code2 = int(code2)
@@ -46,6 +49,7 @@ class Profile(object):
@num.setter
def num(self, value: int):
self._num = int(value)
self._status.modified()
@property
def code1(self):
@@ -58,6 +62,7 @@ class Profile(object):
@code1.setter
def code1(self, value: int):
self._code1 = int(value)
self._status.modified()
@property
def code2(self):
@@ -70,6 +75,7 @@ class Profile(object):
@code2.setter
def code2(self, value: int):
self._code2 = int(value)
self._status.modified()
@property
def nb_points(self):
@@ -86,6 +92,7 @@ class Profile(object):
@kp.setter
def kp(self, value: float):
self._kp = float(value)
self._status.modified()
@property
def name(self):
@@ -98,6 +105,7 @@ class Profile(object):
@name.setter
def name(self, value: str):
self._name = value.strip()
self._status.modified()
@property
def profile_type(self):
@@ -110,6 +118,7 @@ class Profile(object):
@profile_type.setter
def profile_type(self, value: str):
self._profile_type = value
self._status.modified()
def point(self, i:int):
if i < len(self._points):
@@ -138,6 +147,7 @@ class Profile(object):
Nothing.
"""
self._points.insert(index, point)
self._status.modified()
def delete(self, indexes: int):
@@ -165,6 +175,7 @@ class Profile(object):
self.points
)
)
self._status.modified()
def delete_points(self, points):
"""Delete some elements in profile list
@@ -181,6 +192,7 @@ class Profile(object):
self.points
)
)
self._status.modified()
# Move
@@ -190,6 +202,7 @@ class Profile(object):
p = self._points
p[index], p[next] = p[next], p[index]
self._status.modified()
def move_down_point(self, index: int):
if index >= 0:
@@ -197,6 +210,7 @@ class Profile(object):
p = self._points
p[index], p[prev] = p[prev], p[index]
self._status.modified()
# Sort
@@ -213,6 +227,7 @@ class Profile(object):
key=predicate,
reverse=is_reversed
)
self._status.modified()
@timer
def sort_with_indexes(self, indexes: list):
@@ -228,6 +243,7 @@ class Profile(object):
)
)
)
self._status.modified()
# Abstract method, must be implemented for in non abstract class
def get_station(self):