mirror of https://gitlab.com/pamhyr/pamhyr2
Results: Update to async db load for results.
parent
6c4f6e269c
commit
8f6255c2cd
|
|
@ -169,7 +169,7 @@ class Results(SQLSubModel):
|
|||
|
||||
new = new_results
|
||||
|
||||
return new
|
||||
yield new
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
if self._status.scenario.id != self._owner_scenario:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import types
|
||||
import shutil
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
|
@ -530,6 +531,10 @@ class Study(SQLModel):
|
|||
|
||||
@property
|
||||
def results(self):
|
||||
results = self._river._results
|
||||
if isinstance(results, types.GeneratorType):
|
||||
self._river._results = next(results)
|
||||
|
||||
return self._river._results
|
||||
|
||||
@results.setter
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
|
||||
def setup_results(self):
|
||||
self._last_solver = None
|
||||
self._last_results = None
|
||||
self.last_results = None
|
||||
|
||||
default = None
|
||||
|
||||
|
|
@ -590,10 +590,23 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
# Last solver note found, use default-mage if exists
|
||||
self._last_solver = default
|
||||
|
||||
@property
|
||||
def last_results(self):
|
||||
if self._study is None:
|
||||
return None
|
||||
|
||||
return self._study.results
|
||||
|
||||
@last_results.setter
|
||||
def last_results(self, results):
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
self._study.results = results
|
||||
|
||||
def set_results(self, solver, results):
|
||||
self._last_solver = solver
|
||||
self._last_results = results
|
||||
self._study.results = results
|
||||
self.last_results = results
|
||||
|
||||
self.enable_actions("action_menu_results_last", True)
|
||||
|
||||
|
|
@ -1479,9 +1492,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
# If no specific results, get last results
|
||||
if results is None:
|
||||
def reading_fn():
|
||||
self._tmp_results = self._last_results
|
||||
self._tmp_results = self.last_results
|
||||
|
||||
if self._last_results is None:
|
||||
if self.last_results is None:
|
||||
def reading_fn():
|
||||
self._tmp_results = solver.results(
|
||||
self._study,
|
||||
|
|
@ -1543,9 +1556,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
# If no specific results, get last results
|
||||
if results is None:
|
||||
def reading_fn():
|
||||
self._tmp_results = self._last_results
|
||||
self._tmp_results = self.last_results
|
||||
|
||||
if self._last_results is None:
|
||||
if self.last_results is None:
|
||||
def reading_fn():
|
||||
self._tmp_results = solver.results(
|
||||
self._study,
|
||||
|
|
@ -1608,15 +1621,12 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
if self._last_solver is None:
|
||||
return
|
||||
|
||||
if self._study is not None and self._study.results is not None:
|
||||
self._last_results = self._study.results
|
||||
|
||||
if self._last_solver._type == "mage8":
|
||||
self.open_solver_results(self._last_solver,
|
||||
self._last_results)
|
||||
self.last_results)
|
||||
elif self._last_solver._type == "adistswc":
|
||||
self.open_solver_results_adists(self._last_solver,
|
||||
self._last_results)
|
||||
self.last_results)
|
||||
|
||||
def open_results_from_file(self):
|
||||
if self._study is None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue