def createPreferences(): """Automatically called for building preferences""" prefs = AG.AsterPreferences() root = prefs.build_root(u"Code Aster default settings") frame = root.add_frame("Solver settings") frame.add(AG.SaveBaseResult) frame.add(AG.InteractiveFollowUp) frame = root.add_frame("Tools") frame.add(AG.EditorCommand)
def add_case(self, name): """Add the Aster study case with the given name. 'command-file' and 'mesh' fields must be registered""" mod = self._mod std = mod.give_aster_study() prefs = aster_s_gui.AsterPreferences() case = std.add_case(self.find_new_name(std, name)) case.use(aster_s.CommFile(self.get_str("command-file"))) case.use(aster_s.SMeshEntry(self.give_field("mesh").node.entry)) if prefs.get(aster_s_gui.InteractiveFollowUp): case.use(aster_s.InteractivFollowUp())
def edit_as_text(mod, comm_file): """Edit as a text file""" fname = comm_file.read_fname() if fname: pref = aster_s_gui.AsterPreferences() editor_cmd = pref.get(aster_s_gui.EditorCommand) if editor_cmd == "": mess = u"The editor command is not defined " \ u"for the Aster module in File -> Preferences." mod.launch(ERROR, mess) return cmd = [editor_cmd, fname] try: popen = SP.Popen(cmd) except OSError: mess = u"The editor command '%s' has failed" % u" ".join(cmd) mod.launch(ERROR, mess)
def __init__(self, mod): StudyCaseDialog.__init__(self, mod) self._name.setText("new_case") self._params.set_default(aster_s.build_default_cfg(), aster_s_gui.AsterPreferences()) self._slv_selection.query_astk_servers()