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
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