Example #1
0
    def showHelp(self):
        text_cursor = self.textCursor()
        user_data = text_cursor.block().userData()

        if user_data is not None:
            configuration_line = user_data.configuration_line

            if configuration_line.keyword().hasKeywordDefinition():
                HelpDock.setHelpMessageLink("config/" + configuration_line.documentationLink())
Example #2
0
    def __init__(self):
        """Constructor"""
        QMainWindow.__init__(self)

        self.resize(900, 700)
        self.setWindowTitle('gERT')

        self.tabs = QTabWidget()
        self.setCentralWidget(self.tabs)

        self.help_dock = HelpDock.getInstance()
        self.addDockWidget(Qt.RightDockWidgetArea, self.help_dock)


        self.__createMenu()
        self.save_function = None
        self.__fetchSettings()
Example #3
0
def main():
    QApplication.setGraphicsSystem("raster")
    app = QApplication(sys.argv)  # Early so that QT is initialized before other imports

    splash = QSplashScreen(resourceImage("newsplash"), Qt.WindowStaysOnTopHint)
    splash.show()
    splash.showMessage("Starting up...", Qt.AlignLeft, Qt.white)
    app.processEvents()

    HelpDock.setHelpLinkPrefix(os.getenv("ERT_SHARE_PATH") + "/gui/help/")

    splash.showMessage("Bootstrapping...", Qt.AlignLeft, Qt.white)
    app.processEvents()

    strict = True
    site_config = os.getenv("ERT_SITE_CONFIG")
    if len(sys.argv) == 1:
        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("-----------------------------------------------------------------")
    else:
        enkf_config = sys.argv[1]
        if not os.path.exists(enkf_config):
            print("Trying to start new config")
            new_configuration_dialog = NewConfigurationDialog(enkf_config)
            success = new_configuration_dialog.exec_()
            if not success:
                print("Can not run without a configuration file.")
                sys.exit(1)
            else:
                enkf_config = new_configuration_dialog.getConfigurationPath()
                firste_case_name = new_configuration_dialog.getCaseName()
                dbase_type = new_configuration_dialog.getDBaseType()
                num_realizations = new_configuration_dialog.getNumberOfRealizations()
                storage_path = new_configuration_dialog.getStoragePath()

                EnKFMain.createNewConfig(enkf_config, storage_path, firste_case_name, dbase_type, num_realizations)
                strict = False

        ert = EnKFMain(enkf_config, site_config=site_config, strict=strict)
        ErtConnector.setErt(ert)

        window = GertMainWindow()
        window.setSaveFunction(ert.saveConfig())

        splash.showMessage("Creating GUI...", Qt.AlignLeft, Qt.white)
        app.processEvents()

        simulation_panel = SimulationPanel()
        window.addTab(simulation_panel.getName(), simulation_panel)
        configuration_panel = ConfigurationPanel()
        window.addTab(configuration_panel.getName(), configuration_panel)

        splash.showMessage("Communicating with ERT...", Qt.AlignLeft, Qt.white)
        app.processEvents()

        window.show()
        splash.finish(window)

        HelpDock.setHelpMessageLink("welcome_to_ert")

        sys.exit(app.exec_())