Example #1
0
def showProperties(node, nodetype, parent=None):
    parent = parent or tool.getToolWindow()
    data = PropManager().getData(nodetype)

    widgets = {}
    for p in data['PROPERTIES']:
        name = p['name']
        w = createPropWidget(node, p)
        if p['type'] in ["String", "Integer", "Float"]:
            w.set_editable(False)
        elif p['type'] not in ["Table"]:
            w.set_sensitive(False)
        widgets[name] = w

    if data['LAYOUT']:
        layout = {}
        for k,v in data['LAYOUT'][0].items():
            if type(v)==type([]):
                layout[k] = v
            else:
                layout[k] = [i.rstrip().lstrip() for i in v.split(",")]
    else: layout = {}
    
    c = quickui.createLayout(layout, widgets)
    quickui.showDialog(c, parent=parent)
Example #2
0
def openProject():
    value=project.getRepository()
    file = quickui.createWidget(quickid="projectpath", description="Open Project", type = "QFileChooser", action="diropen",value=value)
    f = quickui.showDialog(file, parent=tool.getToolWindow())
    if not f:
        return
    project.openProject(f)
Example #3
0
def checkOutputFile(out={},key=None,status=False,errmsg=None):
    parent=tool.getToolWindow()

    if int(out['zip_opt']):
       status = quickui.runWithProgressDialog(parent,'Zipping',zip_File,pulse=True,key=key,output=out)

    if not status or (not os.path.isfile(out[key]) and not os.path.isfile(out[key]+'.gz') ):
       quickui.error(message=errmsg)
       raise IOError(errmsg)
Example #4
0
def showAbout(parent=None):
    about = gtk.AboutDialog()
    parent = parent or tool.getToolWindow()
    print parent
    about.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
    about.set_parent_window(parent)

    image = gtk.gdk.pixbuf_new_from_file(resource.getResource("resource:logo.xpm"))
    about.set_logo(image)
    quickui.setIcon(about)
    about.set_program_name("HiFUN")
    about.set_version("1.0")
    about.set_authors(["Nikhil Shende","Rohan W", "Vikrant Patil"])
    about.set_website("http://www.sandi.co.in")
    about.run()
    about.destroy()
Example #5
0
def runWizard():

    parent = tool.getToolWindow()
    outputs=wizard.runWizard(hifun.project.projectimport, parent = parent)

    if outputs:
        projectname=outputs['FileChoosingPage']['projectname']
        mshfile=outputs['FileChoosingPage']['mshfile']
        bcs = outputs['allbcs']
	scale=str(outputs['Scale']['scale'])
#        cellzone = [(item[0], list(item[1])) for item in outputs['CellzoneOptionPage']['cellzone']]
	cellzone=[]
        for item in outputs['CellzoneOptionPage']['cellzone']:
		if item[1] == None:
 		       cellzone.append((item[0], None))
		else:
 		       cellzone.append((item[0], list(item[1])))
        zip_choice = str(int(outputs['FileChoosingPage']['zip']))

	interface=[]
        if 'InterfacePairPage' in outputs and 'IList' in outputs['InterfacePairPage']:
                ipair = outputs['InterfacePairPage']['IList']
		print ipair
            	for item in outputs['InterfacePairPage']['IList']:
		    if item[1]:
		       for k in item[1]:
		          if ((item[0], k) not in interface) and ((k, item[0]) not in interface):
			     interface.append((item[0], k))


        p=project.Project(projectname,mshfile,bcs,cellzone, outputs['dimension'],zip_choice,scale,interface)

        write_msh2geo(p,outputs)

        p.save()

        projectutils.addProject(p)

	file=open('hifunerr.log','w')
        file.write("HIFUN log file"+'\n')
        file.write("=============="+'\n')
	file.close()
Example #6
0
def executeSerialPreprocessor(p,output): 

    exeList=[executeMsh,executeTwo2Three,executeArea,executeNsupport,executeMinDist,executeFsupport,executeGraph]

    errMsgList=['Unable to execute .msh to .geo convertor.','Unable to convert to 3D from 2D.','Unable to finish Geometric parameters computation.','Unable to finish Node Cell  support computation.','Unable to finish Minimum distance computation','Unable to finish Cell support computation.','Unable to finish Graph computation']

    labelList=['msh Convertor','2D to 3D Convertor','Compute Area','Node cell support computation','Minimum distance computation','Cell support computation','Graph computation']

    out={}

    set_Serial_Preprocess_Data(x=out,p=p)

    parent=tool.getToolWindow()

    os.chdir(out['path'])

    for i in range(len(exeList)):
       if output['dimension']=='2' and exeList[i].func_name=='executeTwo2Three':
          processExecution(parent=parent,label=labelList[i],exe=exeList[i], pulse=False,errmsg=errMsgList[i],out=out)
       elif not exeList[i].func_name == 'executeTwo2Three':
          processExecution(parent=parent,label=labelList[i],exe=exeList[i], pulse=False,errmsg=errMsgList[i],out=out)

    os.chdir(out['cexepath'])
Example #7
0
File: run.py Project: ro21han/hifun
def createRun(project=None):
    p = project or projectutils.getActiveProject()

    if p.runs:
        i = 1
        name = "Default_Run" + str(i)
        while name in p.runs:
            i = i + 1
            name = "Default_Run" + str(i)
    else:
        name = "Default_Run"

    runname = quickui.createWidget(quickid="run", description="Name of Run", type="String", value=name)
    subdomains = quickui.createWidget(type="Integer", quickid="subdomains", value=2, description="Number of Subdomains")
    group=quickui.createWidget(type="Group", quickid="rundetails" ,components=[runname,subdomains])
    v = quickui.showDialog(group, parent=tool.getToolWindow())

    if not v:
        return

    preprocess.executeParallelPreprocessor(p,v['subdomains'])
    p.createRun(runname=v['run'], subdomains = v['subdomains'])
    p.save()
    return v['run']
Example #8
0
File: run.py Project: ro21han/hifun
def editRun(project=None, runname=None):
    p = project or projectutils.getActiveProject()
    runname = runname or p.activerun
    p.setActiveRun(runname)
    treepath = os.path.join(p[runname]['path'], "run.tree")
    runTree = common.parseTree(treepath, root=runname)
    projectconfigpath = p['projectdir']
    response = quickui.showConfigurationTree(title=runname, tree=runTree, savespace=p[runname]['path'], parent=tool.getToolWindow())
    p.save()
Example #9
0
def executeParallelPreprocessor(p,subds):

    out={}
    out['no_of_subds']=str(subds)

    parent = tool.getToolWindow()

    set_Parallel_Preprocess_Data(x=out,p=p)

    os.chdir(out['path'])

    if subds < 2:
       quickui.error(message='Number of subdomains are less than 2. Unable to Execute.')
       raise ValueError
    
    metis=os.path.join(const.home,"Third_Party/METIS/kmetis")

    if not metis:
       quickui.error(message='KMETIS not found. Unable to proceed')
       raise RuntimeError

    if os.path.exists(out['subd_dir']):
       msg="Subdomain Directory "+out['subd_dir']+" is already available. Do you want to overwrite?."
       subd=quickui.question(message=msg)
       if subd == -8:
	  shutil.rmtree(out['subd_dir'])
       else:
          return
 
    if out['graphfile'].endswith('.gz'):
       out['graphfile']=unzip_File(out['graphfile'])
      
    quickui.runWithProgressDialog(parent, "METIS", executeMetis, pulse=True, output=out)

    if int(out['zip_opt']):
       quickui.runWithProgressDialog(parent, "Zipping", zip_File, pulse=True, key='graphfile',output=out)
       #zip_File(key='graphfile',output=out,task=None)

    if not os.path.isfile(out['partfile']):
       quickui.error(message='Unable to create part file.')
       raise IOError

    if int(out['zip_opt']):
       quickui.runWithProgressDialog(parent, "Zipping", zip_File, pulse=True, key='partfile',output=out)
       #out['partfile']=zip_File(out['partfile'])


    if not os.path.isfile(out['cellzone_file']):
       quickui.error(message='cellzone.dat file not found in project directory. Unable to proceed.')
       raise IOError
 
    os.mkdir(out['subd_dir'])

    if not os.path.exists(out['subd_dir']):
       msg="Unable to create Subdomain Directory "+out['subd_dir']+"."
       subd=quickui.info(message=msg)
       raise OSError("Unable to create Subdomain Directory")
            
    os.chdir(out['subd_dir'])

    quickui.runWithProgressDialog(parent, "FEP", executeFEP, pulse=False,output=out)

    ps=re.compile(('SUBDOMAIN.'))

    slist=os.listdir(os.getcwd())
    lst=[]
    for item in slist:
       if re.match(ps,item):
          lst.append(item)

    if len(lst) != int(out['no_of_subds']):
       quickui.error(message='Unable to create SUBDOMAINS.')
       shutil.rmtree(out['subd_dir'])
       raise IOError

    os.chdir(out['cexepath'])
Example #10
0
def showToolOptions():
    savespace = getConfSaveSpace()
    treepath = resource.getResource("resource:tooloptions.tree")
    optionTree = common.parseTree(treepath, root="Options")
    quickui.showConfigurationTree(title="Tool Options", tree=optionTree, parent=tool.getToolWindow(), savespace=savespace)