From 6ba9a8aabca1fa286f5a850f72aec826de700e28 Mon Sep 17 00:00:00 2001 From: Andrea Brambilla Date: Mon, 26 Feb 2018 16:36:27 +0100 Subject: [PATCH] Do not free EnKFMain (the garbage collector will take car of that) --- python/python/ert_gui/ertnotifier.py | 5 +++-- python/python/ert_gui/ertplot.py | 15 +++++--------- python/python/ert_gui/gert_main.py | 20 ++++++++----------- .../python/ert_gui/shell/ert_shell_context.py | 4 ---- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/python/python/ert_gui/ertnotifier.py b/python/python/ert_gui/ertnotifier.py index 0b07558a2fd..d0e7e9713a5 100644 --- a/python/python/ert_gui/ertnotifier.py +++ b/python/python/ert_gui/ertnotifier.py @@ -1,5 +1,6 @@ -from res.enkf import EnKFMain from PyQt4.QtCore import QObject, pyqtSignal, pyqtSlot +from res.enkf import EnKFMain + class ErtNotifier(QObject): ertChanged = pyqtSignal() @@ -38,7 +39,7 @@ def reloadERT(self, config_file): python_executable = sys.executable ert_gui_main = sys.argv[0] - self._ert.free() + self._ert = None os.execl(python_executable, python_executable, ert_gui_main, config_file) diff --git a/python/python/ert_gui/ertplot.py b/python/python/ert_gui/ertplot.py index 387bded3a30..9dd92df1354 100755 --- a/python/python/ert_gui/ertplot.py +++ b/python/python/ert_gui/ertplot.py @@ -1,16 +1,14 @@ -import sys -import os from PyQt4.QtGui import QApplication -import time -from res.enkf import EnKFMain, ResConfig from ecl.util.util import Version from ert_gui.ert_splash import ErtSplash from ert_gui.ertwidgets import resourceIcon -from ert_gui.tools.plot.plot_window import PlotWindow - - import ert_gui.ertwidgets +from ert_gui.tools.plot.plot_window import PlotWindow +import os +from res.enkf import EnKFMain, ResConfig +import sys +import time if os.getenv("ERT_SHARE_PATH"): ert_share_path = os.getenv("ERT_SHARE_PATH") @@ -70,9 +68,6 @@ def main(argv): window.activateWindow() window.raise_() finished_code = app.exec_() - - ert.free() - sys.exit(finished_code) diff --git a/python/python/ert_gui/gert_main.py b/python/python/ert_gui/gert_main.py index 2b35422a567..d71318d8742 100755 --- a/python/python/ert_gui/gert_main.py +++ b/python/python/ert_gui/gert_main.py @@ -110,22 +110,15 @@ # # -------------------- -------------------- -import os -import sys -import time - from PyQt4.QtCore import Qt from PyQt4.QtGui import QApplication, QFileDialog - -import ert_gui.ertwidgets from ecl.util.util import EclVersion -from res.util import ResVersion -from res.enkf import EnKFMain, ResConfig -from res.util import ResLog from ert_gui import ErtVersion from ert_gui.ert_splash import ErtSplash from ert_gui.ertwidgets import SummaryPanel, resourceIcon +import ert_gui.ertwidgets from ert_gui.main_window import GertMainWindow +from ert_gui.newconfig import NewConfigurationDialog from ert_gui.simulation.simulation_panel import SimulationPanel from ert_gui.tools import HelpCenter from ert_gui.tools.export import ExportTool @@ -137,6 +130,12 @@ from ert_gui.tools.plugins import PluginHandler, PluginsTool from ert_gui.tools.run_analysis import RunAnalysisTool from ert_gui.tools.workflows import WorkflowsTool +import os +from res.enkf import EnKFMain, ResConfig +from res.util import ResLog +from res.util import ResVersion +import sys +import time if os.getenv("ERT_SHARE_PATH"): ert_share_path = os.getenv("ERT_SHARE_PATH") @@ -149,7 +148,6 @@ ert_gui.ertwidgets.img_prefix = ert_share_path + "/gui/img/" -from ert_gui.newconfig import NewConfigurationDialog def main(argv): @@ -253,8 +251,6 @@ def main(argv): window.raise_() ResLog.log(3, "Versions ecl:%s res:%s ert:%s" % (EclVersion( ), ResVersion( ), ErtVersion( ))) finished_code = app.exec_() - ert.free() - sys.exit(finished_code) diff --git a/python/python/ert_gui/shell/ert_shell_context.py b/python/python/ert_gui/shell/ert_shell_context.py index c145403eae4..df1a076d3a1 100644 --- a/python/python/ert_gui/shell/ert_shell_context.py +++ b/python/python/ert_gui/shell/ert_shell_context.py @@ -14,10 +14,6 @@ def ert(self): def setErt(self, ert): """ @type ert: res.enkf.enkf_main.EnKFMain """ - if self.__ert is not None and self.__ert != ert: - self.__ert.free() - self.__ert = None - self.__ert = ert @property