def main(argv): app = QApplication(argv) #Early so that QT is initialized before other imports app.setWindowIcon(resourceIcon("application/window_icon_cutout")) if len(argv) == 1: sys.stderr.write("Missing configuration file") sys.exit(1) config_file = argv[1] strict = True if not os.path.exists(config_file): print("Can not run without a configuration file.") sys.exit(1) if os.path.isdir(config_file): print("The specified configuration file is a directory!") sys.exit(1) splash = ErtSplash() splash.version = "Version %s" % Version.getVersion() splash.timestamp = Version.getBuildTime() splash.show() splash.repaint() now = time.time() res_config = ResConfig(config_file) ert = EnKFMain(res_config, strict=strict, verbose=False) ert_gui.configureErtNotifier(ert, config_file) window = PlotWindow(ert, None) sleep_time = 2 - (time.time() - now) if sleep_time > 0: time.sleep(sleep_time) window.show() splash.finish(window) window.activateWindow() window.raise_() finished_code = app.exec_() ert.free() sys.exit(finished_code)
def main(argv): app = QApplication( argv) #Early so that QT is initialized before other imports app.setWindowIcon(resourceIcon("application/window_icon_cutout")) if len(argv) == 1: sys.stderr.write("Missing configuration file") sys.exit(1) config_file = argv[1] strict = True if not os.path.exists(config_file): print("Can not run without a configuration file.") sys.exit(1) if os.path.isdir(config_file): print("The specified configuration file is a directory!") sys.exit(1) splash = ErtSplash() splash.version = "Version %s" % Version.getVersion() splash.timestamp = Version.getBuildTime() splash.show() splash.repaint() now = time.time() res_config = ResConfig(config_file) ert = EnKFMain(res_config, strict=strict, verbose=False) ert_gui.configureErtNotifier(ert, config_file) window = PlotWindow(ert, None) sleep_time = 2 - (time.time() - now) if sleep_time > 0: time.sleep(sleep_time) window.show() splash.finish(window) window.activateWindow() window.raise_() finished_code = app.exec_() ert.free() sys.exit(finished_code)
def test_ecl_config_creation(self): with TestAreaContext("enkf_library_test") as work_area: work_area.copy_directory(self.case_directory) res_config = ResConfig("simple_config/minimum_config") main = EnKFMain(res_config) self.assertIsInstance(main.analysisConfig(), AnalysisConfig) self.assertIsInstance(main.eclConfig(), EclConfig) with self.assertRaises(AssertionError): # Null pointer! self.assertIsInstance(main.eclConfig().getRefcase(), EclSum) file_system = main.getEnkfFsManager().getCurrentFileSystem() self.assertEqual(file_system.getCaseName(), "default") time_map = file_system.getTimeMap() self.assertIsInstance(time_map, TimeMap) main.free()
def main(argv): app = QApplication( argv) # Early so that QT is initialized before other imports app.setWindowIcon(resourceIcon("application/window_icon_cutout")) if len(argv) == 1: config_file = QFileDialog.getOpenFileName(None, "Open Configuration File") config_file = str(config_file) if len(config_file) == 0: print( "-----------------------------------------------------------------" ) print( "-- You must supply the name of configuration file as the first --" ) print( "-- commandline argument: --" ) print( "-- --" ) print( "-- bash% gert <config_file> --" ) print( "-- --" ) print( "-- If the configuration file does not exist, gert will create --" ) print( "-- create a new configuration file. --" ) print( "-----------------------------------------------------------------" ) sys.exit(1) else: config_file = argv[1] help_center = HelpCenter("ERT") help_center.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/") help_center.setHelpMessageLink("welcome_to_ert") strict = True verbose = False verbose_var = os.getenv("ERT_VERBOSE", "False") lower_verbose_var = verbose_var.lower() if lower_verbose_var == "true": verbose = True if not os.path.exists(config_file): print("Trying to start new config") new_configuration_dialog = NewConfigurationDialog(config_file) success = new_configuration_dialog.exec_() if not success: print("Can not run without a configuration file.") sys.exit(1) else: config_file = new_configuration_dialog.getConfigurationPath() dbase_type = new_configuration_dialog.getDBaseType() num_realizations = new_configuration_dialog.getNumberOfRealizations( ) storage_path = new_configuration_dialog.getStoragePath() EnKFMain.createNewConfig(config_file, storage_path, dbase_type, num_realizations) strict = False if os.path.isdir(config_file): print("The specified configuration file is a directory!") sys.exit(1) splash = ErtSplash() splash.version = "Version %s" % Version.getVersion() splash.timestamp = Version.getBuildTime() splash.show() splash.repaint() now = time.time() ert = EnKFMain(config_file, strict=strict, verbose=verbose) ert_gui.configureErtNotifier(ert, config_file) window = GertMainWindow() window.setWidget(SimulationPanel()) plugin_handler = PluginHandler(ert, ert.getWorkflowList().getPluginJobs(), window) help_tool = HelpTool("ERT", window) window.addDock("Configuration Summary", SummaryPanel(), area=Qt.BottomDockWidgetArea) window.addTool(IdeTool(os.path.basename(config_file), help_tool)) window.addTool(PlotTool()) window.addTool(ExportTool()) window.addTool(WorkflowsTool()) window.addTool(ManageCasesTool()) window.addTool(PluginsTool(plugin_handler)) window.addTool(RunAnalysisTool()) window.addTool(LoadResultsTool()) window.addTool(help_tool) sleep_time = 2 - (time.time() - now) if sleep_time > 0: time.sleep(sleep_time) window.show() splash.finish(window) window.activateWindow() window.raise_() finished_code = app.exec_() ert.free() sys.exit(finished_code)
def main(argv): app = QApplication(argv) # Early so that QT is initialized before other imports app.setWindowIcon(resourceIcon("application/window_icon_cutout")) if len(argv) == 1: config_file = QFileDialog.getOpenFileName(None, "Open Configuration File") config_file = str(config_file) if len(config_file) == 0: print("-----------------------------------------------------------------") print("-- You must supply the name of configuration file as the first --") print("-- commandline argument: --") print("-- --") print("-- bash% gert <config_file> --") print("-- --") print("-- If the configuration file does not exist, gert will create --") print("-- create a new configuration file. --") print("-----------------------------------------------------------------") sys.exit(1) else: config_file = argv[1] help_center = HelpCenter("ERT") help_center.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/") help_center.setHelpMessageLink("welcome_to_ert") strict = True verbose = False verbose_var = os.getenv("ERT_VERBOSE", "False") lower_verbose_var = verbose_var.lower() if lower_verbose_var == "true": verbose = True if not os.path.exists(config_file): print("Trying to start new config") new_configuration_dialog = NewConfigurationDialog(config_file) success = new_configuration_dialog.exec_() if not success: print("Can not run without a configuration file.") sys.exit(1) else: config_file = new_configuration_dialog.getConfigurationPath() dbase_type = new_configuration_dialog.getDBaseType() num_realizations = new_configuration_dialog.getNumberOfRealizations() storage_path = new_configuration_dialog.getStoragePath() EnKFMain.createNewConfig(config_file, storage_path, dbase_type, num_realizations) strict = False if os.path.isdir(config_file): print("The specified configuration file is a directory!") sys.exit(1) splash = ErtSplash() version = ErtVersion( ) splash.version = "Version %s" % version.versionString() splash.timestamp = version.getBuildTime() splash.show() splash.repaint() now = time.time() res_config = ResConfig(config_file) os.chdir( res_config.config_path ) ert = EnKFMain(res_config, strict=strict, verbose=verbose) ert_gui.configureErtNotifier(ert, config_file) window = GertMainWindow() window.setWidget(SimulationPanel()) plugin_handler = PluginHandler(ert, ert.getWorkflowList().getPluginJobs(), window) help_tool = HelpTool("ERT", window) window.addDock("Configuration Summary", SummaryPanel(), area=Qt.BottomDockWidgetArea) window.addTool(IdeTool(os.path.basename(config_file), help_tool)) window.addTool(PlotTool()) window.addTool(ExportTool()) window.addTool(WorkflowsTool()) window.addTool(ManageCasesTool()) window.addTool(PluginsTool(plugin_handler)) window.addTool(RunAnalysisTool()) window.addTool(LoadResultsTool()) window.addTool(help_tool) sleep_time = 2 - (time.time() - now) if sleep_time > 0: time.sleep(sleep_time) window.show() splash.finish(window) window.activateWindow() 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)