mirror of https://gitlab.com/pamhyr/pamhyr2
SL: Fix save for scenario.
parent
303f6bb35b
commit
40cc188815
|
|
@ -40,6 +40,7 @@ class Layer(SQLSubModel):
|
||||||
owner_scenario=owner_scenario
|
owner_scenario=owner_scenario
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._sl = sl
|
||||||
self._name = name
|
self._name = name
|
||||||
self._type = type
|
self._type = type
|
||||||
|
|
||||||
|
|
@ -58,6 +59,7 @@ class Layer(SQLSubModel):
|
||||||
@name.setter
|
@name.setter
|
||||||
def name(self, name):
|
def name(self, name):
|
||||||
self._name = name
|
self._name = name
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
|
|
@ -66,6 +68,7 @@ class Layer(SQLSubModel):
|
||||||
@type.setter
|
@type.setter
|
||||||
def type(self, type):
|
def type(self, type):
|
||||||
self._type = type
|
self._type = type
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def height(self):
|
def height(self):
|
||||||
|
|
@ -74,6 +77,7 @@ class Layer(SQLSubModel):
|
||||||
@height.setter
|
@height.setter
|
||||||
def height(self, height):
|
def height(self, height):
|
||||||
self._height = float(height)
|
self._height = float(height)
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def d50(self):
|
def d50(self):
|
||||||
|
|
@ -82,6 +86,7 @@ class Layer(SQLSubModel):
|
||||||
@d50.setter
|
@d50.setter
|
||||||
def d50(self, d50):
|
def d50(self, d50):
|
||||||
self._d50 = float(d50)
|
self._d50 = float(d50)
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sigma(self):
|
def sigma(self):
|
||||||
|
|
@ -90,6 +95,7 @@ class Layer(SQLSubModel):
|
||||||
@sigma.setter
|
@sigma.setter
|
||||||
def sigma(self, sigma):
|
def sigma(self, sigma):
|
||||||
self._sigma = float(sigma)
|
self._sigma = float(sigma)
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def critical_constraint(self):
|
def critical_constraint(self):
|
||||||
|
|
@ -98,6 +104,7 @@ class Layer(SQLSubModel):
|
||||||
@critical_constraint.setter
|
@critical_constraint.setter
|
||||||
def critical_constraint(self, critical_constraint):
|
def critical_constraint(self, critical_constraint):
|
||||||
self._critical_constraint = float(critical_constraint)
|
self._critical_constraint = float(critical_constraint)
|
||||||
|
self.modified()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _db_create(cls, execute, ext=""):
|
def _db_create(cls, execute, ext=""):
|
||||||
|
|
@ -199,7 +206,7 @@ class Layer(SQLSubModel):
|
||||||
"SELECT pamhyr_id, deleted, name, type, height, " +
|
"SELECT pamhyr_id, deleted, name, type, height, " +
|
||||||
"d50, sigma, critical_constraint, scenario " +
|
"d50, sigma, critical_constraint, scenario " +
|
||||||
"FROM sedimentary_layer_layer " +
|
"FROM sedimentary_layer_layer " +
|
||||||
f"WHERE sl = {sl} " +
|
f"WHERE sl = {sl.pamhyr_id} " +
|
||||||
f"AND scenario = {scenario.id} " +
|
f"AND scenario = {scenario.id} " +
|
||||||
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) " +
|
f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))}) " +
|
||||||
"ORDER BY ind ASC"
|
"ORDER BY ind ASC"
|
||||||
|
|
@ -263,6 +270,10 @@ class Layer(SQLSubModel):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def modified(self):
|
||||||
|
super(Layer, self).modified()
|
||||||
|
|
||||||
|
self._sl.modified()
|
||||||
|
|
||||||
class SedimentLayer(SQLSubModel):
|
class SedimentLayer(SQLSubModel):
|
||||||
_sub_classes = [Layer]
|
_sub_classes = [Layer]
|
||||||
|
|
@ -433,7 +444,7 @@ class SedimentLayer(SQLSubModel):
|
||||||
if deleted:
|
if deleted:
|
||||||
sl.set_as_deleted()
|
sl.set_as_deleted()
|
||||||
|
|
||||||
data["sl"] = sl.id
|
data["sl"] = sl
|
||||||
sl._layers = Layer._db_load(execute, data)
|
sl._layers = Layer._db_load(execute, data)
|
||||||
|
|
||||||
loaded.add(pid)
|
loaded.add(pid)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue