|
From: <mor...@us...> - 2011-01-20 11:56:11
|
Revision: 3892
http://ecell.svn.sourceforge.net/ecell/?rev=3892&view=rev
Author: moriyoshi
Date: 2011-01-20 11:56:01 +0000 (Thu, 20 Jan 2011)
Log Message:
-----------
* Make session monitor reloadable.
Modified Paths:
--------------
ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/FullPNQueue.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/GtkSessionMonitor.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/InterfaceWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/LoggerWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/MainWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoPluginManager.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/OsogoPluginWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/Plot.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/StepperWindow.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/VariableReferenceEditor.py
ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/opengui.py
ecell3/trunk/ecell/frontend/session-monitor/glade/EntityListWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/BargraphWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/DigitalWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.glade
ecell3/trunk/ecell/frontend/session-monitor/plugins/PropertyWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/TracerWindow.py
ecell3/trunk/ecell/frontend/session-monitor/plugins/VariableWindow.py
ecell3/trunk/ecell/pyecell/ecell/EntityStub.py
ecell3/trunk/ecell/pyecell/ecell/LoggerStub.py
ecell3/trunk/ecell/pyecell/ecell/ObjectStub.py
ecell3/trunk/ecell/pyecell/ecell/Session.py
ecell3/trunk/ecell/pyecell/ecell/_ecs.cpp
ecell3/trunk/ecell/pyecell/ecell/ecs.py
ecell3/trunk/ecell/pyecell/ecell/ecssupport.py
ecell3/trunk/ecell/pyecell/ecell/eml.py
ecell3/trunk/ecell/pyecell/ecell/emparser.py
ecell3/trunk/ecell/pyecell/ecell3-session.in
Removed Paths:
-------------
ecell3/trunk/ecell/frontend/session-monitor/glade/FullPNQueue.glade
Modified: ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py
===================================================================
--- ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/model-editor/ecell/ui/model_editor/LayoutEml.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -578,9 +578,8 @@
aFullPN = createFullPN( aFullPNString )
- aPropertyName = aFullPN[3]
- aFullID = createFullIDString( convertFullPNToFullID( aFullPN ) )
- anEntityPropertyNode = self.__getEntityPropertyNode( aFullID, aPropertyName )
+ aFullID, aPropertyName = convertFullPNToFullID( aFullPN )
+ anEntityPropertyNode = self.__getEntityPropertyNode( createFullIDString( aFullID ), aPropertyName )
return self.__createValueList( anEntityPropertyNode )
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/DataGenerator.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -27,6 +27,7 @@
from random import *
from numpy import *
+from ecell.ecssupport import *
import gtk
import gtk.gdk
@@ -48,7 +49,7 @@
DP_MAX = 4
DP_MIN = 3
-class DataGenerator:
+class DataGenerator( object ):
'''
DataGenerator class
get new data from the source, Logger or Core,
@@ -72,7 +73,7 @@
def hasLogger( self, aFullPNString ):
- return aFullPNString in self.__theSession.theSimulator.getLoggerList()
+ return aFullPNString in self.__theSession.getLoggerList()
@@ -83,12 +84,13 @@
dataList = zeros( (0,5), LOGGER_TYPECODE )
xAxis = aDataSeries.getXAxis()
fullPNString = aDataSeries.getFullPNString()
- currentTime = self.__theSession.theSimulator.getCurrentTime()
+ aFullID, aPropertyName = convertFullPNToFullID( createFullPN( fullPNString ) )
+ currentTime = self.__theSession.getCurrentTime()
if xAxis == "Time":
if not self.hasLogger( fullPNString ):
- currentValue = self.__theSession.theSimulator.getEntityProperty( fullPNString )
+ currentValue = self.__theSession.getEntityProperty( fullPNString )
dataList = zeros( (1,5), LOGGER_TYPECODE )
dataList[0][0] = currentTime
dataList[0][1] = currentValue
@@ -98,14 +100,17 @@
else:
dataList = aDataSeries.getAllData()
- lastTime = dataList[ len( dataList) -1 ][0]
+ if len( dataList ) > 0:
+ lastTime = dataList[ -1 ][ 0 ]
+ else:
+ lastTime = 0.
dataRange = currentTime - lastTime
requiredResolution = dataPointWidth
- if (dataRange/ requiredResolution)>100:
- requiredResolution = dataRange/100
+ if (dataRange / requiredResolution) > 100:
+ requiredResolution = dataRange / 100
dataList = self.theLoggerAdapter.getData( fullPNString,
- lastTime, currentTime,requiredResolution )
+ lastTime, currentTime, requiredResolution )
# I havent yet updated the new logger code from CVS, but isn't changed to getDigest?
@@ -117,8 +122,8 @@
else: #xaxis is fullpn, so this dataseries is used for phase plotting
- x = self.__theSession.theSimulator.getEntityProperty( xAxis )
- y = self.__theSession.theSimulator.getEntityProperty( fullPNString )
+ x = self.__theSession.getEntityProperty( xAxis )
+ y = self.__theSession.getEntityProperty( fullPNString )
dataList = zeros( (1,5), LOGGER_TYPECODE )
dataList[0][0] = x
dataList[0][1] = y
@@ -164,36 +169,34 @@
aRandom = Random()
if self.hasLogger( fullPNString ) and self.hasLogger( xAxis ):
- aSimulator = self.__theSession.theSimulator
- yStartTime = aSimulator.getLoggerStartTime( fullPNString )
- yWalker = LoggerWalker( aSimulator, fullPNString )
- xWalker = LoggerWalker( aSimulator, xAxis )
- xSize = aSimulator.getLoggerSize( xAxis )
-
+ yStartTime = self.theLoggerAdapter.getStartTime( fullPNString )
+ xAxisLogger = self.theLoggerAdapter.getLogger( xAxis )
+ yWalker = LoggerWalker( self.theLoggerAdapter.getLogger( fullPNString ) )
+ xWalker = LoggerWalker( xAxisLogger )
xstartpoint = xWalker.findPrevious( yStartTime )
- if xstartpoint != 1:
+ if xstartpoint is not -1:
writeCache = zeros( ( CACHE_INCREMENT, 5 ) )
writeIndex = 0
readIndex = 0
xPoint = xWalker.getNext()
- while xPoint != 1:
- if aRandom.randint( 0, xSize ) < HISTORY_SAMPLE:
+ while xPoint is not 1:
+ if aRandom.randint( 0, xAxisLogger.getSize() ) < HISTORY_SAMPLE:
aTime = xPoint[DP_TIME]
yPoint1 = yWalker.findPrevious( aTime )
- if yPoint1 == 1:
+ if yPoint1 is 1:
break
newDataPoint = zeros( ( 5 ) )
newDataPoint[DP_TIME] = xPoint[DP_VALUE]
if yPoint1[DP_TIME] != aTime:
while True:
- yPoint2 = yWalker.getNext( )
- if yPoint2 == 1:
+ yPoint2 = yWalker.getNext()
+ if yPoint2 is 1:
break
if yPoint2[DP_TIME] > yPoint1[DP_TIME]:
break
- if yPoint2 == 1:
+ if yPoint2 is 1:
break
# interpolate
lowerTime = yPoint1[DP_TIME]
@@ -262,48 +265,44 @@
aCachedLogger.update()
- def getData( self, fullPNString, start, end, interval ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- ret = self.theCachedLoggerDict[ fullPNString ].getData( start, end, interval )
- return ret
+ def getData( self, fullPNString, start, end, interval=None ):
+ return self.getLogger( fullPNString ).getData( start, end, interval )
-
def getStartTime( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getStartTime( )
+ return self.getLogger( fullPNString ).getStartTime()
def getEndTime( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getEndTime( )
+ return self.getLogger( fullPNString ).getEndTime()
def getSize( self, fullPNString ):
- if fullPNString not in self.theCachedLoggerDict.keys():
- self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
- return self.theCachedLoggerDict[ fullPNString ].getSize( )
+ return getLogger( fullPNString ).getSize()
-class CachedLogger:
+ def getLogger( self, fullPNString ):
+ aLogger = self.theCachedLoggerDict.get( fullPNString, None )
+ if aLogger is None:
+ aLogger = self.theCachedLoggerDict[ fullPNString ] = CachedLogger( self.theSession, fullPNString )
+ return aLogger
+
+class CachedLogger( object ):
def __init__( self, aSession, fullPNString ):
- self.theFullPNString = fullPNString
- self.theSimulator = aSession.theSimulator
- if fullPNString not in self.theSimulator.getLoggerList():
- aSession.createLoggerWithPolicy( fullPNString )
+ self.theLoggerStub = aSession.createLoggerStub( fullPNString )
+ if fullPNString not in aSession.getLoggerList():
+ self.theLoggerStub.setLoggerPolicy( aSession.getLogPolicyParameters() )
+ self.theLoggerStub.create()
self.theLoggerCacheList = []
self.cachedTill = 0.0
self.update()
def update( self ):
# calculate how many points should be read
- loggerSize = self.theSimulator.getLoggerSize( self.theFullPNString )
- startTime = self.theSimulator.getLoggerStartTime( self.theFullPNString )
- endTime = self.theSimulator.getLoggerEndTime( self.theFullPNString )
+ loggerSize = self.theLoggerStub.getSize()
+ startTime = self.theLoggerStub.getStartTime()
+ endTime = self.theLoggerStub.getEndTime()
if loggerSize == 0:
averageDistance = -1
else:
@@ -320,19 +319,17 @@
readStart = self.cachedTill
if startTime == endTime:
+ dataPoints = self.theLoggerStub.getData()
- dataPoints = self.theSimulator.getLoggerData( self.theFullPNString )
-
valueColumn = take( dataPoints , (1, ), 1 )
dataPoints = concatenate( ( dataPoints, valueColumn, valueColumn, valueColumn ) , 1 )
self.theLoggerCacheList[0].addPoints( dataPoints )
else:
- while ( readStart < endTime ):
-
+ while readStart < endTime:
readEnd = min( readFrame, endTime - readStart ) + readStart
- dataPoints = self.theSimulator.getLoggerData( self.theFullPNString, readStart, readEnd )
+ dataPoints = self.theLoggerStub.getData( readStart, readEnd )
valueColumn = take( dataPoints , (1, ), 1 )
dataPoints = concatenate( ( dataPoints, valueColumn, valueColumn, valueColumn ) , 1 )
@@ -351,45 +348,41 @@
i += 1
- def getData( self, start, end, interval ):
- if interval == 0:
- vectorLength = 1
- else:
+ def getData( self, start, end, interval=None ):
+ if interval is not None:
+ if start == end:
+ return ndarray( shape=( 0, 5 ) )
vectorLength = int( ( end - start ) / interval )
- i = len( self.theLoggerCacheList ) -1
- while i >= 0:
- aDistance = self.theLoggerCacheList[i].getAverageDistance()
- cacheStart = self.theLoggerCacheList[i].getStartTime()
- cacheEnd = self.theLoggerCacheList[i].getEndTime()
- if aDistance > 0 and \
- self.theLoggerCacheList[i].getSize() > vectorLength and \
- aDistance <= interval /3 :
+ i = len( self.theLoggerCacheList ) -1
+ while i >= 0:
+ aDistance = self.theLoggerCacheList[i].getAverageDistance()
+ cacheStart = self.theLoggerCacheList[i].getStartTime()
+ cacheEnd = self.theLoggerCacheList[i].getEndTime()
+ if aDistance > 0 and \
+ self.theLoggerCacheList[i].getSize() > vectorLength and \
+ aDistance <= interval / 3:
# start >= cacheStart and end<= cacheEnd and
# return self.theLoggerCacheList[i].getData( start, end, interval )
- a=self.theLoggerCacheList[i].getData( start, end, interval )
- return a
- i -= 1
- # use logger
+ return self.theLoggerCacheList[i].getData( start, end, interval )
+ i -= 1
+ return array( self.theLoggerStub.getData( start, end, interval ), copy=False)
+ else:
+ return array( self.theLoggerStub.getData( start, end ), copy=False )
-# return self.theSimulator.getLoggerData(self.theFullPNString, start, end, interval )
- a=self.theSimulator.getLoggerData(self.theFullPNString, start, end, interval )
- return a
-
-
def getStartTime( self ):
- return self.theSimulator.getLoggerStartTime(self.theFullPNString)
+ return self.theLoggerStub.getStartTime()
def getEndTime( self ):
- return self.theSimulator.getLoggerEndTime(self.theFullPNString)
+ return self.theLoggerStub.getEndTime()
def getSize( self ):
- return self.theSimulator.getLoggerSize(self.theFullPNString)
+ return self.theLoggerStub.getSize()
-class LoggerCache:
+class LoggerCache( object ):
def __init__( self ):
self.theCache = zeros( ( 0, 5 ), LOGGER_TYPECODE )
@@ -453,12 +446,7 @@
def getData( self, start, end, interval ):
-
- vectorLength = ( end - start ) / interval
-
- if vectorLength > int( vectorLength ):
- vectorLength += 1
- vectorLength = int(vectorLength )
+ vectorLength = int( ceil( ( end - start ) / interval ) )
aVector = zeros( ( vectorLength, 5 ), LOGGER_TYPECODE )
timeCounter = start
lastPoint = self.theCache[ self.cacheEnd - 1 ]
@@ -499,17 +487,15 @@
return 0
-class LoggerWalker:
-
- def __init__( self, aSimulator, aFullPN):
- self.theSimulator = aSimulator
- self.theFullPN = aFullPN
- self.theStart = aSimulator.getLoggerStartTime( aFullPN )
- self.theEnd = aSimulator.getLoggerEndTime( aFullPN )
- size = aSimulator.getLoggerSize( aFullPN )
+class LoggerWalker( object ):
+ def __init__( self, aLogger ):
+ self.theLogger = aLogger
+ self.theStart = aLogger.getStartTime()
+ self.theEnd = aLogger.getEndTime()
+ size = aLogger.getSize()
self.theAvgDistance = ( self.theEnd - self.theStart ) / size
self.cachedTill = -1
- self.theCache = zeros( ( 0,5 ) )
+ self.theCache = zeros( ( 0, 5 ) )
self.index = 0
self.__readCache()
@@ -523,8 +509,8 @@
else:
readStart = self.cachedTill
readEnd = min( self.theAvgDistance * int(READ_CACHE/2), self.theEnd - self.cachedTill ) + readStart
- newPoints = self.theSimulator.getLoggerData( self.theFullPN, readStart, readEnd )
- if len( self.theCache) > 0:
+ newPoints = self.theLogger.getData( readStart, readEnd )
+ if len( self.theCache ) > 0:
halfIndex = int(len(self.theCache) /2 )
self.index = len( self.theCache ) - halfIndex
self.theCache = concatenate( ( self.theCache[ halfIndex: ], newPoints ) )
@@ -562,4 +548,4 @@
# smaller then what logger contains
return -1
self.index = nextIndex
- return self.getNext( )
+ return self.getNext()
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/EntityListWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -88,6 +88,8 @@
self.thePropertyWindow = None
self.thePluginInstanceSelection = None
+ self.theAssociatedSession = None
+
def openWindow( self ):
@@ -100,21 +102,13 @@
# add handers
self.addHandlers( {
- # system tree
- # 'on_system_tree_cursor_changed' :\
- # self.updateSystemSelection,\
- 'on_system_tree_button_press_event' : self.popupMenu,\
- # entity list
- # 'on_process_tree_cursor_changed': self.selectProcess,\
- # 'on_variable_tree_cursor_changed':self.selectVariable,\
-
- 'on_view_button_clicked': self.createPluginWindow,\
- 'on_variable_tree_button_press_event': self.popupMenu,\
- 'on_process_tree_button_press_event': self.popupMenu,\
+ 'on_system_tree_button_press_event' : self.popupMenu,
+ 'on_view_button_clicked': self.createPluginWindow,
+ 'on_variable_tree_button_press_event': self.popupMenu,
+ 'on_process_tree_button_press_event': self.popupMenu,
# search
- 'on_search_button_clicked': self.pushSearchButton,\
- 'on_search_entry_key_press_event':\
- self.keypressOnSearchEntry,\
+ 'on_search_button_clicked': self.pushSearchButton,
+ 'on_search_entry_key_press_event': self.keypressOnSearchEntry,
'on_clear_button_clicked': self.pushClearButton,
'on_search_scope_changed': self.searchScopeChanged
} )
@@ -131,51 +125,36 @@
# initialize components
# --------------------------------------------
self.__initializeSystemTree()
- self.systemTreeConstructed = False
- if self.theSession.theModelWalker != None:
- self.reconstructSystemTree()
-
self.__initializeProcessTree()
self.__initializeVariableTree()
self.__initializeSelection()
self.__initializePluginWindowOptionMenu()
- aFullPN = convertFullIDToFullPN( createFullID ( 'System::/' ) )
- self.theQueue = FullPNQueue( self["navigator_area"] , [ aFullPN ] )
-
- self.theQueue.registerCallback( self.doSelection )
+ self.theQueue = None
self.__initializePropertyWindow()
self.__initializePopupMenu()
- # --------------------------------------------
- # initialize buffer
- # --------------------------------------------
self.theSelectedEntityList = []
self.theSelectedPluginInstanceList = []
- # --------------------------------------------
- # initialize Add to Board button
- # --------------------------------------------
self.CloseOrder = False
self.updateButtons()
-
-
-
-
-
def updateButtons( self ):
- if ( self.theSession.theModelWalker != None ):
+ if self.theSession.theSession is not None:
self['search_button'].set_sensitive(True)
self['view_button'].set_sensitive(True)
self['search_entry'].set_sensitive(True)
self['plugin_optionmenu'].set_sensitive(True)
-
+ self['backbutton'].set_sensitive(False)
+ self['forwardbutton'].set_sensitive(False)
else:
- self['search_button'].set_sensitive(0)
- self['view_button'].set_sensitive(0)
- self['search_entry'].set_sensitive(0)
- self['plugin_optionmenu'].set_sensitive(0)
+ self['search_button'].set_sensitive(False)
+ self['view_button'].set_sensitive(False)
+ self['search_entry'].set_sensitive(False)
+ self['plugin_optionmenu'].set_sensitive(False)
+ self['backbutton'].set_sensitive(False)
+ self['forwardbutton'].set_sensitive(False)
def getQueue( self ):
@@ -330,13 +309,9 @@
def __initializePropertyWindow( self ):
if self.thePropertyWindow != None:
return
- self.thePropertyWindow= self.thePluginManager.createInstance(
- 'PropertyWindow',\
- [(SYSTEM, '', '/', '')],\
- rootWidget= 'top_frame',\
- parent= self )
-
- if ( self.theStatusbar != None ):
+ self.thePropertyWindow = self.thePluginManager.createInstance(
+ 'PropertyWindow', [], rootWidget='top_frame', parent=self )
+ if self.theStatusbar is not None:
self.thePropertyWindow.setStatusBar( self.theStatusbar )
aPropertyWindowTopVBox = self.thePropertyWindow['top_frame']
@@ -470,23 +445,21 @@
Returns None
[Note]:creates and adds submenu that includes menus of PluginWindow instances
"""
- # When right button is pressed
+ # When left button is pressed
if anEvent.type == gtk.gdk._2BUTTON_PRESS:
-
aSelectedRawFullPNList = self.__getSelectedRawFullPNList()
aPluginWindowType = self['plugin_optionmenu'].get_children()[0].get()
# When no FullPN is selected, displays error message.
if aSelectedRawFullPNList != None:
if len( aSelectedRawFullPNList ) == 0:
-
aMessage = 'No entity is selected.'
aDialog = ConfirmWindow(OK_MODE,aMessage,'Error!')
self.thePropertyWindow.showMessageOnStatusBar(aMessage)
return False
#self.theQueue.pushFullPNList( aSelectedRawFullPNList )
- self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.theFullPNList() )
+ self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.getFullPNList() )
@@ -541,23 +514,18 @@
self.thePopupMenu.popup(None,None,None,anEvent.button,anEvent.time)
-# def reset( self ):
-#
-# self.reconstructSystemTree()
-# self.reconstructLists()
-# self.update()
-
-
def update( self ):
"""overwrite superclass's method
updates this window and property window
Returns None
"""
- if self.theSession.theModelWalker == None:
- return
- elif not self.systemTreeConstructed:
+ if self.theSession.theSession is not self.theAssociatedSession:
self.reconstructSystemTree()
-
+ self.theQueue = FullPNQueue( ( self[ "backbutton" ], self[ "forwardbutton" ] ) )
+ self.theQueue.registerCallback( self.doSelection )
+ self.theQueue.pushFullPNList( [ convertFullIDToFullPN( createFullID ( 'System::/' ) ) ] )
+ self.updateButtons()
+
# updates this window
if not self.exists():
return
@@ -571,13 +539,11 @@
self.thePluginInstanceSelection.update()
self.updateLists()
+ self.theAssociatedSession = self.theSession.theSession
-
def constructSystemTree( self, parent, fullID ):
-
# System tree
-
newlabel = fullID[ID]
systemStore = self.systemTree.get_model()
@@ -603,18 +569,17 @@
def reconstructSystemTree( self ):
-
rootSystemFullID = createFullID( 'System::/' )
- self.constructSystemTree( None, rootSystemFullID )
- self.systemTreeConstructed = True
+ self.donotHandle = True
+ self.theSysTreeStore.clear()
+ self.donotHandle = False
+ if self.theSession.theSession:
+ self.constructSystemTree( None, rootSystemFullID )
+ self.reconstructLists()
-
def reconstructLists( self ):
selectedSystemList = self.getSelectedSystemList()
-
- if len( selectedSystemList ) == 0:
- return
if self.entitySelected:
return
# Variable list
@@ -638,14 +603,13 @@
typeID = ENTITYTYPE_DICT[ type ]
fullIDList = []
- for systemFullID in systemList:
+ if self.theSession.theSession is not None:
+ for systemFullID in systemList:
+ systemPath = createSystemPathFromFullID( systemFullID )
- systemPath = createSystemPathFromFullID( systemFullID )
+ idList = self.theSession.getEntityList( type, systemPath )
+ fullIDList += [ ( typeID, systemPath, id ) for id in idList ]
- idList = self.theSession.getEntityList( type, systemPath )
- fullIDList += [ ( typeID, systemPath, id ) for id in idList ]
-
-
entityStore = view.get_model()
# clear the store
@@ -654,7 +618,7 @@
entityStore.clear()
self.donotHandle = donotHandle
- # columnList = view.get_columns()
+ # columnList = view.get_columns()
# re-create the list
for fullID in fullIDList:
@@ -693,21 +657,19 @@
def doSelection( self, aFullPNList ):
- if self.theSession.theModelWalker == None:
- return
self.doSelectSystem( aFullPNList )
self.doSelectProcess( aFullPNList )
self.doSelectVariable( aFullPNList )
def doSelectSystem( self, aFullPNList ):
-
targetFullIDList = []
if aFullPNList[0][TYPE] != SYSTEM:
targetFullIDList += [ createFullIDFromSystemPath( aFullPN[SYSTEMPATH] ) for aFullPN in aFullPNList ]
else:
for aFullPN in aFullPNList:
- targetFullIDList.append( convertFullPNToFullID( aFullPN ) )
+ aFullID, _ = convertFullPNToFullID( aFullPN )
+ targetFullIDList.append( aFullID )
# if to slow there should be a check whether this is needed in all cases
donotHandle = self.donotHandle
@@ -719,11 +681,11 @@
#doselection
targetPath = createSystemPathFromFullID( targetFullID )
anIter = self.getSysTreeIter( targetPath )
+ if anIter is not None:
+ aPath = self.theSysTreeStore.get_path( anIter )
+ self.__expandRow( aPath )
+ self.theSysSelection.select_iter( anIter )
- aPath = self.theSysTreeStore.get_path( anIter )
- self.__expandRow( aPath )
- self.theSysSelection.select_iter( anIter )
-
self.donotHandle = donotHandle
self.reconstructLists()
@@ -851,7 +813,7 @@
for systemFullID in systemFullIDList:
fullPNList.append( convertFullIDToFullPN( systemFullID ) )
self.donotHandle = True
- self.theQueue.pushFullPNList( fullPNList )
+ self.theQueue.pushFullPNList( fullPNList )
self.donotHandle = False
@@ -889,6 +851,8 @@
This method updates property values shown in the list of
Variables and Processes.
'''
+ if self.theSession.theSession is None:
+ return
self.updateEntityList( 'Process', self.processTree.get_model(),\
self.PROCESS_COLUMN_LIST,\
@@ -939,7 +903,6 @@
def selectProcess( self, selection ):
-
if self.donotHandle:
return
self.entitySelected = True
@@ -951,7 +914,7 @@
# get selected items
selection.selected_foreach(self.process_select_func)
- if len(self.theSelectedFullPNList)>0:
+ if len( self.theSelectedFullPNList ) > 0:
self.donotHandle = True
self.theQueue.pushFullPNList( self.theSelectedFullPNList )
self.donotHandle = False
@@ -973,7 +936,7 @@
# get selected items
selection.selected_foreach(self.variable_select_func)
- if len(self.theSelectedFullPNList)>0:
+ if len( self.theSelectedFullPNList ) > 0:
self.donotHandle = True
self.theQueue.pushFullPNList( self.theSelectedFullPNList )
self.donotHandle = False
@@ -1047,7 +1010,7 @@
return False
#self.theQueue.pushFullPNList( aSelectedRawFullPNList )
- self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.theFullPNList() )
+ self.thePluginManager.createInstance( aPluginWindowType, self.thePropertyWindow.getFullPNList() )
@@ -1155,42 +1118,8 @@
Return a list of selected FullPNs
"""
return self.theQueue.getActualFullPNList()
-
- # this is redundant
- self.theSelectedFullPNList = []
- if ( self.theLastSelectedWindow == "None" ):
- return None
- if ( self.theLastSelectedWindow == "Variable" ):
-
- selection=self.variableTree.get_selection()
- selection.selected_foreach(self.variable_select_func)
-
- if ( self.theLastSelectedWindow == "Process" ):
-
- selection=self.processTree.get_selection()
- selection.selected_foreach(self.process_select_func)
-
- if len(self.theSelectedFullPNList) == 0:
- selectedSystemList = self.getSelectedSystemList()
- for aSystemFullID in selectedSystemList:
- self.theSelectedFullPNList.append( convertFullIDToFullPN( aSystemFullID ) )
-
-
- # If no property is selected on PropertyWindow,
- # create plugin Window with default property (aValue)
- if len( str(self.thePropertyWindow.getSelectedFullPN()) ) == 0:
- return self.theSelectedFullPNList
-
- # If a property is selected on PropertyWindow,
- # create plugin Window with selected property
- else:
- return [self.thePropertyWindow.getSelectedFullPN()]
-
-
-
-
def addToBoard( self, *arg ):
"""add plugin window to board
"""
@@ -1252,8 +1181,23 @@
# creates Logger using PropertyWindow
#self.theQueue.pushFullPNList( aSelectedRawFullPNList )
- self.thePropertyWindow.createLogger()
+ aLogPolicy = self.theSession.getLogPolicyParameters()
+ try:
+ for aFullPN in self.getFullPNList():
+ # creates loggerstub and call its create method.
+ aLoggerStub = self.theSession.createLoggerStub( createFullPNString( aFullPN ) )
+ if not aLoggerStub.exists():
+ aLoggerStub.setLoggerPolicy( aLogPolicy )
+ aLoggerStub.create()
+ except:
+ # When to create log is failed, display error message on MessageWindow.
+ anErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback)
+ self.thePluginManager.printMessage( anErrorMessage )
+ return
+ # updates fandamental windows.
+ self.thePluginManager.updateFundamentalWindows()
+
# display message on status bar
if len(aSelectedRawFullPNList) == 1:
aMessage = 'Logger was created.'
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/FullPNQueue.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/FullPNQueue.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/FullPNQueue.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -30,55 +30,44 @@
import ecell.ui.osogo.Window as Window
from ecell.ui.osogo.config import *
-class FullPNQueue:
-
- def __init__( self, anAttachmentPoint, aFullPNList ):
+class FullPNQueue( object ):
+ def __init__( self, anAttachmentPoint, aRawFullPNList=None ):
self.backwardQueue = []
self.forwardQueue = []
- self.theRawFullPNList = aFullPNList
- aWindow = Window.Window(
- os.path.join( GLADEFILE_PATH, self.__class__.__name__ + '.glade'),
- "hbox1"
- )
- aWindow.openWindow()
- aFrame = aWindow['hbox1']
- self.backButton = aWindow['backbutton']
- self.forwardButton = aWindow['forwardbutton']
- anAttachmentPoint.add( aFrame )
- self.backButton.connect( "clicked", self.__goBack )
- self.forwardButton.connect( "clicked", self.__goForward )
+ if aRawFullPNList is not None:
+ self.theRawFullPNList = self.__copyList( aRawFullPNList )
+ else:
+ self.theRawFullPNList = None
+ self.backButton = anAttachmentPoint[0]
+ self.forwardButton = anAttachmentPoint[1]
+ self.thebackbuttonHandle = self.backButton.connect( "clicked", self.__goBack )
+ self.theForwardButtonHandle = self.forwardButton.connect( "clicked", self.__goForward )
self.callbackList = []
self.__updateNavigatorButtons()
+ def __del__( self ):
+ self.backButton.disconnect( self.theBackButtonHandle )
+ self.forwardButton.disconnect( self.theForwardButtonHandle )
+
def registerCallback( self, aFunction ):
self.callbackList.append( aFunction )
- apply( aFunction, [self.theRawFullPNList] )
-
def pushFullPNList( self, aRawFullPNList ):
- self.backwardQueue.append( self.__copyList ( self.theRawFullPNList ) )
+ aRawFullPNList = self.__copyList( aRawFullPNList )
+ if self.theRawFullPNList is not None:
+ self.backwardQueue.append( self.theRawFullPNList )
+ self.theRawFullPNList = aRawFullPNList
self.forwardQueue = []
-
- self.__applyFullPNList( aRawFullPNList )
+ self.applyFullPNList()
self.__updateNavigatorButtons()
def getActualFullPNList( self ):
- return self.__copyList( self.theRawFullPNList )
+ return self.theRawFullPNList
- def __applyFullPNList( self, aRawFullPNList ):
- self.theRawFullPNList = self.__copyList( aRawFullPNList )
+ def applyFullPNList( self ):
for aFunction in self.callbackList:
+ apply( aFunction, [ self.theRawFullPNList ] )
- apply( aFunction, [aRawFullPNList] )
-
-
- def applyFullPNList( self ):
- for aFunction in self.callbackList:
-
- apply( aFunction, [self.theRawFullPNList] )
-
-
-
def __copyList( self, aList ):
newList = []
for anItem in aList:
@@ -87,39 +76,28 @@
else:
newList.append( self.__copyList( anItem ) )
return newList
-
-
def __goBack(self, *args):
if len( self.backwardQueue ) == 0:
return
rawFullPNList = self.backwardQueue.pop()
self.forwardQueue.append( self.__copyList( self.theRawFullPNList ) )
- self.__applyFullPNList( rawFullPNList )
+ self.theRawFullPNList = rawFullPNList
+ self.applyFullPNList()
self.__updateNavigatorButtons()
-
def __goForward( self, *args ):
if len( self.forwardQueue ) == 0:
return
rawFullPNList = self.forwardQueue.pop()
self.backwardQueue.append( self.__copyList( self.theRawFullPNList ) )
- self.__applyFullPNList( rawFullPNList )
+ self.theRawFullPNList = rawFullPNList
+ self.applyFullPNList()
self.__updateNavigatorButtons()
-
def __updateNavigatorButtons( self ):
- if len( self.backwardQueue ) == 0:
- backFlag = False
- else:
- backFlag = True
- if len( self.forwardQueue ) == 0:
- forFlag = False
- else:
- forFlag = True
- self.forwardButton.set_sensitive( forFlag )
- self.backButton.set_sensitive( backFlag )
-
+ self.forwardButton.set_sensitive( len( self.forwardQueue ) > 0 )
+ self.backButton.set_sensitive( len( self.backwardQueue ) > 0 )
# read buttons fromfile
# create from EntityList
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/GtkSessionMonitor.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/GtkSessionMonitor.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/GtkSessionMonitor.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -57,28 +57,23 @@
import ecell.ui.osogo.BoardWindow as BoardWindow
import ecell.ui.osogo.LoggingPolicy as LoggingPolicy
import ecell.ui.osogo.OsogoPluginManager as OsogoPluginManager
+from ecell.ui.osogo.DataGenerator import *
-class GtkSessionMonitor(Session):
-#
-# GtkSessionMonitor class functions
-#
- # ==========================================================================
- def __init__(self, aSimulator = None ):
+class GtkSessionMonitor(object):
+ def __init__(self):
"""sets up the osogo session, creates Mainwindow and other fundamental
windows but doesn't show them"""
- #calls superclass
- Session.__init__(self, aSimulator )
+ self.theSession = None
+ self.theModelWalker = None
+ self.theMessageMethod = None
+ self.theDataGenerator = None
- if aSimulator == None:
- self.theModelWalker = None
- else:
- self.theModelWalker = ModelWalker( aSimulator )
self.updateCallbackList = []
# -------------------------------------
# reads defaults from osogo.ini
# -------------------------------------
- self.theConfigDB=ConfigParser.ConfigParser()
+ self.theConfigDB = ConfigParser.ConfigParser()
self.theIniFileName = os.path.join( home_dir, '.ecell', 'osogo.ini' )
theDefaultIniFileName = os.path.join( conf_dir, 'osogo.ini' )
@@ -133,31 +128,22 @@
self.theEntityListInstanceMap = {}
# -------------------------------------
- # initializes for run method
- # -------------------------------------
- self.theSimulator.setEventHandler( lambda:
- gtk.events_pending() and gtk.main_iteration() )
-
- # -------------------------------------
# creates MainWindow
# -------------------------------------
self.theMainWindow = aMainWindow
- # ==========================================================================
def GUI_interact(self):
"hands over controlto the user (gtk.main_loop())"
gtk.main()
- # ==========================================================================
def QuitGUI( self ):
""" quits gtk.main_loop() after saving changes """
gtk.main_quit()
- # ==========================================================================
- def doesExist( self, aWindowName):
+ def doesExist( self, aWindowName ):
""" aWindowName: (str) name of Window
returns True if window is opened
False if window is not opened
@@ -181,15 +167,11 @@
return False
- # ==========================================================================
def openWindow( self, aWindowName, rootWidget = None, rootWindow = None ):
"""opens up window and returns aWindowname instance
aWindowName --- Window name (str)
Returns FundamentalWindow or EntityListWindow list
"""
- if len(self.theModelName) == 0 and aWindowName != 'MainWindow':
- message ( "Model has not yet been loaded. Can't open windows." )
- return None
# When the WindowName does not match, create nothing.
if self.theFundamentalWindows.has_key( aWindowName ):
if rootWidget == None:
@@ -204,7 +186,6 @@
message( "No such WindowType (%s) " %aWindowName )
return None
- # ==========================================================================
def getWindow( self, aWindowName ):
"""
aWindowName --- Window name (str)
@@ -228,7 +209,6 @@
return None
- # ==========================================================================
def displayWindow( self, aWindowName ):
"""When the Window is not created, calls its openWidow() method.
When already created, move it to the top of desktop.
@@ -250,7 +230,6 @@
self.theFundamentalWindows[aWindowName].openWindow()
self.theFundamentalWindows[aWindowName].update()
- # ==========================================================================
def toggleWindow( self, aWindowName, aNewState=None ):
aState = self.theFundamentalWindows[aWindowName].exists()
if aNewState is None:
@@ -264,7 +243,6 @@
if self.theFundamentalWindows['MainWindow'].exists():
self.theFundamentalWindows['MainWindow'].update()
- # ==========================================================================
def createPluginWindow(self, aType, aFullPNList):
""" opens and returns _PluginWindow instance of aType showing aFullPNList
returns None if pluginwindow could not have been created """
@@ -274,7 +252,6 @@
return anInstance
- # ==========================================================================
def createPluginOnBoard(self, aType, aFullPNList):
""" creates and adds plugin to pluginwindow and returns plugininstance """
aBoardWindow = self.getWindow('BoardWindow')
@@ -284,7 +261,6 @@
return aBoardWindow.addPluginWindows( aType, aFullPNList)
- # ==========================================================================
def openLogPolicyWindow(self, aLogPolicy, aTitle ="Set log policy" ):
""" pops up a modal dialog window
with aTitle (str) as its title
@@ -298,14 +274,13 @@
aLogPolicyWindow = LoggingPolicy.LoggingPolicy( self, aLogPolicy, aTitle )
return aLogPolicyWindow.return_result()
- # ==========================================================================
def createEntityListWindow( self, rootWidget = 'EntityListWindow', aStatusBar=None ):
"""creates and returns an EntityListWindow
"""
anEntityListWindow = None
# when Model is already loaded.
- if len(self.theModelName) > 0:
+ if self.theSession is not None:
# creates new EntityListWindow instance
anEntityListWindow = EntityListWindow.EntityListWindow( self, rootWidget, aStatusBar )
anEntityListWindow.openWindow()
@@ -327,12 +302,10 @@
return anEntityListWindow
- # ==========================================================================
def registerUpdateCallback( self, aFunction ):
self.updateCallbackList.append( aFunction )
- # ==========================================================================
def deleteEntityListWindow( self, anEntityListWindow ):
"""deletes the reference to the instance of EntityListWindow
anEntityListWindow --- an instance of EntityListWindow(EntityListWindow)
@@ -354,7 +327,6 @@
anEntityListWindow.close()
del self.theEntityListInstanceMap[ anEntityListWindow ]
- # ==========================================================================
def __updateByTimeOut( self, arg ):
"""when time out, calls updates method()
Returns None
@@ -373,7 +345,6 @@
self.theTimer = gobject.timeout_add( int(self.theUpdateInterval), self.__updateByTimeOut, 0 )
- # ==========================================================================
def __removeTimeOut( self ):
"""removes time out
Returns None
@@ -381,7 +352,6 @@
gobject.source_remove( self.theTimer )
- # ==========================================================================
def updateWindows( self ):
self.theMainWindow.update()
self.updateFundamentalWindows()
@@ -391,18 +361,15 @@
apply( aFunction )
- # ==========================================================================
def setUpdateInterval(self, Secs):
"plugins are refreshed every secs seconds"
self.theMainWindow.theUpdateInterval = Secs
- # ==========================================================================
def getUpdateInterval(self ): #
"returns the rate by plugins are refreshed "
return self.theMainWindow.theUpdateInterval
- # ==========================================================================
def updateFundamentalWindows( self ):
"""updates fundamental windows
Return None
@@ -419,8 +386,6 @@
#update MainWindow
self.theMainWindow.update()
-
- # ==========================================================================
def __readIni(self,aPath):
"""read osogo.ini file
an osogo.ini file may be in the given path
@@ -454,7 +419,6 @@
anErrorMessage = '\n'.join( traceback.format_exception( sys.exc_type,sys.exc_value,sys.exc_traceback ) )
self.message(anErrorMessage)
- # ==========================================================================
def getParameter(self, aParameter):
"""tries to get a parameter from ConfigDB
if the param is not present in either osogo or default section
@@ -469,7 +433,6 @@
# gets it from default
return self.theConfigDB.get('DEFAULT',aParameter)
- # ==========================================================================
def setParameter(self, aParameter, aValue):
"""tries to set a parameter in ConfigDB
if the param is not present in either osogo or default section
@@ -484,7 +447,6 @@
# sets it in default
self.theConfigDB.set('DEFAULT',aParameter, str(aValue))
- # ==========================================================================
def saveParameters( self ):
"""tries to save all parameters into a config file in home directory
"""
@@ -497,23 +459,6 @@
except:
self.message("Could not save preferences into file %s.\n Please check permissions for home directory.\n"%self.theIniFileName)
- #-------------------------------------------------------------------
- def createLoggerWithPolicy( self, fullpn, logpolicy = None ):
- """creates logger for fullpn with logpolicy. if logpolicy parameter is not given, gets parameters from
- config database
- """
- # if logpolicy is None get it from parameters
- if logpolicy == None:
- logpolicy = self.getLogPolicyParameters()
- self.theSimulator.createLogger( fullpn, logpolicy )
-
- #-------------------------------------------------------------------
- def changeLoggerPolicy( self, fullpn, logpolicy ):
- """changes logging policy for a given logger
- """
- self.theSimulator.setLoggerPolicy( fullpn, logpolicy )
-
- #-------------------------------------------------------------------
def getLogPolicyParameters( self ):
"""
gets logging policy from config database
@@ -527,7 +472,6 @@
logPolicy[0]=1
return logPolicy
- #-------------------------------------------------------------------
def setLogPolicyParameters( self, logPolicy ):
"""
saves logging policy into config database
@@ -538,43 +482,51 @@
self.setParameter( 'available_space' ,logPolicy[3] )
self.saveParameters()
+ def interact( self, parameters={} ):
+ self.theSession.interact( parameters )
-#------------------------------------------------------------------------
-#IMPORTANT!
-#
-#Session methods to be used in interactive scripting shoould be overloaded here
-#-------------------------------------------------------------------------
+ def unload( self ):
+ if self.theSession is None:
+ return
+ self.stop()
+ self.theSession = None
+ self.theModelWalker = None
+ self.theDataGenerator = None
+ self.updateWindows()
- #-------------------------------------------------------------------
- def loadScript( self, ecs, parameters={} ):
- #self.__readIni( ecs )
- Session.loadScript (self, ecs, parameters )
+ def newSession( self ):
+ self.theSession = Session()
+ self.theModelWalker = ModelWalker( self.theSession.theSimulator )
+ self.theDataGenerator = DataGenerator( self )
+ self.theSession.theSimulator.setEventHandler( lambda:
+ gtk.events_pending() and gtk.main_iteration() )
+ self.theSession.setMessageMethod( self.theMessageMethod )
- #-------------------------------------------------------------------
- def interact( self, parameters={} ):
- Session.interact (self, parameters )
-
- #-------------------------------------------------------------------
def loadModel( self, aModel ):
#self.__readIni( aModel )
+ self.unload()
+ self.newSession()
+ self.theSession.loadModel( aModel )
- Session.loadModel( self, aModel )
- self.theModelWalker = ModelWalker( self.theSimulator )
-
- #-------------------------------------------------------------------
def saveModel( self , aModel ):
- Session.saveModel( self , aModel )
+ if self.theSession is None:
+ raise Exception( "Model is not loaded" )
+ self.theSession.saveModel( self , aModel )
- #-------------------------------------------------------------------
def setMessageMethod( self, aMethod ):
- Session.setMessageMethod( self, aMethod )
+ self.theMessageMethod = aMethod
+ if self.theSession is not None:
+ self.theSession.setMessageMethod( aMethod )
- #-------------------------------------------------------------------
+ def restoreMessageMethod( self ):
+ if self.theSession is None:
+ return
+ self.theSession.restoreMessageMethod()
+
def message( self, message ):
- Session.message( self, message )
+ self.theMessageMethod( message )
#self._synchronize()
- #-------------------------------------------------------------------
def run( self , time = '' ):
"""
if already running: do nothing
@@ -583,6 +535,8 @@
if Mainwindow is not opened create a stop button
set up a timeout rutin and Running Flag
"""
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
if self.theRunningFlag == True:
return
@@ -597,7 +551,7 @@
aCurrentTime = self.getCurrentTime()
self.message("%15s"%aCurrentTime + ":Start\n" )
- Session.run( self, time )
+ self.theSession.run( time )
self.theRunningFlag = False
self.__removeTimeOut()
@@ -609,15 +563,15 @@
self.updateWindows()
- #-------------------------------------------------------------------
def stop( self ):
""" stop Simulation, remove timeout, set Running flag to false
"""
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
-
try:
if self.theRunningFlag == True:
- Session.stop( self )
+ self.theSession.stop()
aCurrentTime = self.getCurrentTime()
self.message( ("%15s"%aCurrentTime + ":Stop\n" ))
@@ -630,11 +584,13 @@
self.updateWindows()
#self._synchronize()
- #-------------------------------------------------------------------
def step( self, num = None ):
""" step according to num, if num is not given,
according to set step parameters
"""
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+
if self.theRunningFlag == True:
return
@@ -649,7 +605,7 @@
self.message( "Step\n" )
self.theTimer = gobject.timeout_add( self.theUpdateInterval, self.__updateByTimeOut, 0 )
- Session.step( self, int( num ) )
+ self.theSession.step( int( num ) )
self.theRunningFlag = False
self.__removeTimeOut()
@@ -660,60 +616,84 @@
self.theRunningFlag = False
self.updateWindows()
- #self._synchronize()
def isRunning(self):
return self.theRunningFlag
- #-------------------------------------------------------------------
def getNextEvent( self ):
- return Session.getNextEvent( self )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.getNextEvent()
+
def getCurrentTime( self ):
- return Session.getCurrentTime( self )
+ if self.theSession is None:
+ return float("nan")
- #-------------------------------------------------------------------
- def setEventChecker( self, event ):
- Session.setEventChecker( self, event )
+ return self.theSession.getCurrentTime()
- #-------------------------------------------------------------------
- def setEventHandler( self, event ):
- Session.setEventHandler( self, event )
-
def getStepperList( self ):
- return Session.getStepperList( self )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.getStepperList()
+
def createStepperStub( self, id ):
- return Session.createStepperStub( self, id )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.createStepperStub( id )
+
def getEntityList( self, entityType, systemPath ):
- return Session.getEntityList( self, entityType, systemPath )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.getEntityList( entityType, systemPath )
+
def createEntityStub( self, fullid ):
- return Session.createEntityStub( self, fullid )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
- def getLoggerList( self ):
- return Session.getLoggerList( self )
+ return self.theSession.createEntityStub( fullid )
- #-------------------------------------------------------------------
- def createLogger( self, fullpn ):
- Session.createLogger( self, fullpn )
-#FIXME #remember refresh Tracer and Loggerwindows!!!
+ def getEntityProperty( self, fullPN ):
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+ return self.theSession.getEntityProperty( fullPN )
+ def getEntityPropertyAttributes( self, fullPN ):
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.getEntityPropertyAttributes( fullPN )
+
+ def setEntityProperty( self, fullPN, aValue ):
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+
+ self.theSession.setEntityProperty( fullPN, aValue )
+
+ def getLoggerList( self ):
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+
+ return self.theSession.getLoggerList()
+
def createLoggerStub( self, fullpn ):
- return Session.createLoggerStub( self, fullpn )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
- #-------------------------------------------------------------------
+ return self.theSession.createLoggerStub( fullpn )
+
def saveLoggerData( self, fullpn=0, aSaveDirectory='./Data', aStartTime=-1, anEndTime=-1, anInterval=-1 ):
- Session.saveLoggerData( self, fullpn, aSaveDirectory, aStartTime, anEndTime, anInterval )
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+ self.theSession.saveLoggerData( fullpn, aSaveDirectory, aStartTime, anEndTime, anInterval )
+ def getDataGenerator( self ):
+ if self.theSession is None:
+ raise Exception("Model is not loaded")
+ return self.theDataGenerator
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/InterfaceWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/InterfaceWindow.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/InterfaceWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -120,7 +120,7 @@
for anInstance in anInstanceList:
aTitle = anInstance.getTitle()
aClass = anInstance.__class__.__name__
- aFullPN = createFullPNString( anInstance.theFullPN() )
+ aFullPN = createFullPNString( anInstance.getFullPN() )
if self.exists():
Modified: ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/LoggerWindow.py
===================================================================
--- ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/LoggerWindow.py 2011-01-19 06:38:21 UTC (rev 3891)
+++ ecell3/trunk/ecell/frontend/session-monitor/ecell/ui/osogo/LoggerWindow.py 2011-01-20 11:56:01 UTC (rev 3892)
@@ -627,91 +627,3 @@
gtk.Menu.popup(self, pms, pmi, func, button, time)
self.show_all()
-
-# end of PopupMenu
-
-
-# ---------------------------------------------------------------
-# Test code
-# ---------------------------------------------------------------
-
-
-if __name__ == "__main__":
-
- class Session:
- def __init__( self ):
- self.theSimulator = simulator()
- def getLoggerList( self ):
- #fpnlist = ((VARIABLE, '/CELL/CYTOPLASM', 'ATP', 'Value'),
- # (VARIABLE, '/CELL/CYTOPLASM', 'ADP', 'Value'),
- # (VARIABLE, '/CELL/CYTOPLASM'...
[truncated message content] |