From 3bac28c45c5a2d7fc5811a6fc3e467a8c3ee0d6f Mon Sep 17 00:00:00 2001 From: Dilawar Singh <dilawars@ncbs.res.in> Date: Fri, 25 May 2018 10:38:19 +0530 Subject: [PATCH] Squashed 'moose-gui/' changes from 76564f0873..3fd3739e86 3fd3739e86 From Editor Widget add plot of n or conc a15524b05e from runWidget plot can be added either n or conc and function can have Neutral as parent as compared to pool git-subtree-dir: moose-gui git-subtree-split: 3fd3739e86802afb217c540b0cf72cb268dd6242 --- mplot.py | 20 ++++++++++++++------ plugins/kkitViewcontrol.py | 12 ++++++++++++ plugins/modelBuild.py | 9 ++++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/mplot.py b/mplot.py index f198c4b7..7d753928 100644 --- a/mplot.py +++ b/mplot.py @@ -6,9 +6,9 @@ # Maintainer: # Created: Mon Mar 11 20:24:26 2013 (+0530) # Version: -# Last-Updated: Wed Jul 3 10:32:35 2013 (+0530) -# By: subha -# Update #: 309 +# Last-Updated: Wed Apr 11 15:32:35 2018 (+0530) +# By: Harsha +# Update #: # URL: # Keywords: # Compatibility: @@ -23,7 +23,7 @@ # # Change log: -# +# 2018 April 11: In chemical model, now pool can be ploted as number or concentration. # # # @@ -153,8 +153,16 @@ class CanvasWidget(FigureCanvas): # print "Mouse Position : ", pos modelRoot, element = event.mimeData().data if isinstance (element,moose.PoolBase): - tablePath = moose.utils.create_table_path(self.model, self.graph, element, "Conc") - table = moose.utils.create_table(tablePath, element, "Conc","Table2") + plotType = "Conc" + msgBox = QtGui.QMessageBox() + msgBox.setText('What to plot?') + msgBox.addButton(QtGui.QPushButton('Number'), QtGui.QMessageBox.YesRole) + msgBox.addButton(QtGui.QPushButton('Concentration'), QtGui.QMessageBox.NoRole) + ret = msgBox.exec_() + if ret == 0: + plotType = "N" + tablePath = moose.utils.create_table_path(self.model, self.graph, element, plotType) + table = moose.utils.create_table(tablePath, element, plotType,"Table2") # moose.connect(table, 'requestOut', element, 'getConc') self.updateSignal.emit() elif isinstance(element, moose.CompartmentBase): diff --git a/plugins/kkitViewcontrol.py b/plugins/kkitViewcontrol.py index 9f947cd9..255de612 100644 --- a/plugins/kkitViewcontrol.py +++ b/plugins/kkitViewcontrol.py @@ -432,8 +432,20 @@ class GraphicalView(QtGui.QGraphicsView): moose.Neutral(self.modelRoot+'/data') moose.Neutral(self.modelRoot+'/data/graph_0') self.graph = moose.element(self.modelRoot+'/data/graph_0') + plotType = "Conc" + msgBox = QtGui.QMessageBox() + msgBox.setText('What to plot?') + msgBox.addButton(QtGui.QPushButton('Number'), QtGui.QMessageBox.YesRole) + msgBox.addButton(QtGui.QPushButton('Concentration'), QtGui.QMessageBox.NoRole) + ret = msgBox.exec_() + if ret == 0: + plotType = "N" + tablePath = moose.utils.create_table_path(moose.element(self.modelRoot), self.graph, element, plotType) + table = moose.utils.create_table(tablePath, element, plotType,"Table2") + ''' tablePath = utils.create_table_path(moose.element(self.modelRoot), self.graph, element, "Conc") table = utils.create_table(tablePath, element, "Conc","Table2") + ''' self.layoutPt.plugin.view.getCentralWidget().plotWidgetContainer.plotAllData() reply = QtGui.QMessageBox.information(self, "plot Object","Plot is added to Graph1", QtGui.QMessageBox.Ok) diff --git a/plugins/modelBuild.py b/plugins/modelBuild.py index 25579bfd..260c8aff 100644 --- a/plugins/modelBuild.py +++ b/plugins/modelBuild.py @@ -5,7 +5,7 @@ __version__ = "1.0.0" __maintainer__ = "HarshaRani" __email__ = "hrani@ncbs.res.in" __status__ = "Development" -__updated__ = "Jul 27 2017" +__updated__ = "Apr 11 2018" import moose from kkitQGraphics import * @@ -137,14 +137,17 @@ def checkCreate(scene,view,modelpath,mobj,string,ret_string,num,event_pos,layout #moose.connect( funcObj, 'valueOut', mobj ,'setN' ) poolclass = ["ZombieBufPool","BufPool"] comptclass = ["CubeMesh","cyclMesh"] + if mobj.className in poolclass: funcParent = layoutPt.mooseId_GObj[element(mobj.path)] elif mobj.className in comptclass: funcParent = layoutPt.qGraCompt[moose.element(mobj)] posWrtComp = funcParent.mapFromScene(pos).toPoint() #posWrtComp = (itemAtView.mapFromScene(pos)).toPoint() + elif mobj.className in "Neutral": + funcParent = layoutPt.qGraGrp[element(mobj)] + qGItem = FuncItem(funcObj,funcParent) - #print " function ", posWrtComp.x(),posWrtComp.y() qGItem.setDisplayProperties(posWrtComp.x(),posWrtComp.y(),QtGui.QColor('red'),QtGui.QColor('green')) layoutPt.mooseId_GObj[funcObj] = qGItem #if mType == "new_kkit": @@ -273,7 +276,7 @@ def createObj(scene,view,modelpath,string,pos,layoutPt): ret_string,num = findUniqId(mobj,string,num) elif string == "Function": - mobj = findCompartment(mobj) + #mobj = findCompartment(mobj) ret_string,num = findUniqId(mobj,string,num) ''' if itemAt != None: -- GitLab