mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
8 Commits
d922436ada
...
78ba7b70b4
| Author | SHA1 | Date |
|---|---|---|
|
|
78ba7b70b4 | |
|
|
61156f1c3e | |
|
|
e26b170b05 | |
|
|
64d2b2678a | |
|
|
3a3b5ea2dd | |
|
|
7cb3ac8a80 | |
|
|
190ca5d171 | |
|
|
5d8ec51417 |
|
|
@ -214,7 +214,7 @@ class InternalMeshing(AMeshingTool):
|
||||||
ratio = (alpha[j0] - beta[j0-1]) \
|
ratio = (alpha[j0] - beta[j0-1]) \
|
||||||
/ (beta[j0] - beta[j0-1])
|
/ (beta[j0] - beta[j0-1])
|
||||||
if ratio < 0.0:
|
if ratio < 0.0:
|
||||||
print(f"ratio négatif {ratio}")
|
logger.warning(f"ratio négatif {ratio}")
|
||||||
# on double le point a gauche
|
# on double le point a gauche
|
||||||
p = sect2.point(start2+j0-1).copy()
|
p = sect2.point(start2+j0-1).copy()
|
||||||
sect2.insert_point(start2+j0-1, p)
|
sect2.insert_point(start2+j0-1, p)
|
||||||
|
|
|
||||||
|
|
@ -304,8 +304,10 @@ class BoundaryConditionAdisTS(SQLSubModel):
|
||||||
|
|
||||||
if pol_id not in pid_pol:
|
if pol_id not in pid_pol:
|
||||||
# ⚠️ cas important : probablement déjà migré
|
# ⚠️ cas important : probablement déjà migré
|
||||||
print(f"[WARN] pol_id {pol_id} not in pid_pol " +
|
logger.warning(
|
||||||
f"→ probably already migrated")
|
f"pol_id {pol_id} not in pid_pol " +
|
||||||
|
"→ probably already migrated"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
execute(
|
execute(
|
||||||
|
|
|
||||||
|
|
@ -338,6 +338,13 @@ class PointXYZ(Point):
|
||||||
self._z = float(value)
|
self._z = float(value)
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
|
def shift(self, x, y, z):
|
||||||
|
self.x += x
|
||||||
|
self.y += y
|
||||||
|
self.z += z
|
||||||
|
|
||||||
|
self.modified()
|
||||||
|
|
||||||
def get_coordinate(self):
|
def get_coordinate(self):
|
||||||
return (self._x, self._y, self._z)
|
return (self._x, self._y, self._z)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from typing import List
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from tools import timer, flatten
|
from tools import trace, timer, flatten
|
||||||
from shapely import geometry
|
from shapely import geometry
|
||||||
|
|
||||||
from Model.Tools.PamhyrDB import SQLSubModel
|
from Model.Tools.PamhyrDB import SQLSubModel
|
||||||
|
|
@ -396,7 +396,6 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
|
|
||||||
for point in self._points:
|
for point in self._points:
|
||||||
p = point.copy()
|
p = point.copy()
|
||||||
print(p)
|
|
||||||
new_p._points.append(p)
|
new_p._points.append(p)
|
||||||
|
|
||||||
new_p.modified()
|
new_p.modified()
|
||||||
|
|
@ -1074,16 +1073,10 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
|
|
||||||
def shift(self, x, y, z):
|
def shift(self, x, y, z):
|
||||||
for p in self._points:
|
for p in self._points:
|
||||||
p.x = p.x + x
|
p.shift(x, y, z)
|
||||||
p.y = p.y + y
|
|
||||||
p.z = p.z + z
|
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
||||||
def modified(self):
|
|
||||||
self.tab_up_to_date = False
|
|
||||||
self.station_up_to_date = False
|
|
||||||
|
|
||||||
def add_npoints(self, npoints):
|
def add_npoints(self, npoints):
|
||||||
# add npoints in a profile
|
# add npoints in a profile
|
||||||
for k in range(npoints):
|
for k in range(npoints):
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,11 @@ class Reach(SQLSubModel):
|
||||||
self._guidelines_is_valid = False
|
self._guidelines_is_valid = False
|
||||||
self._guidelines = {}
|
self._guidelines = {}
|
||||||
|
|
||||||
|
super(Reach, self).__init__(
|
||||||
|
id=parent.pamhyr_id,
|
||||||
|
status=status,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pamhyr_id(self):
|
def pamhyr_id(self):
|
||||||
return self._parent.pamhyr_id
|
return self._parent.pamhyr_id
|
||||||
|
|
@ -60,6 +65,10 @@ class Reach(SQLSubModel):
|
||||||
def _pamhyr_id(self):
|
def _pamhyr_id(self):
|
||||||
return self._parent.pamhyr_id
|
return self._parent.pamhyr_id
|
||||||
|
|
||||||
|
@_pamhyr_id.setter
|
||||||
|
def _pamhyr_id(self, id):
|
||||||
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _db_create(cls, execute):
|
def _db_create(cls, execute):
|
||||||
return cls._create_submodel(execute)
|
return cls._create_submodel(execute)
|
||||||
|
|
@ -202,7 +211,6 @@ class Reach(SQLSubModel):
|
||||||
else:
|
else:
|
||||||
gi = self.get_global_profil_index(index)
|
gi = self.get_global_profil_index(index)
|
||||||
profile.num = gi
|
profile.num = gi
|
||||||
print(f"gi = {gi}")
|
|
||||||
self._profiles.insert(gi, profile)
|
self._profiles.insert(gi, profile)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,6 @@ class BasicHS(SQLSubModel):
|
||||||
bhs._data = BHSValue._db_load(
|
bhs._data = BHSValue._db_load(
|
||||||
execute, data
|
execute, data
|
||||||
)
|
)
|
||||||
print(f"{bhs_pid} : {deleted}")
|
|
||||||
if deleted:
|
if deleted:
|
||||||
bhs.set_as_deleted()
|
bhs.set_as_deleted()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -588,8 +588,6 @@ class InitialConditions(SQLSubModel):
|
||||||
for data in self._data:
|
for data in self._data:
|
||||||
data_height[data["rk"].rk] = data["height"]
|
data_height[data["rk"].rk] = data["height"]
|
||||||
|
|
||||||
print(data_height)
|
|
||||||
|
|
||||||
incline = self._reach.reach.get_incline_median_mean()
|
incline = self._reach.reach.get_incline_median_mean()
|
||||||
logger.debug(f"incline = {incline}")
|
logger.debug(f"incline = {incline}")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ class OutputRKAdists(SQLSubModel):
|
||||||
"output_rk_adists(pamhyr_id, deleted, " +
|
"output_rk_adists(pamhyr_id, deleted, " +
|
||||||
"reach, rk, title, scenario) " +
|
"reach, rk, title, scenario) " +
|
||||||
"VALUES (" +
|
"VALUES (" +
|
||||||
f"{self.id}, {self._db_format(self.is_deleted())}" +
|
f"{self.id}, {self._db_format(self.is_deleted())}, " +
|
||||||
f"{self._reach}, {self._rk}, " +
|
f"{self._reach}, {self._rk}, " +
|
||||||
f"'{self._db_format(self._title)}', " +
|
f"'{self._db_format(self._title)}', " +
|
||||||
f"{self._status.scenario_id}" +
|
f"{self._status.scenario_id}" +
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,6 @@ class Reservoir(SQLSubModel):
|
||||||
cls._db_update_to_0_2_0_set_node_pid(execute, table, nodes)
|
cls._db_update_to_0_2_0_set_node_pid(execute, table, nodes)
|
||||||
Scenario.update_db_add_scenario(execute, table)
|
Scenario.update_db_add_scenario(execute, table)
|
||||||
|
|
||||||
print(execute(f"SELECT * FROM {table}"))
|
|
||||||
|
|
||||||
cls._db_create(execute, ext="_tmp")
|
cls._db_create(execute, ext="_tmp")
|
||||||
execute(
|
execute(
|
||||||
f"INSERT INTO {table}_tmp " +
|
f"INSERT INTO {table}_tmp " +
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
from tools import logger_exception
|
from tools import logger_exception
|
||||||
|
|
||||||
from Model.Tools.PamhyrDict import PamhyrModelDict
|
from Model.Tools.PamhyrDict import PamhyrModelDict
|
||||||
|
|
@ -78,3 +80,12 @@ class Scenarios(PamhyrModelDict):
|
||||||
|
|
||||||
self._dict[key].set_as_deleted()
|
self._dict[key].set_as_deleted()
|
||||||
self._status.modified()
|
self._status.modified()
|
||||||
|
|
||||||
|
def is_leaf(self, scenario):
|
||||||
|
return not reduce(
|
||||||
|
lambda acc, s: (
|
||||||
|
acc or (not s.is_deleted() and s.parent is scenario)
|
||||||
|
),
|
||||||
|
self._dict.values(),
|
||||||
|
False
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ from functools import reduce
|
||||||
from SQL import SQL
|
from SQL import SQL
|
||||||
from Model.Except import NotImplementedMethodeError
|
from Model.Except import NotImplementedMethodeError
|
||||||
|
|
||||||
|
from tools import trace
|
||||||
|
|
||||||
from Model.Tools.PamhyrID import PamhyrID
|
from Model.Tools.PamhyrID import PamhyrID
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
@ -48,11 +50,9 @@ class SQLModel(SQL):
|
||||||
self._cur = self._db.cursor()
|
self._cur = self._db.cursor()
|
||||||
|
|
||||||
if is_new:
|
if is_new:
|
||||||
logger.info("Create database")
|
|
||||||
self._create() # Create db
|
self._create() # Create db
|
||||||
# self._save() # Save
|
# self._save() # Save
|
||||||
else:
|
else:
|
||||||
logger.info("Update database")
|
|
||||||
self._update() # Update db scheme if necessary
|
self._update() # Update db scheme if necessary
|
||||||
# self._load() # Load data
|
# self._load() # Load data
|
||||||
|
|
||||||
|
|
@ -313,8 +313,10 @@ class SQLSubModel(PamhyrID):
|
||||||
|
|
||||||
if node_id not in nodes:
|
if node_id not in nodes:
|
||||||
# ⚠️ cas important : probablement déjà migré
|
# ⚠️ cas important : probablement déjà migré
|
||||||
print(f"[WARN] node_id {node_id} not in nodes " +
|
logger.warning(
|
||||||
f"→ probably already migrated")
|
f"node_id {node_id} not in nodes " +
|
||||||
|
"→ probably already migrated"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
execute(
|
execute(
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,6 @@ class Rubar3(CommandLineSolver):
|
||||||
coeff = coeff_min
|
coeff = coeff_min
|
||||||
else:
|
else:
|
||||||
for s in lst:
|
for s in lst:
|
||||||
print(s.begin_rk, s.end_rk)
|
|
||||||
if (rk >= s.begin_rk and rk <= s.end_rk or
|
if (rk >= s.begin_rk and rk <= s.end_rk or
|
||||||
rk <= s.begin_rk and rk >= s.end_rk):
|
rk <= s.begin_rk and rk >= s.end_rk):
|
||||||
coeff = s.begin_strickler # TODO: inerpolate
|
coeff = s.begin_strickler # TODO: inerpolate
|
||||||
|
|
@ -473,7 +472,6 @@ class Rubar3(CommandLineSolver):
|
||||||
last = profiles[-1]
|
last = profiles[-1]
|
||||||
|
|
||||||
if first not in data or last not in data:
|
if first not in data or last not in data:
|
||||||
print(data)
|
|
||||||
logger.error(
|
logger.error(
|
||||||
"Study initial condition is not fully defined"
|
"Study initial condition is not fully defined"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def meshing(self, mesher, data, tableView):
|
def meshing(self, mesher, data, tableView):
|
||||||
|
|
||||||
new_profiles = mesher.meshing(
|
new_profiles = mesher.meshing(
|
||||||
self._data,
|
self._data,
|
||||||
**data
|
**data
|
||||||
|
|
@ -287,7 +286,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def purge(self, np_purge):
|
def purge(self, np_purge):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PurgeCommand(
|
PurgeCommand(
|
||||||
self._data, np_purge
|
self._data, np_purge
|
||||||
|
|
@ -296,7 +294,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def shift(self, rows, dx, dy, dz):
|
def shift(self, rows, dx, dy, dz):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
ShiftCommand(
|
ShiftCommand(
|
||||||
self._data, rows, dx, dy, dz
|
self._data, rows, dx, dy, dz
|
||||||
|
|
@ -305,7 +302,6 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def change_reach(self, new_reach, parent):
|
def change_reach(self, new_reach, parent):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
ChangeReachCommand(
|
ChangeReachCommand(
|
||||||
new_reach,
|
new_reach,
|
||||||
|
|
|
||||||
|
|
@ -411,13 +411,13 @@ class ShiftCommand(QUndoCommand):
|
||||||
def undo(self):
|
def undo(self):
|
||||||
for i in self._rows:
|
for i in self._rows:
|
||||||
profile = self._reach.profiles[i]
|
profile = self._reach.profiles[i]
|
||||||
self._reach.profiles[i].shift(
|
profile.shift(
|
||||||
-self._dx, -self._dy, -self._dz
|
-self._dx, -self._dy, -self._dz
|
||||||
)
|
)
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
for i in self._rows:
|
for i in self._rows:
|
||||||
profile = self._reach.profiles[i]
|
profile = self._reach.profiles[i]
|
||||||
self._reach.profiles[i].shift(
|
profile.shift(
|
||||||
self._dx, self._dy, self._dz
|
self._dx, self._dy, self._dz
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -925,9 +925,11 @@ class GraphWidget(QGraphicsView):
|
||||||
self.scale(scaleFactor, scaleFactor)
|
self.scale(scaleFactor, scaleFactor)
|
||||||
|
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
if self._only_display or self.graph._status.is_read_only():
|
if self._only_display:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
locked = self.graph._status.is_read_only()
|
||||||
|
|
||||||
pos = self.mapToScene(event.pos())
|
pos = self.mapToScene(event.pos())
|
||||||
self.clicked = True
|
self.clicked = True
|
||||||
|
|
||||||
|
|
@ -936,9 +938,6 @@ class GraphWidget(QGraphicsView):
|
||||||
super(GraphWidget, self).mousePressEvent(event)
|
super(GraphWidget, self).mousePressEvent(event)
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.graph._status.is_read_only():
|
|
||||||
return
|
|
||||||
|
|
||||||
# Move item and select edge item
|
# Move item and select edge item
|
||||||
if self._state == "move":
|
if self._state == "move":
|
||||||
self._selected_new_edge_src_node = None
|
self._selected_new_edge_src_node = None
|
||||||
|
|
@ -948,39 +947,41 @@ class GraphWidget(QGraphicsView):
|
||||||
edge = items[0]
|
edge = items[0]
|
||||||
if edge:
|
if edge:
|
||||||
self.set_current_edge(edge)
|
self.set_current_edge(edge)
|
||||||
elif items and type(items[0]) is NodeItem:
|
if not locked:
|
||||||
self._mouse_origin_x = pos.x()
|
if items and type(items[0]) is NodeItem:
|
||||||
self._mouse_origin_y = pos.y()
|
self._mouse_origin_x = pos.x()
|
||||||
self._current_moved_node = items[0]
|
self._mouse_origin_y = pos.y()
|
||||||
|
self._current_moved_node = items[0]
|
||||||
|
|
||||||
# Add nodes and edges
|
if not locked:
|
||||||
elif self._state == "add":
|
# Add nodes and edges
|
||||||
items = self.items(event.pos())
|
if self._state == "add":
|
||||||
nodes = list(filter(lambda i: type(i) is NodeItem, items))
|
items = self.items(event.pos())
|
||||||
if not nodes:
|
nodes = list(filter(lambda i: type(i) is NodeItem, items))
|
||||||
self.add_node(pos)
|
if not nodes:
|
||||||
self.set_selected_new_edge_src_node(None)
|
self.add_node(pos)
|
||||||
else:
|
self.set_selected_new_edge_src_node(None)
|
||||||
if self.selected_new_edge_src_node() is None:
|
|
||||||
self.set_selected_new_edge_src_node(nodes[0])
|
|
||||||
else:
|
else:
|
||||||
self.add_edge(self.selected_new_edge_src_node(), nodes[0])
|
if self.selected_new_edge_src_node() is None:
|
||||||
|
self.set_selected_new_edge_src_node(nodes[0])
|
||||||
|
else:
|
||||||
|
self.add_edge(self.selected_new_edge_src_node(), nodes[0])
|
||||||
|
|
||||||
# Delete nodes and edges
|
# Delete nodes and edges
|
||||||
elif self._state == "del":
|
elif self._state == "del":
|
||||||
self._selected_new_edge_src_node = None
|
self._selected_new_edge_src_node = None
|
||||||
items = list(
|
items = list(
|
||||||
filter(
|
filter(
|
||||||
lambda i: type(i) is NodeItem or type(i) is EdgeItem,
|
lambda i: type(i) is NodeItem or type(i) is EdgeItem,
|
||||||
self.items(event.pos())
|
self.items(event.pos())
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
if len(items) > 0:
|
||||||
if len(items) > 0:
|
item = items[0]
|
||||||
item = items[0]
|
if type(item) is NodeItem:
|
||||||
if type(item) is NodeItem:
|
self.del_node(item)
|
||||||
self.del_node(item)
|
elif type(item) is EdgeItem:
|
||||||
elif type(item) is EdgeItem:
|
self.del_edge(item)
|
||||||
self.del_edge(item)
|
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
super(GraphWidget, self).mousePressEvent(event)
|
super(GraphWidget, self).mousePressEvent(event)
|
||||||
|
|
@ -988,10 +989,12 @@ class GraphWidget(QGraphicsView):
|
||||||
def mouseReleaseEvent(self, event):
|
def mouseReleaseEvent(self, event):
|
||||||
self.clicked = False
|
self.clicked = False
|
||||||
|
|
||||||
if self._only_display or self.graph._status.is_read_only():
|
if self._only_display:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._state == "move":
|
locked = self.graph._status.is_read_only()
|
||||||
|
|
||||||
|
if not locked and self._state == "move":
|
||||||
if self._current_moved_node is not None:
|
if self._current_moved_node is not None:
|
||||||
pos = self.mapToScene(event.pos())
|
pos = self.mapToScene(event.pos())
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
|
|
@ -1007,10 +1010,8 @@ class GraphWidget(QGraphicsView):
|
||||||
super(GraphWidget, self).mouseReleaseEvent(event)
|
super(GraphWidget, self).mouseReleaseEvent(event)
|
||||||
|
|
||||||
def mouseMoveEvent(self, event):
|
def mouseMoveEvent(self, event):
|
||||||
if self.graph._status.is_read_only():
|
|
||||||
return
|
|
||||||
|
|
||||||
pos = self.mapToScene(event.pos())
|
pos = self.mapToScene(event.pos())
|
||||||
|
locked = self.graph._status.is_read_only()
|
||||||
|
|
||||||
# Selecte item on the fly
|
# Selecte item on the fly
|
||||||
items = self.items(event.pos())
|
items = self.items(event.pos())
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ class DefaultMenu(AbstractMenu):
|
||||||
class ScenarioMenu(AbstractMenu):
|
class ScenarioMenu(AbstractMenu):
|
||||||
def run(self):
|
def run(self):
|
||||||
item = self._items[0]
|
item = self._items[0]
|
||||||
|
scenarios = item.graph._study.scenarios
|
||||||
|
|
||||||
current_scenario = item.graph._study.status.scenario.id
|
current_scenario = item.graph._study.status.scenario.id
|
||||||
|
|
||||||
select = self._menu.addAction(self._trad["menu_select_scenario"])
|
select = self._menu.addAction(self._trad["menu_select_scenario"])
|
||||||
|
|
@ -64,7 +66,9 @@ class ScenarioMenu(AbstractMenu):
|
||||||
delete = None
|
delete = None
|
||||||
|
|
||||||
if item.scenario.id != 0:
|
if item.scenario.id != 0:
|
||||||
delete = self._menu.addAction(self._trad["menu_del_scenario"])
|
if scenarios.is_leaf(item.scenario):
|
||||||
|
delete = self._menu.addAction(self._trad["menu_del_scenario"])
|
||||||
|
|
||||||
if item.scenario.id == current_scenario:
|
if item.scenario.id == current_scenario:
|
||||||
duplicate = self._menu.addAction(
|
duplicate = self._menu.addAction(
|
||||||
self._trad["menu_dup_scenario"]
|
self._trad["menu_dup_scenario"]
|
||||||
|
|
|
||||||
|
|
@ -470,9 +470,16 @@ class GraphWidget(QGraphicsView):
|
||||||
self.changeScenario.emit(self.sender())
|
self.changeScenario.emit(self.sender())
|
||||||
|
|
||||||
def new_scenario(self, pos):
|
def new_scenario(self, pos):
|
||||||
|
must_save = self.dialog_save()
|
||||||
|
if must_save == "Cancel":
|
||||||
|
return
|
||||||
|
|
||||||
def fn():
|
def fn():
|
||||||
self._close_other_window()
|
self._close_other_window()
|
||||||
self._study.save()
|
|
||||||
|
if must_save == "Save":
|
||||||
|
self._study.save()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
AddScenariosCommand(
|
AddScenariosCommand(
|
||||||
self._study,
|
self._study,
|
||||||
|
|
@ -500,9 +507,16 @@ class GraphWidget(QGraphicsView):
|
||||||
self.changeScenario.emit(self.sender())
|
self.changeScenario.emit(self.sender())
|
||||||
|
|
||||||
def duplicate_scenario(self, item):
|
def duplicate_scenario(self, item):
|
||||||
|
must_save = self.dialog_save()
|
||||||
|
if must_save == "Cancel":
|
||||||
|
return
|
||||||
|
|
||||||
def fn():
|
def fn():
|
||||||
self._close_other_window()
|
self._close_other_window()
|
||||||
# self._study.save()
|
|
||||||
|
if must_save == "Save":
|
||||||
|
self._study.save()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
DuplicateScenariosCommand(
|
DuplicateScenariosCommand(
|
||||||
self._study,
|
self._study,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue