Пример #1
0
def petram(reload_scripts = False):
    '''
    setup PetraM simulation enveroment
    '''
    from __main__ import ifig_app    
    proj = ifig_app.proj
    if proj.setting.parameters.hasvar('PetraM'):
        model = proj.setting.parameters.eval('PetraM')
    else:
        try:
            model = proj.model1.mfem
            scripts = model.scripts
            from ifigure.mto.hg_support import has_repo
            if has_repo(scripts):
                scripts.onHGturnoff(evt=None, confirm = False)
                model.param.setvar('remote', None)
            reload_scripts = True
        except:
            model = load_petra_model(proj)
    if reload_scripts:
        scripts = model.scripts
        for name, child in scripts.get_children():
            child.destroy()
        scripts.clean_owndir()
        import_project_scripts(scripts)

    if model is not None:
        model.scripts.helpers.open_gui()
        proj.setting.parameters.setvar('PetraM', '='+model.get_full_path())
    return PetraMHelper()
Пример #2
0
 def classimage(self):        
     if PyModel._image_load_done is False:
        PyModel._image_id=self.load_classimage()
        PyModel._image_load_done=True
     if has_repo(self):
        return PyModel._image_id[1]
     else:
        return PyModel._image_id[0]
Пример #3
0
 def classimage(self):        
     if PyFolder._image_load_done is False:
        PyFolder._image_id=self.load_classimage()
        PyFolder._image_load_done=True
     if has_repo(self):
        return PyFolder._image_id[1]
     elif self.getvar('ext_folder') is not None:
        return PyFolder._image_id[2]           
     else:
        return PyFolder._image_id[0]