mirror of https://gitlab.com/pamhyr/pamhyr2
Compare commits
No commits in common. "44a8be6be382efc6b8d28d91d932a9a3e050d966" and "17a18dde186ca35cf628deeaf342d8550a1dfdbb" have entirely different histories.
44a8be6be3
...
17a18dde18
|
|
@ -105,6 +105,16 @@ class Profile(SQLSubModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def _db_update(cls, execute, version, data=None):
|
def _db_update(cls, execute, version, data=None):
|
||||||
major, minor, release = version.strip().split(".")
|
major, minor, release = version.strip().split(".")
|
||||||
|
create = False
|
||||||
|
|
||||||
|
if major == "0" and int(minor) < 2:
|
||||||
|
cls._db_create(execute)
|
||||||
|
create = True
|
||||||
|
|
||||||
|
if major == "0" and int(minor) == 2:
|
||||||
|
if int(release) < 1 and not create:
|
||||||
|
cls._db_create(execute)
|
||||||
|
create = True
|
||||||
|
|
||||||
return cls._update_submodel(execute, version, data)
|
return cls._update_submodel(execute, version, data)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ class Rubar3(CommandLineSolver):
|
||||||
ind = 1
|
ind = 1
|
||||||
for mail in edge.reach.inter_profiles_rk():
|
for mail in edge.reach.inter_profiles_rk():
|
||||||
coef = get_stricklers_from_rk(mail, lst)
|
coef = get_stricklers_from_rk(mail, lst)
|
||||||
if coef is not None:
|
if coeff is not None:
|
||||||
f.write(f"{ind:>6} {coef:>12.5f}")
|
f.write(f"{ind:>6} {coef:>12.5f}")
|
||||||
|
|
||||||
ind += 1
|
ind += 1
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
"action_menu_new": self.open_new_study,
|
"action_menu_new": self.open_new_study,
|
||||||
"action_menu_edit": self.open_edit_study,
|
"action_menu_edit": self.open_edit_study,
|
||||||
"action_menu_open": self.open_model,
|
"action_menu_open": self.open_model,
|
||||||
"action_menu_save": lambda: self.save_study(),
|
"action_menu_save": self.save_study,
|
||||||
"action_menu_save_as": self.save_as_study,
|
"action_menu_save_as": self.save_as_study,
|
||||||
"action_menu_numerical_parameter": self.open_solver_parameters,
|
"action_menu_numerical_parameter": self.open_solver_parameters,
|
||||||
"action_menu_edit_scenarios": self.open_scenarios,
|
"action_menu_edit_scenarios": self.open_scenarios,
|
||||||
|
|
@ -637,10 +637,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
logger.info(f"Open Study - {self._study.name}")
|
logger.info(f"Open Study - {self._study.name}")
|
||||||
self.set_title()
|
self.set_title()
|
||||||
|
|
||||||
def _save(self, source):
|
def save_study(self):
|
||||||
self.save_study(progress_parent=source)
|
|
||||||
|
|
||||||
def save_study(self, progress_parent=None):
|
|
||||||
"""Save current study
|
"""Save current study
|
||||||
|
|
||||||
Save current study, if study as no associate file, open a
|
Save current study, if study as no associate file, open a
|
||||||
|
|
@ -670,15 +667,11 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
self._backup_timer.blockSignals(True)
|
self._backup_timer.blockSignals(True)
|
||||||
self._save_mutex.lock()
|
self._save_mutex.lock()
|
||||||
|
|
||||||
parent = self
|
|
||||||
if progress_parent is not None:
|
|
||||||
parent = progress_parent
|
|
||||||
|
|
||||||
sql_request_count = self._study.sql_save_request_count()
|
sql_request_count = self._study.sql_save_request_count()
|
||||||
progress = QProgressDialog(
|
progress = QProgressDialog(
|
||||||
"Saving...", None,
|
"Saving...", None,
|
||||||
0, sql_request_count,
|
0, sql_request_count,
|
||||||
parent=parent
|
parent=self
|
||||||
)
|
)
|
||||||
progress.setWindowModality(Qt.WindowModal)
|
progress.setWindowModality(Qt.WindowModal)
|
||||||
progress.setValue(0)
|
progress.setValue(0)
|
||||||
|
|
@ -691,7 +684,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
progress=lambda: progress.setValue(progress.value() + 1)
|
progress=lambda: progress.setValue(progress.value() + 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
progress.close()
|
|
||||||
status += " Done"
|
status += " Done"
|
||||||
logger.info(status)
|
logger.info(status)
|
||||||
self.statusbar.showMessage(status, 3000)
|
self.statusbar.showMessage(status, 3000)
|
||||||
|
|
@ -766,8 +758,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
|
|
||||||
progress.setValue(progress.value() + 1)
|
progress.setValue(progress.value() + 1)
|
||||||
|
|
||||||
progress.close()
|
|
||||||
|
|
||||||
def save_as_study_single_scenario(self, sid=-1):
|
def save_as_study_single_scenario(self, sid=-1):
|
||||||
sql_request_count = self._study.sql_save_request_count()
|
sql_request_count = self._study.sql_save_request_count()
|
||||||
|
|
||||||
|
|
@ -792,7 +782,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
)
|
)
|
||||||
|
|
||||||
status += " Done"
|
status += " Done"
|
||||||
progress.close()
|
|
||||||
logger.info(status)
|
logger.info(status)
|
||||||
self.statusbar.showMessage(status, 3000)
|
self.statusbar.showMessage(status, 3000)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,6 @@ class PamhyrWindow(ASubMainWindow, ListedSubWindow, PamhyrWindowTools):
|
||||||
|
|
||||||
self._set_title()
|
self._set_title()
|
||||||
self._set_icon()
|
self._set_icon()
|
||||||
self._setup_save_sc()
|
|
||||||
|
|
||||||
def _set_title(self):
|
def _set_title(self):
|
||||||
title = self._title
|
title = self._title
|
||||||
|
|
@ -197,25 +196,12 @@ class PamhyrWindow(ASubMainWindow, ListedSubWindow, PamhyrWindowTools):
|
||||||
|
|
||||||
self.ui.setWindowTitle(title)
|
self.ui.setWindowTitle(title)
|
||||||
|
|
||||||
def _setup_save_sc(self):
|
|
||||||
if self._parent is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._save_sc = QShortcut(QKeySequence("Ctrl+S"), self)
|
|
||||||
self._save_sc.activated.connect(lambda: self._save(self))
|
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
self._close_sub_window()
|
self._close_sub_window()
|
||||||
self._propagate_update(Modules.WINDOW_LIST)
|
self._propagate_update(Modules.WINDOW_LIST)
|
||||||
|
|
||||||
super(PamhyrWindow, self).closeEvent(event)
|
super(PamhyrWindow, self).closeEvent(event)
|
||||||
|
|
||||||
def _save(self, source):
|
|
||||||
if self._parent is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
return self._parent._save(source)
|
|
||||||
|
|
||||||
|
|
||||||
class PamhyrDialog(ASubWindow, ListedSubWindow, PamhyrWindowTools):
|
class PamhyrDialog(ASubWindow, ListedSubWindow, PamhyrWindowTools):
|
||||||
_pamhyr_ui = "dummy"
|
_pamhyr_ui = "dummy"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue