Ejemplo n.º 1
0
    def createCaseList(self):
        """Creates a list that enables the creation of new cases. Removal has been disabled."""
        cases = KeywordList(self, "", "init/case_list")

        cases.newKeywordPopup = lambda list : ValidatedDialog(cases, "New case", "Enter name of new case:", list).showAndTell()
        cases.addRemoveWidget.enableRemoveButton(False)  #todo: add support for removal
        cases.list.setMaximumHeight(150)


        def create_case(ert, cases):
            fs = ert.main.get_fs

            for case in cases:
                if not ert.main.fs_exists(case):
                    ert.main.select_fs(case)
                    break

            self.currentCase.updateList(self.get_case_list(ert))
            self.currentCase.fetchContent()
            self.casesUpdated()

        cases.getter = self.get_case_list
        cases.initialize = self.get_case_list
        cases.setter = create_case

        return cases
Ejemplo n.º 2
0
    def createCaseList(self):
        """Creates a list that enables the creation of new cases. Removal has been disabled."""
        cases = KeywordList(self, "", "init/case_list")

        cases.newKeywordPopup = lambda list : ValidatedDialog(cases, "New case", "Enter name of new case:", list).showAndTell()
        cases.addRemoveWidget.enableRemoveButton(False)  #todo: add support for removal
        cases.list.setMaximumHeight(150)

        cases.initialize = lambda ert : [ert.prototype("long enkf_main_get_fs(long)"),
                                         ert.prototype("void enkf_main_select_case(long , char*)"), 
                                         ert.prototype("long enkf_fs_alloc_dirlist(long)")]

        def create_case(ert, cases):
            fs = ert.enkf.enkf_main_get_fs(ert.main)

            for case in cases:
                if not ert.enkf.enkf_fs_has_dir(fs, case):
                    ert.enkf.enkf_fs_select_write_dir(fs, case, True)
                    break

            self.currentCase.updateList(self.get_case_list(ert))
            self.currentCase.fetchContent()
            self.casesUpdated()

        cases.getter = self.get_case_list
        cases.setter = create_case

        return cases
Ejemplo n.º 3
0
Archivo: eclipse.py Proyecto: rolk/ert
def createEclipsePage(configPanel, parent):
    configPanel.startPage("Eclipse")

    r = configPanel.addRow(PathChooser(parent, "Eclipse Base", "config/eclipse/eclbase", path_format=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_eclbase(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_eclbase(ert.main , str(value))

    r = configPanel.addRow(PathChooser(parent, "Data file", "config/eclipse/data_file", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_data_file(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_data_file(ert.main , str(value))

    r = configPanel.addRow(PathChooser(parent, "Grid", "config/eclipse/grid", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_gridfile(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_grid(ert.ecl_config, str(value))

    r = configPanel.addRow(PathChooser(parent, "Schedule file" , "config/eclipse/schedule_file" , show_files = True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_schedule_file(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_schedule_file(ert.ecl_config, str(value))


    r = configPanel.addRow(PathChooser(parent, "Init section", "config/eclipse/init_section", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_init_section(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_set_init_section(ert.ecl_config, str(value))


    r = configPanel.addRow(PathChooser(parent, "Refcase", "config/eclipse/refcase", show_files=True))
    r.getter = lambda ert : ert.enkf.ecl_config_get_refcase_name(ert.ecl_config)
    r.setter = lambda ert, value : ert.enkf.ecl_config_load_refcase(ert.ecl_config, str(value))

    r = configPanel.addRow(PathChooser(parent, "Schedule prediction file", "config/eclipse/schedule_prediction_file", show_files=True))
    r.getter = lambda ert : ert.enkf.enkf_main_get_schedule_prediction_file(ert.main)
    r.setter = lambda ert, value : ert.enkf.enkf_main_set_schedule_prediction_file(ert.main, ert.nonify( value ))

    r = configPanel.addRow(KeywordTable(parent, "Data keywords", "config/eclipse/data_kw"))
    r.getter = lambda ert : ert.getSubstitutionList(ert.enkf.enkf_main_get_data_kw(ert.main))

    def add_data_kw(ert, listOfKeywords):
        ert.enkf.enkf_main_clear_data_kw(ert.main)

        for keyword in listOfKeywords:
            ert.enkf.enkf_main_add_data_kw(ert.main, keyword[0], keyword[1])

    r.setter = add_data_kw



    configPanel.addSeparator()

    internalPanel = ConfigPanel(parent)

    internalPanel.startPage("Static keywords")

    r = internalPanel.addRow(KeywordList(parent, "", "config/eclipse/add_static_kw"))
    r.getter = lambda ert : ert.getStringList(ert.enkf.ecl_config_get_static_kw_list(ert.ecl_config))

    def add_static_kw(ert, listOfKeywords):
        ert.enkf.ecl_config_clear_static_kw(ert.ecl_config)

        for keyword in listOfKeywords:
            ert.enkf.ecl_config_add_static_kw(ert.ecl_config, keyword)

    r.setter = add_static_kw

    internalPanel.endPage()

    # todo: add support for fixed length schedule keywords
    #internalPanel.startPage("Fixed length schedule keywords")
    #
    #r = internalPanel.addRow(KeywordList(widget, "", "add_fixed_length_schedule_kw"))
    #r.getter = lambda ert : ert.getAttribute("add_fixed_length_schedule_kw")
    #r.setter = lambda ert, value : ert.setAttribute("add_fixed_length_schedule_kw", value)
    #
    #internalPanel.endPage()

    configPanel.addRow(internalPanel)

    configPanel.endPage()