diff --git a/.travis.yml b/.travis.yml index e5a702f37df471de18bff7d57ab95c8aebdbe434..15779bf198d587255777bc0c0afe4c636ee06f89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,6 @@ notifications: install: - - sudo apt-get clean - - sudo apt-get update - wget http://download.opensuse.org/repositories/home:moose/xUbuntu_12.04/Release.key - sudo apt-key add - < Release.key - sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/moose/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/moose.list" diff --git a/PlotWidgetContainer.py b/PlotWidgetContainer.py index a9656203e3749a0f00b2917bb5555e4a46b5569f..f42e0a87e27ba9fe891b53344957d2f43a29b402 100644 --- a/PlotWidgetContainer.py +++ b/PlotWidgetContainer.py @@ -9,10 +9,10 @@ __author__ = "Aviral Goel" __credits__ = ["Upi Lab"] __license__ = "GPL3" __version__ = "1.0.0" -__maintainer__ = "Aviral Goel,HarshaRani" +__maintainer__ = "Aviral Goel" __email__ = "goel.aviral@gmail.com" __status__ = "Development" -__updated__ = "Feb 14 2017" + import sys import os @@ -49,8 +49,6 @@ class PlotWidgetContainer(QWidget): self.model = moose.element(self.modelRoot) if self.modelRoot != "/": - self.modelRoot = self.findModelPath(self.modelRoot) - if moose.exists(modelRoot + "/data"): self.data = moose.element(self.modelRoot + "/data") else: @@ -89,18 +87,6 @@ class PlotWidgetContainer(QWidget): if len(self.data.children) == 0: self.addPlotWidget() - def mooseIsInstance(self,element, classNames): - return moose.element(element).__class__.__name__ in classNames - - - def findModelPath(self,element): - child = element - while not self.mooseIsInstance(element, "Shell"): - child = moose.element(element).path - element = moose.element(element).parent - - return child - def deleteWidget(self, graphWidget): # print("Deleted => ", graphWidget) self.graphWidgets.remove(graphWidget) diff --git a/defaults.py b/defaults.py index ac591c81dfcebf2fd6c940d05a629077fe870d43..458f7b389e3f566a83ce0e2fc6c98cfaa3e1ac74 100644 --- a/defaults.py +++ b/defaults.py @@ -13,9 +13,6 @@ FIELD_UNITS={ 'Kd' : 'mM', 'Km':'mM', 'kcat':'s-1', - 'k1' :'1/# s', - 'k2' :'s-1', - 'k3' :'s-1', 'Vm':'V', 'conc':'mM', 'concInit':'mM', diff --git a/mgui.py b/mgui.py index b8574648e0528102c727f09fd66e940885cf813e..9f201303e2db36f325e27661637b37fbcfb7504a 100644 --- a/mgui.py +++ b/mgui.py @@ -6,9 +6,9 @@ # Maintainer: # Created: Mon Nov 12 09:38:09 2012 (+0530) # Version: -# Last-Updated: Sat Mar 7 13:47:33 2017 (+0530) +# Last-Updated: Fri Oct 30 11:54:33 2015 (+0530) # By: Harsha -# Update #: +# Update #: 1338 # URL: # Keywords: # Compatibility: @@ -206,7 +206,7 @@ class MWindow(QtGui.QMainWindow): ("Fig5A (20s)", "../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5A.py"), ("Fig5BCD (240s)" , "../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5BCD.py"), ("Fig6A (60s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/Fig6A.py" ), - ("ReducedModel (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), + ("Reduced6 (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), ("Squid" , "../moose-examples/squid/squid_demo.py") ]) layout.setContentsMargins(QtCore.QMargins(20,20,20,20)) @@ -246,7 +246,7 @@ class MWindow(QtGui.QMainWindow): button.setToolTip("<span style=\"color:black;\">Illustrates building a panel of multiscale models to test neuronal plasticity in different contexts</span>") elif k[0] == "Fig6A (60s)": button.setToolTip("<span style=\"color:black;\">This LIF network with Ca plasticity is based on: Memory Maintenance in Synapses with Calcium-Based Plasticity in the Presence of Background Activity PLOS Computational Biology, 2014</span>") - elif k[0] == "ReducedModel (200s)": + elif k[0] == "Reduced6 (200s)": button.setToolTip("<span style=\"color:black;\">This is the Reduced version of LIF network with Ca plasticity model based on: Memory Maintenance in Synapses with Calcium-Based Plasticity in the Presence of Background Activity PLOS Computational Biology, 2014</span>") elif k[0] == "Squid": button.setToolTip("<span style=\"color:black;\">squid Demo</span>") @@ -258,7 +258,7 @@ class MWindow(QtGui.QMainWindow): layout4.addWidget(button) elif k[0] in ["Fig5A (20s)","Fig5BCD (240s)"]: layout5.addWidget(button) - elif k[0] in ["Fig6A (60s)","ReducedModel (200s)"]: + elif k[0] in ["Fig6A (60s)","Reduced6 (200s)"]: layout6.addWidget(button) elif k[0] in ["Squid"]: layout7.addWidget(button) @@ -476,12 +476,11 @@ class MWindow(QtGui.QMainWindow): if name == 'kkit': self.objectEditDockWidget.objectNameChanged.connect(self.plugin.getEditorView().getCentralWidget().updateItemSlot) self.objectEditDockWidget.colorChanged.connect(self.plugin.getEditorView().getCentralWidget().updateColorSlot) - #self.plugin.objectSolverChanged.connect(self.plugin.mainWindow.objectEditClearSlot) self.setCurrentView('editor') freeCursor() return self.plugin - + def updateExistingMenu(self, menu): """Check if a menu with same title already exists. If so, update the same and return @@ -565,7 +564,7 @@ class MWindow(QtGui.QMainWindow): break if newSubWindow: subwin = self.mdiArea.addSubWindow(widget) - title = widget.modelRoot + title = widget.modelRoot+'/model' #subwin.setWindowTitle('%s: %s' % (view, widget.modelRoot)) subwin.setWindowTitle('%s: %s' % (view, title)) subwin.setSizePolicy(QtGui.QSizePolicy.Minimum | @@ -642,67 +641,24 @@ class MWindow(QtGui.QMainWindow): ("Fig5A (20s)", "../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5A.py"), ("Fig5BCD (240s)" , "../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5BCD.py"), ("Fig6A (60s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/Fig6A.py" ), - ("ReducedModel (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), + ("Reduced6 (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), ("Squid" , "../moose-examples/squid/squid_demo.py") ]) - - self.subMenu = QtGui.QMenu('Demos') + self.subMenu = QtGui.QMenu('Paper_2015_Demos') for i in range(0,len(self.menuitems)): k = self.menuitems.popitem(0) - if k[0] == "Fig2C (6s)": - self.Fig2Caction = QtGui.QAction('Fig2C (6s)', self) - self.Fig2Caction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig2_elecModels/Fig2C.py')) - self.subMenu.addAction(self.Fig2Caction) - elif k[0] == "Fig2D (35s)": - self.Fig2Daction = QtGui.QAction('Fig2D (35s)', self) - self.Fig2Daction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig2_elecModels/Fig2D.py')) - self.subMenu.addAction(self.Fig2Daction) - elif k[0] == "Fig2E (5s)": - self.Fig2Eaction = QtGui.QAction('Fig2E (5s)', self) - self.Fig2Eaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig2_elecModels/Fig2E.py')) - self.subMenu.addAction(self.Fig2Eaction) + t = "self."+k[0]+"Action" + t = QtGui.QAction(k[0],self) + self.subMenu.addAction(t) + if k[0] == "Fig3C_Gsl (2s)": + t.connect(t,QtCore.SIGNAL('triggered()'),lambda script = k[1]: self.run_genesis_script(script,"gsl")) elif k[0] == "Fig3B_Gssa (2s)": - self.Fig3B_Gssaaction = QtGui.QAction('Fig3B_Gssa (2s)', self) - self.Fig3B_Gssaaction.triggered.connect(lambda :self.run_genesis_script('../moose-examples/paper-2015/Fig3_chemModels/Fig3ABC.g',"gssa")) - self.subMenu.addAction(self.Fig3B_Gssaaction) - elif k[0] == "Fig3C_Gsl (2s)": - self.Fig3C_Gslaction = QtGui.QAction('Fig3C_Gsl (2s)', self) - self.Fig3C_Gslaction.triggered.connect(lambda :self.run_genesis_script('../moose-examples/paper-2015/Fig3_chemModels/Fig3ABC.g',"gsl")) - self.subMenu.addAction(self.Fig3C_Gslaction) - elif k[0] == "Fig3D (1s)": - self.Fig3Daction = QtGui.QAction('Fig3D (1s)', self) - self.Fig3Daction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig3_chemModels/Fig3D.py')) - self.subMenu.addAction(self.Fig3Daction) - elif k[0] == "Fig4B (10s)": - self.Fig4Baction = QtGui.QAction('Fig4B (10s)', self) - self.Fig4Baction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig4_ReacDiff/Fig4B.py')) - self.subMenu.addAction(self.Fig4Baction) - elif k[0] == "Fig4K": - self.Fig4Kaction = QtGui.QAction('Fig4K', self) - self.Fig4Kaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig4_ReacDiff/rxdSpineSize.py')) - self.subMenu.addAction(self.Fig4Kaction) - elif k[0] == "Fig5A (20s)": - self.Fig5Aaction = QtGui.QAction('Fig5A (20s)', self) - self.Fig5Aaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5A.py')) - self.subMenu.addAction(self.Fig5Aaction) - elif k[0] == "Fig5BCD (240s)": - self.Fig5BCDaction = QtGui.QAction('Fig5BCD (240s)', self) - self.Fig5BCDaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig5_CellMultiscale/Fig5BCD.py')) - self.subMenu.addAction(self.Fig5BCDaction) - elif k[0] == "Fig6A (60s)": - self.Fig6Aaction = QtGui.QAction('Fig6A (60s)', self) - self.Fig6Aaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig6_NetMultiscale/Fig6A.py')) - self.subMenu.addAction(self.Fig6Aaction) - elif k[0] == "ReducedModel (200s)": - self.ReducedModelaction = QtGui.QAction('ReducedModel (200s)', self) - self.ReducedModelaction.triggered.connect(lambda :self.run_python_script('../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py')) - self.subMenu.addAction(self.ReducedModelaction) + t.connect(t,QtCore.SIGNAL('triggered()'),lambda script = k[1]: self.run_genesis_script(script,"gssa")) else: - self.Squidaction = QtGui.QAction('Squid', self) - self.Squidaction.triggered.connect(lambda :self.run_python_script('../moose-examples/squid/squid_demo.py')) - self.subMenu.addAction(self.Squidaction) - + t.connect(t,QtCore.SIGNAL('triggered()'),lambda : self.run_python_script(k[1])) + self.subMenu.addAction(t) self.fileMenu.addMenu(self.subMenu) + if not hasattr(self,'loadedModels'): self.loadedModelAction = QtGui.QAction('Recently Loaded Models',self) self.loadedModelAction.setCheckable(False) @@ -1069,16 +1025,11 @@ class MWindow(QtGui.QMainWindow): ''' #Harsha: added visible=True so that loadModelDialogSlot and NewModelDialogSlot call this function # to clear out object path - def objectEditSlot(self, mobj, visible=True): """Slot for switching the current object in object editor.""" self.objectEditDockWidget.setObject(mobj) self.objectEditDockWidget.setVisible(visible) - # def objectEditClearSlot(self): - # #clearning the views which is stored - # self.objectEditDockWidget.clearDict() - def loadedModelsAction(self,modelPath,pluginName): #Harsha: added under file Menu, Recently Loaded Models #All the previously loaded chemical models, solver's and table's ticks are made -1 @@ -1154,27 +1105,20 @@ class MWindow(QtGui.QMainWindow): ret = [] ret,pluginName = self.checkPlugin(dialog) if pluginName == 'kkit': - if (ret['subtype'] == 'sbml' and ret['foundlib'] == False): - reply = QtGui.QMessageBox.question(self, "python-libsbml is not found.","\n Read SBML is not possible.\n This can be installed using \n \n pip python-libsbml or \n apt-get install python-libsbml", - QtGui.QMessageBox.Ok) - if reply == QtGui.QMessageBox.Ok: - QtGui.QApplication.restoreOverrideCursor() + compt = moose.wildcardFind(ret['model'].path+'/##[ISA=ChemCompt]') + if not len(compt): + reply = QtGui.QMessageBox.question(self, "Model is empty","Model has no compartment, atleast one compartment should exist to display the widget\n Do you want another file", + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) + if reply == QtGui.QMessageBox.Yes: + dialog = LoaderDialog(self,self.tr('Load model from file')) + if dialog.exec_(): + ret,pluginName = self.checkPlugin(dialog) + ret,valid = self.dialog_check(ret) + else: + QtGui.QApplication.restoreOverrideCursor() return else: - compt = moose.wildcardFind(ret['model'].path+'/##[ISA=ChemCompt]') - if not len(compt): - reply = QtGui.QMessageBox.question(self, "Model is empty","Model has no compartment, atleast one compartment should exist to display the widget\n Do you want another file", - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) - if reply == QtGui.QMessageBox.Yes: - dialog = LoaderDialog(self,self.tr('Load model from file')) - if dialog.exec_(): - ret,pluginName = self.checkPlugin(dialog) - ret,valid = self.dialog_check(ret) - else: - QtGui.QApplication.restoreOverrideCursor() - return - else: - valid = True + valid = True if valid == True: modelAnno = moose.Annotator(ret['model'].path+'/info') if ret['subtype']: @@ -1214,7 +1158,6 @@ class MWindow(QtGui.QMainWindow): #ret = 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']) @@ -1222,8 +1165,7 @@ class MWindow(QtGui.QMainWindow): pluginName = subtype_plugin_map['%s/%s' % (ret['modeltype'], ret['subtype'])] except KeyError: pluginName = 'default' - if ret['foundlib']: - print ('Loaded model %s' %(ret['model'].path)) + print 'Loaded model', ret['model'].path return ret,pluginName def dialog_check(self,ret): diff --git a/mload.py b/mload.py index 8ee50546ee9c7ebcc1ed554b4d1a8ca8d3ab984e..257daa9410909a3fb8eb877afdf8ef7ff7d125b5 100644 --- a/mload.py +++ b/mload.py @@ -119,8 +119,6 @@ def loadFile(filename, target, solver="gsl", merge=True): modelroot: root element of the model, None if could not be located - as is the case with Python scripts """ num = 1 - libsfound = True - model = '/' newTarget = target while moose.exists(newTarget): newTarget = target + "-" + str(num) @@ -231,8 +229,7 @@ def loadFile(filename, target, solver="gsl", merge=True): # app.restoreOverrideCursor() return {'modeltype': modeltype, 'subtype': subtype, - 'model': model, - 'foundlib' :libsfound} + 'model': model} # diff --git a/objectedit.py b/objectedit.py index b76257efd3800afe0eb3e85cb25569e7fcccaec8..a98294cc3f3fa619651e8ccf70f011bba1122810 100644 --- a/objectedit.py +++ b/objectedit.py @@ -193,7 +193,7 @@ class ObjectEditModel(QtCore.QAbstractTableModel): def setData(self, index, value, role=QtCore.Qt.EditRole): if not index.isValid() or index.row () >= len(self.fields) or index.column() != 1: return False - + print(value) field = self.fields[index.row()] if (role == QtCore.Qt.CheckStateRole): if (index.column() == 1): @@ -236,18 +236,8 @@ class ObjectEditModel(QtCore.QAbstractTableModel): else: oldValue = self.mooseObject.getField(field) - if field != "isBuffered": - value = type(oldValue)(value) - self.mooseObject.setField(field, value) - else: - if self.mooseObject.className == "ZombiePool" or self.mooseObject.className =="ZombieBufPool": - QtGui.QMessageBox.warning(None,'Solver is set, Could not set the value','\n Unset the solver by clicking \n run widget -> Preferences -> Exponential Euler->Apply') - else: - if value.lower() in ("yes", "true", "t", "1"): - self.mooseObject.setField(field, True) - else: - self.mooseObject.setField(field, False) - + value = type(oldValue)(value) + tt = self.mooseObject.setField(field, value) self.undoStack.append((index, oldValue)) if field == 'name': self.emit(QtCore.SIGNAL('objectNameChanged(PyQt_PyObject)'), self.mooseObject) @@ -257,7 +247,7 @@ class ObjectEditModel(QtCore.QAbstractTableModel): return True def undo(self): - print ('Undo') + print 'Undo' if len(self.undoStack) == 0: raise Info('No more undo information') index, oldvalue, = self.undoStack.pop() @@ -427,7 +417,7 @@ class ObjectEditView(QtGui.QTableView): self.setColor(getColor(self.model().mooseObject.path+'/info')[1]) except: pass - print ('Created view with %s' %(mobject)) + print 'Created view with', mobject def setColor(self, color): self.colorButton.setStyleSheet( @@ -472,8 +462,6 @@ class ObjectEditDockWidget(QtGui.QDockWidget): # self.view.colorDialog.colorSelected.connect(self.colorChangedEmit) - # def clearDict(self): - # self.view_dict.clear() def setObject(self, mobj): element = moose.element(mobj) diff --git a/plugins/kkit.py b/plugins/kkit.py index 9c8f96ec5eb70f44c76b1e95c147f936d14fe591..68bfd85ee77dcfb1a38c00ffea00e794363bc74a 100644 --- a/plugins/kkit.py +++ b/plugins/kkit.py @@ -34,7 +34,6 @@ from setsolver import * class KkitPlugin(MoosePlugin): """Default plugin for MOOSE GUI""" - #objectSolverChanged = pyqtSignal() def __init__(self, *args): #print args MoosePlugin.__init__(self, *args) @@ -90,7 +89,7 @@ class KkitPlugin(MoosePlugin): writeerror,consistencyMessages,writtentofile = moose.SBML.mooseWriteSBML(self.modelRoot,str(filename),self.coOrdinates) if writeerror == -2: #QtGui.QMessageBox.warning(None,'Could not save the Model','\n WriteSBML : This copy of MOOSE has not been compiled with SBML writing support.') - QtGui.QMessageBox.warning(None,'python-libsbml is not found',consistencyMessages) + QtGui.QMessageBox.warning(None,'Could not save the Model',consistencyMessages) elif writeerror == -1: QtGui.QMessageBox.warning(None,'Could not save the Model','\n This model is not valid SBML Model, failed in the consistency check') elif writeerror == 1: @@ -233,7 +232,6 @@ class AnotherKkitRunView(RunView): reinit = addSolver(modelRoot,solver) if reinit: self.getSchedulingDockWidget().widget().resetSimulation() - #self.plugin.objectSolverChanged.emit() #self.kkitRunView.getCentralWidget().addSolver(solver) @@ -519,15 +517,12 @@ class KineticsWidget(EditorWidgetBase): for funcObj in find_index(memb,'function'): funcinfo = moose.element(funcObj).path+'/info' - poolt = ["ZombieBufPool","BufPool","ZombiePool","Pool"] - if funcObj.parent.className in poolt: + if funcObj.parent.className == "ZombieBufPool" or funcObj.parent.className == "BufPool": funcinfo = moose.element(funcObj).path+'/info' Af = Annotator(funcinfo) funcParent =self.mooseId_GObj[element(funcObj.parent)] - elif funcObj.parent.className == "CubeMesh" or funcObj.parent.className == "CylMesh": funcParent = self.qGraCompt[cmpt] - funcItem = FuncItem(funcObj,funcParent) self.mooseId_GObj[element(funcObj.getId())] = funcItem self.setupDisplay(funcinfo,funcItem,"Function") @@ -571,14 +566,12 @@ class KineticsWidget(EditorWidgetBase): if bgcolor.name() == "#ffffff" or bgcolor == "white": bgcolor = getRandColor() Annoinfo.color = str(bgcolor.name()) - if isinstance(self,kineticEditorWidget): funct = ["Function","ZombieFunction"] comptt = ["CubeMesh","CylMesh"] if objClass in funct: - poolt = ["ZombieBufPool","BufPool","ZombiePool","Pool"] - + poolt = ["ZombieBufPool","BufPool"] if graphicalObj.mobj.parent.className in poolt: xpos = 0 ypos = 30 @@ -586,7 +579,7 @@ class KineticsWidget(EditorWidgetBase): xpos,ypos = self.positioninfo(info) else: xpos,ypos = self.positioninfo(info) - + self.xylist = [xpos,ypos] self.xyCord[moose.element(info).parent] = [xpos,ypos] @@ -595,7 +588,6 @@ class KineticsWidget(EditorWidgetBase): editorItem = self.editormooseId_GObj[moose.element(info).parent] xpos = editorItem.scenePos().x() ypos = editorItem.scenePos().y() - #Annoinfo.x = xpos #Annoinfo.y = -ypos graphicalObj.setDisplayProperties(xpos,ypos,textcolor,bgcolor) @@ -621,13 +613,13 @@ class KineticsWidget(EditorWidgetBase): if isinstance(out,tuple): src = self.mooseId_GObj[inn] if len(out[0])== 0: - print (inn.className + ' : ' +inn.name+ " doesn't output message") + print inn.className + ' : ' +inn.name+ " doesn't output message" else: for items in (items for items in out[0] ): des = self.mooseId_GObj[element(items[0])] self.lineCord(src,des,items,itemignoreZooming) if len(out[1]) == 0: - print (inn.className + ' : ' +inn.name+ " doesn't output message") + print inn.className + ' : ' +inn.name+ " doesn't output message" else: for items in (items for items in out[1] ): des = self.mooseId_GObj[element(items[0])] @@ -635,9 +627,9 @@ class KineticsWidget(EditorWidgetBase): elif isinstance(out,list): if len(out) == 0: if inn.className == "StimulusTable": - print( inn.name +" doesn't have output") + print inn.name +" doesn't have output" elif inn.className == "ZombieFunction" or inn.className == "Function": - print (inn.name + " doesn't have sumtotal ") + print inn.name + " doesn't have sumtotal " else: src = self.mooseId_GObj[inn] for items in (items for items in out ): @@ -648,7 +640,7 @@ class KineticsWidget(EditorWidgetBase): endtype = type_no[1] line = 0 if (src == "") and (des == ""): - print ("Source or destination is missing or incorrect") + print "Source or destination is missing or incorrect" return srcdes_list = [src,des,endtype,line] arrow = calcArrow(srcdes_list,itemignoreZooming,self.iconScale) @@ -661,7 +653,7 @@ class KineticsWidget(EditorWidgetBase): line = line +1 if type_no[2] > 5: - print ("Higher order reaction will not be displayed") + print "Higher order reaction will not be displayed" def drawLine(self,srcdes_list,arrow): src = srcdes_list[0] @@ -996,7 +988,7 @@ if __name__ == "__main__": try: filepath = '../../Demos/Genesis_files/'+modelPath+'.g' filepath = '/home/harsha/genesis_files/gfile/'+modelPath+'.g' - print( "%s" %(filepath)) + print filepath f = open(filepath, "r") loadModel(filepath,'/'+modelPath) @@ -1012,6 +1004,6 @@ if __name__ == "__main__": except IOError, what: (errno, strerror) = what - print ("Error number",errno,"(%s)" %(strerror)) + print "Error number",errno,"(%s)" %strerror sys.exit(0) sys.exit(app.exec_()) diff --git a/plugins/kkitCalcArrow.py b/plugins/kkitCalcArrow.py index 3b46a2c80502383b12429f3185eb1aef0d053212..e11ebe3ff29d3110751239f00782dd1f260143ed 100644 --- a/plugins/kkitCalcArrow.py +++ b/plugins/kkitCalcArrow.py @@ -1,6 +1,6 @@ from PyQt4.QtGui import QPolygonF from PyQt4.QtCore import QLineF,QPointF -from math import sin,cos,atan2,radians +import math from kkitQGraphics import PoolItem #, ReacItem,EnzItem,CplxItem,ComptItem ''' One to need to pass the source, destination,endtype and order for drawing the arrow between 2 object \ @@ -46,9 +46,9 @@ def calcArrow(srcdes_list,itemignoreZooming,iconScale): dy = desRect.center().y()- srcRect.center().y() dx0 = dy dy0 = -dx - tetha1 = (atan2(dy0,dx0)) - a0 = 4 *(cos(tetha1)) - b0 = 4 *(sin(tetha1)) + tetha1 = (math.atan2(dy0,dx0)) + a0 = 4 *(math.cos(tetha1)) + b0 = 4 *(math.sin(tetha1)) ''' Higher order ( > 4) connectivity will not be done''' if ((order == 3) or (order == 4)): a0 = a0*2 @@ -154,9 +154,9 @@ def calcLineRectIntersection(rect, centerLine): def arrowHead(srcAngle,degree,lineSpoint,iconScale): ''' arrow head is calculated ''' r = 8*iconScale - delta = radians(srcAngle) + radians(degree) - width = sin(delta)*r - height = cos(delta)*r + delta = math.radians(srcAngle) + math.radians(degree) + width = math.sin(delta)*r + height = math.cos(delta)*r srcXArr = (lineSpoint.x() + width) srcYArr = (lineSpoint.y() + height) return srcXArr,srcYArr diff --git a/plugins/kkitOrdinateUtil.py b/plugins/kkitOrdinateUtil.py index cb2c1f866d0873a04eba4c9293541915d5de40c1..cdd23bc7d1af6539e7bd077620f78488e023eed3 100644 --- a/plugins/kkitOrdinateUtil.py +++ b/plugins/kkitOrdinateUtil.py @@ -1,19 +1,5 @@ -__author__ = "HarshaRani" -__credits__ = ["Upi Lab"] -__license__ = "GPL3" -__version__ = "1.0.0" -__maintainer__ = "HarshaRani" -__email__ = "hrani@ncbs.res.in" -__status__ = "Development" -__updated__ = "Feb 14 2017" - from moose import * import numpy as np -from moose import wildcardFind,element,PoolBase,CplxEnzBase,Annotator,exists -import numpy as np -import networkx as nx -from networkx.drawing.nx_agraph import graphviz_layout - def setupMeshObj(modelRoot): ''' Setup compartment and its members pool,reaction,enz cplx under self.meshEntry dictionaries \ @@ -173,8 +159,6 @@ def autoCoordinates(meshEntry,srcdesConnection): print " kkit Ordinatesutil autoCoordinates " G = nx.Graph() - #G = pgv.AGraph() - positionInfo = {} for cmpt,memb in meshEntry.items(): for enzObj in find_index(memb,'enzyme'): #G.add_node(enzObj.path) diff --git a/plugins/kkitQGraphics.py b/plugins/kkitQGraphics.py index bbab5983ffa407da094ecfb3052061138c500883..b0bb4338871e106d8cee4094dc8c187d1ac22454 100644 --- a/plugins/kkitQGraphics.py +++ b/plugins/kkitQGraphics.py @@ -1,13 +1,3 @@ - -__author__ = "HarshaRani" -__credits__ = ["Upi Lab"] -__license__ = "GPL3" -__version__ = "1.0.0" -__maintainer__ = "HarshaRani" -__email__ = "hrani@ncbs.res.in" -__status__ = "Development" -__updated__ = "Mar 7 2017" - #import sys #sys.path.insert(0, '/home/harsha/trunk/gui') import config @@ -15,7 +5,6 @@ from PyQt4 import QtGui, QtCore, Qt from moose import * from PyQt4.QtGui import QPixmap, QImage, QGraphicsPixmapItem from constants import * -from os import path class KineticsDisplayItem(QtGui.QGraphicsWidget): """Base class for display elemenets in kinetics layout""" @@ -71,9 +60,7 @@ class FuncItem(KineticsDisplayItem): def __init__(self, mobj, parent): super(FuncItem, self).__init__(mobj, parent) self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True) - #self.funcImage = QImage('icons/classIcon/Function.png').scaled(15,33) - iconmap_file = (path.join(config.settings[config.KEY_ICON_DIR], 'classIcon/Function.png')) - self.funcImage = QImage(iconmap_file).scaled(15,33) + self.funcImage = QImage('icons/classIcon/Function.png').scaled(15,33) self.bg = QtGui.QGraphicsRectItem(self) self.bg.setAcceptHoverEvents(True) self.gobj = QtGui.QGraphicsPixmapItem(QtGui.QPixmap.fromImage(self.funcImage),self.bg) @@ -87,12 +74,11 @@ class FuncItem(KineticsDisplayItem): def setDisplayProperties(self,x,y,textcolor,bgcolor): """Set the display properties of this item.""" - #With Respect to BufPool (as parent which is in old genesis) then function are placed at 0,30 (which is below the BufPool) + #With Respect to BuffPool (as parent which is in old genesis) then function are placed at 0,30 (which is below the BuffPool) #else if droped from the GUI then placed wrt position #self.setGeometry(0, 30,self.gobj.boundingRect().width(),self.gobj.boundingRect().height()) #self.setGeometry(x,y) - poolt = ["ZombieBufPool","BufPool","ZombiePool","Pool"] - if self.gobj.mobj.parent.className in poolt: + if self.gobj.mobj.parent.className == "ZombieBufPool" or self.gobj.mobj.parent.className == "BufPool": self.setGeometry(0, 30,self.gobj.boundingRect().width(),self.gobj.boundingRect().height()) else: self.setGeometry(x,y,self.gobj.boundingRect().width(),self.gobj.boundingRect().height()) @@ -197,9 +183,6 @@ class PoolItem(KineticsDisplayItem): #This func will adjust the background color with respect to text size self.gobj.setText(self.mobj.name) self.bg.setRect(0, 0, self.gobj.boundingRect().width()+PoolItem.fontMetrics.width(' '), self.gobj.boundingRect().height()) - self.setGeometry(self.pos().x(),self.pos().y(),self.gobj.boundingRect().width() - +PoolItem.fontMetrics.width(''), - self.gobj.boundingRect().height()) def updateColor(self,bgcolor): self.bg.setBrush(QtGui.QBrush(QtGui.QColor(bgcolor))) @@ -495,9 +478,7 @@ class ComptItem(QtGui.QGraphicsRectItem): self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, True); self.setFlag(QtGui.QGraphicsItem.ItemIsSelectable) - #self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) - QT_VERSION = str(QtCore.QT_VERSION_STR).split('.') - QT_MINOR_VERSION = int(QT_VERSION[1]) + #self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) if config.QT_MINOR_VERSION >= 6: self.setFlag(QtGui.QGraphicsItem.ItemSendsGeometryChanges, 1) ''' diff --git a/plugins/modelBuild.py b/plugins/modelBuild.py index 2fc00342e2fae32e98ebfa991529e7e6eb471ed3..406e0d2a4360a08c0489f25c2f9a782839a3bb2d 100644 --- a/plugins/modelBuild.py +++ b/plugins/modelBuild.py @@ -25,7 +25,7 @@ def checkCreate(scene,view,modelpath,mobj,string,ret_string,num,event_pos,layout # modelRoot = modelpath[0:modelpath.find('/',1)] # else: # modelRoot = modelpath - #print "28 ",modelpath + print "28 ",modelpath if moose.exists(modelpath+'/info'): mType = moose.Annotator((moose.element(modelpath+'/info'))).modeltype itemAtView = view.sceneContainerPt.itemAt(view.mapToScene(event_pos)) @@ -318,4 +318,4 @@ def findCompartment(mooseObj): elif isinstance(mooseObj,ChemCompt): return (mooseObj) else: - return findCompartment(moose.element(mooseObj.parent)) \ No newline at end of file + return findCompartment(moose.element(mooseObj.parent))