From e565756c912bf1c4638873bda5fccbe9bdf47b7b Mon Sep 17 00:00:00 2001 From: HarshaRani <ranishashi@gmail.com> Date: Fri, 14 Apr 2017 16:43:13 +0530 Subject: [PATCH] Squashed 'moose-gui/' changes from 2a1f94f..6104940 6104940 units added to k1,k2,k3 a3a80bf Using force-yes with -y to avoid problem with gpg keys. Probably breaking due to policy change in apt install. c994d93 one more attempt -y is removed b869143 one more attempt expired key a172670 checking with travis expired key 8ee7c22 checking with travis expired key a208321 travis has a problem installing moose with -y opition trying this ff92eb5 print stm with python3 and changes made WRT to pool and bufpool with isBuffered flag 744f262 isbuffered is editable and if value is set/unset a46cec9 cleanup in demo, filemenu links git-subtree-dir: moose-gui git-subtree-split: 61049405f17b22f27c74e7834dc1b2cfbab61699 --- .travis.yml | 6 ++- defaults.py | 3 ++ mgui.py | 86 +++++++++++++++++++++++++++++++--------- objectedit.py | 24 ++++++++--- plugins/kkit.py | 30 +++++++++----- plugins/kkitQGraphics.py | 15 ++++++- plugins/modelBuild.py | 12 +++--- 7 files changed, 131 insertions(+), 45 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e29a484..111481f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,14 @@ 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" - sudo apt-get -y update - - sudo apt-get install python3 - - sudo apt-get -y install moose + - sudo apt-get -y --force-yes install python3 + - sudo apt-get -y --force-yes install moose script: - # Making sure no python incompatible file is added. diff --git a/defaults.py b/defaults.py index 6551d2d9..4ab8008f 100644 --- a/defaults.py +++ b/defaults.py @@ -12,6 +12,9 @@ FIELD_UNITS={ 'volume':'m3', '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 30790dd3..0226db50 100644 --- a/mgui.py +++ b/mgui.py @@ -6,9 +6,9 @@ # Maintainer: # Created: Mon Nov 12 09:38:09 2012 (+0530) # Version: -# Last-Updated: Tue Feb 14 15:20:33 2017 (+0530) +# Last-Updated: Sat Mar 7 13:47:33 2017 (+0530) # By: Harsha -# Update #: 1338 +# Update #: # 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" ), - ("Reduced6 (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), + ("ReducedModel (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] == "Reduced6 (200s)": + elif k[0] == "ReducedModel (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)","Reduced6 (200s)"]: + elif k[0] in ["Fig6A (60s)","ReducedModel (200s)"]: layout6.addWidget(button) elif k[0] in ["Squid"]: layout7.addWidget(button) @@ -476,11 +476,12 @@ 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 @@ -641,24 +642,67 @@ 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" ), - ("Reduced6 (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), + ("ReducedModel (200s)", "../moose-examples/paper-2015/Fig6_NetMultiscale/ReducedModel.py"), ("Squid" , "../moose-examples/squid/squid_demo.py") ]) - self.subMenu = QtGui.QMenu('Paper_2015_Demos') + + self.subMenu = QtGui.QMenu('Demos') for i in range(0,len(self.menuitems)): k = self.menuitems.popitem(0) - 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")) + 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) elif k[0] == "Fig3B_Gssa (2s)": - t.connect(t,QtCore.SIGNAL('triggered()'),lambda script = k[1]: self.run_genesis_script(script,"gssa")) + 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) else: - t.connect(t,QtCore.SIGNAL('triggered()'),lambda : self.run_python_script(k[1])) - self.subMenu.addAction(t) + 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) + self.fileMenu.addMenu(self.subMenu) - if not hasattr(self,'loadedModels'): self.loadedModelAction = QtGui.QAction('Recently Loaded Models',self) self.loadedModelAction.setCheckable(False) @@ -1025,11 +1069,16 @@ 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 @@ -1148,6 +1197,7 @@ 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']) @@ -1156,7 +1206,7 @@ class MWindow(QtGui.QMainWindow): except KeyError: pluginName = 'default' if ret['foundlib']: - print 'Loaded model', ret['model'].path + print ('Loaded model %s' %(ret['model'].path)) return ret,pluginName def dialog_check(self,ret): diff --git a/objectedit.py b/objectedit.py index 2545a1e2..8e59eb07 100644 --- a/objectedit.py +++ b/objectedit.py @@ -6,7 +6,7 @@ # Maintainer: # Created: Wed Jun 30 11:18:34 2010 (+0530) # Version: -# Last-Updated: Wed Aug 3 15:55:59 2016 (+0530) +# Last-Updated: Tue Mar 7 12:45:59 2017 (+0530) # By: Harsha # Update #: # URL: @@ -188,7 +188,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): @@ -231,8 +231,18 @@ class ObjectEditModel(QtCore.QAbstractTableModel): else: oldValue = self.mooseObject.getField(field) - value = type(oldValue)(value) - tt = self.mooseObject.setField(field, value) + 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) + self.undoStack.append((index, oldValue)) if field == 'name': self.emit(QtCore.SIGNAL('objectNameChanged(PyQt_PyObject)'), self.mooseObject) @@ -242,7 +252,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() @@ -401,7 +411,7 @@ class ObjectEditView(QtGui.QTableView): self.setColor(getColor(self.model().mooseObject.path+'/info')[1]) except: pass - print 'Created view with', mobject + print ('Created view with %s' %(mobject)) def setColor(self, color): self.colorButton.setStyleSheet( @@ -446,6 +456,8 @@ 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 8709044a..83cd224f 100644 --- a/plugins/kkit.py +++ b/plugins/kkit.py @@ -6,7 +6,7 @@ __version__ = "1.0.0" __maintainer__ = "HarshaRani" __email__ = "hrani@ncbs.res.in" __status__ = "Development" -__updated__ = "Feb 14 2017" +__updated__ = "Mar 7 2017" import sys from PyQt4 import QtGui, QtCore, Qt @@ -33,6 +33,7 @@ from setsolver import * class KkitPlugin(MoosePlugin): """Default plugin for MOOSE GUI""" + #objectSolverChanged = pyqtSignal() def __init__(self, *args): #print args MoosePlugin.__init__(self, *args) @@ -250,6 +251,7 @@ class AnotherKkitRunView(RunView): reinit = addSolver(modelRoot,solver) if reinit: self.getSchedulingDockWidget().widget().resetSimulation() + #self.plugin.objectSolverChanged.emit() #self.kkitRunView.getCentralWidget().addSolver(solver) @@ -552,12 +554,15 @@ class KineticsWidget(EditorWidgetBase): for funcObj in find_index(memb,'function'): funcinfo = moose.element(funcObj).path+'/info' - if funcObj.parent.className == "ZombieBufPool" or funcObj.parent.className == "BufPool": + poolt = ["ZombieBufPool","BufPool","ZombiePool","Pool"] + if funcObj.parent.className in poolt: 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") @@ -597,12 +602,14 @@ 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"] + if graphicalObj.mobj.parent.className in poolt: xpos = 0 ypos = 30 @@ -610,7 +617,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] @@ -619,6 +626,7 @@ 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) @@ -662,13 +670,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])] @@ -676,9 +684,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 ): @@ -689,7 +697,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) @@ -702,7 +710,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] @@ -1037,7 +1045,7 @@ if __name__ == "__main__": try: filepath = '../../Demos/Genesis_files/'+modelPath+'.g' filepath = '/home/harsha/genesis_files/gfile/'+modelPath+'.g' - print filepath + print( "%s" %(filepath)) f = open(filepath, "r") loadModel(filepath,'/'+modelPath) @@ -1053,6 +1061,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/kkitQGraphics.py b/plugins/kkitQGraphics.py index 27ddbe35..2487100c 100644 --- a/plugins/kkitQGraphics.py +++ b/plugins/kkitQGraphics.py @@ -1,3 +1,13 @@ + +__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 @@ -75,11 +85,12 @@ class FuncItem(KineticsDisplayItem): def setDisplayProperties(self,x,y,textcolor,bgcolor): """Set the display properties of this item.""" - #With Respect to BuffPool (as parent which is in old genesis) then function are placed at 0,30 (which is below the BuffPool) + #With Respect to BufPool (as parent which is in old genesis) then function are placed at 0,30 (which is below the BufPool) #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) - if self.gobj.mobj.parent.className == "ZombieBufPool" or self.gobj.mobj.parent.className == "BufPool": + poolt = ["ZombieBufPool","BufPool","ZombiePool","Pool"] + if self.gobj.mobj.parent.className in poolt: 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()) diff --git a/plugins/modelBuild.py b/plugins/modelBuild.py index 471d8e9e..27e57a12 100644 --- a/plugins/modelBuild.py +++ b/plugins/modelBuild.py @@ -25,16 +25,16 @@ 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 - print " 1 event_pos ",event_pos + #print " 1 event_pos ",event_pos itemAtView = view.sceneContainerPt.itemAt(view.mapToScene(event_pos)) - print "2 ",itemAtView + #print "2 ",itemAtView pos = view.mapToScene(event_pos) - print " 3 ",pos + #print " 3 ",pos modelpath = moose.element(modelpath) - print " model path @34 ",modelpath + #print " model path @34 ",modelpath if num: string_num = ret_string+str(num) else: @@ -297,4 +297,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)) -- GitLab