Compare commits

...

6 Commits

5 changed files with 30 additions and 19 deletions

View File

@ -520,6 +520,9 @@ class Study(SQLModel):
[self.scenarios, self._river]
)
logger.debug(cnt)
# HACK: 8 is the number of SQL request do and dont counted in
# submodel save_count (let's count sql execute into the
# '_save' method)
return cnt + 8
def close(self):

View File

@ -546,6 +546,15 @@ class Mage(CommandLineSolver):
return files
def skip_hs(self, hs):
return (
hs.input_reach is None
or not hs.input_reach.is_enable()
or not hs.enabled
or hs.input_section is None
or hs.is_deleted()
)
def _export_SIN(self, study, repertory, qlog, name="0"):
files = []
@ -571,19 +580,7 @@ class Mage(CommandLineSolver):
files.append(f"{name}.SIN")
for hs in hydraulic_structures:
if hs.input_reach is None:
continue
if not hs.input_reach.is_enable():
continue
if not hs.enabled:
continue
if hs.input_section is None:
continue
if hs.is_deleted():
if self.skip_hs(hs):
continue
f.write(
@ -1186,7 +1183,7 @@ class Mage8(Mage):
for p in r.profiles:
p.geometry.compute_tabulation()
logger.info(f"compute velocily...")
logger.info(f"compute velocity...")
for r in reachs:
for t in ts_list:

View File

@ -16,7 +16,7 @@
# -*- coding: utf-8 -*-
from tools import trace, timer
from tools import trace, timer, logger_exception
from PyQt5.QtWidgets import (
QAction, QListView, QVBoxLayout,
@ -134,7 +134,10 @@ class GeoTIFFListWindow(PamhyrWindow):
def _update_rectangle(self):
for rect in self._plot_rect:
rect.remove()
try:
rect.remove()
except Exception as e:
logger_exception(e)
self._plot_rect = []

View File

@ -299,6 +299,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"action_menu_rep_additional_lines": self.open_rep_lines,
"action_menu_edit_geotiff": self.open_geotiff,
"action_menu_close": self.close_model,
"action_menu_quit": self.close,
"action_menu_results_last": self.open_last_results,
"action_menu_open_results_from_file": self.open_results_from_file,
"action_menu_compare_scenarios_results":

View File

@ -20,7 +20,7 @@ import logging
from functools import reduce
from tools import timer, trace
from tools import timer, trace, logger_exception
from View.Tools.PamhyrPlot import PamhyrPlot
import numpy as np
from matplotlib import collections
@ -332,7 +332,10 @@ class PlotXY(PamhyrPlot):
lst = self._data[0]._study.river._geotiff.lst
for img in self._plot_img:
self._plot_img[img].remove()
try:
self._plot_img[img].remove()
except Exception as e:
logger_exception(e)
self._plot_img = {}
@ -453,8 +456,12 @@ class PlotXY(PamhyrPlot):
overflow.append(pt_right)
for plot in self.overflow:
plot[0].remove()
try:
plot[0].remove()
except Exception as e:
logger_exception(e)
del plot[0]
self.overflow = []
for p in overflow: