Example #1
0
    def connectBioModel(self):
        connecttoBioModel = BioModelsClientWidget()
        if connecttoBioModel.exec_():
            pass
        filepath = connecttoBioModel.filePath
        if filepath:
            head, fileName = os.path.split(filepath)
            modelName = os.path.splitext(fileName)[0]
            pwe = moose.getCwe()
            ret = mload.loadFile(str(filepath), '/model/%s' % (modelName), merge=False)
            self.objectEditSlot('/',False)
            pluginLookup = '%s/%s' % (ret['modeltype'], ret['subtype'])
            try:
                pluginName = subtype_plugin_map['%s/%s' % (ret['modeltype'], ret['subtype'])]
            except KeyError:
                pluginName = 'default'
            self._loadedModels.append([ret['model'].path,pluginName])
            if len(self._loadedModels)>5:
                self._loadedModels.pop(0)

            if not moose.exists(ret['model'].path+'/info'):
                    moose.Annotator(ret['model'].path+'/info')

            modelAnno = moose.Annotator(ret['model'].path+'/info')
            if ret['subtype']:
                modelAnno.modeltype = ret['subtype']
            else:
                modelAnno.modeltype = ret['modeltype']
            modelAnno.dirpath = str(dialog.directory().absolutePath())
            self.loadedModelsAction(ret['model'].path,pluginName)
            self.setPlugin(pluginName, ret['model'].path)
Example #2
0
 def run_genesis_script(self, filepath, solver):
     if self.popup:
         self.popup.hide()
     abspath = os.path.abspath(filepath)
     directory, modulename = os.path.split(abspath)
     modelName = os.path.splitext(modulename)[0]
     ret = mload.loadFile(str(abspath),'%s' %(modelName),solver,merge=False)
     self.setPlugin("kkit", ret["model"].path)
     self.setCurrentView("run")        
     widget = self.plugin.view.getSchedulingDockWidget().widget()
     widget.runSimulation()
Example #3
0
 def checkPlugin(self,dialog):
     fileNames = dialog.selectedFiles()
     for fileName in fileNames:
         modelName = dialog.getTargetPath()
         if '/' in modelName:
             raise mexception.ElementNameError('Model name cannot contain `/`')
         ret = mload.loadFile(str(fileName),'%s' %(modelName),merge=False)
         #ret = mload.loadFile(str(fileName), '/model/%s' % (modelName), merge=False)
         #This will clear out object editor's objectpath and make it invisible
         self.objectEditSlot('/',False)
         #if subtype is None, in case of cspace then pluginLookup = /cspace/None
         #     which will not call kkit plugin so cleaning to /cspace
         pluginLookup = '%s/%s' % (ret['modeltype'], ret['subtype'])
         try:
             pluginName = subtype_plugin_map['%s/%s' % (ret['modeltype'], ret['subtype'])]
         except KeyError:
             pluginName = 'default'
         print(('Loaded model', ret['model'].path))
         return ret,pluginName