rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
s.createEntity( 'Substance', ( SUBSTANCE, '/', 'C' ), 'substance C' )
s.createEntity( 'Substance', ( SUBSTANCE, '/CYTOPLASM', 'CA' ), 's CA' ) s.createEntity( 'Substance', ( SUBSTANCE, '/CYTOPLASM', 'CB' ), 's CB' )
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
( REACTOR, '/', 'RC1' ),
( REACTOR, '/CYTOPLASM', 'RC1' ),
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
substancelist = s.getProperty( ( SYSTEM, '/', '/', 'SubstanceList' ) )
substancelist = s.getProperty( ( SYSTEM, '', '/', 'SubstanceList' ) )
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
s.setProperty( ( SUBSTANCE, '/', 'A', 'Quantity' ), (1, ) )
s.setProperty( ( SUBSTANCE, '/', 'A', 'Quantity' ), (10.0, ) )
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
printAllProperties( s, ( REACTOR, '/', 'RC1' ) )
printAllProperties( s, ( REACTOR, '/CYTOPLASM', 'RC1' ) )
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
title = aClassname[:-6]
title = classname[:-6]
def createInstance( self, classname, data, rootWidget=None, parent=None ): ''' classname --- a class name of PluginWindow (str) data --- a RawFullPN (RawFullPN) rootWidget --- a root widget (str or None) parent --- a parentWindow (Window) # NOT gtk.Window ''' if self.thePluginMap.has_key( classname ): pass else: self.loadModule( classname )
print 'load stepper'
def loadModel( self, aFileObject ): anEmlParser = eml.EmlParser( aFileObject ) self.__thePreModel = anEmlParser.parse()
print 'load entity'
def loadModel( self, aFileObject ): anEmlParser = eml.EmlParser( aFileObject ) self.__thePreModel = anEmlParser.parse()
print 'load system-stepper'
def loadModel( self, aFileObject ): anEmlParser = eml.EmlParser( aFileObject ) self.__thePreModel = anEmlParser.parse()
print 'load property'
def loadModel( self, aFileObject ): anEmlParser = eml.EmlParser( aFileObject ) self.__thePreModel = anEmlParser.parse()
self.__theTmpScriptFileName = 'script.sh'
self.__theTmpScriptFileName = "script." + os.path.basename( os.getenv('SHELL') )
def __init__(self): '''constructor '''
'''retrys
'''retry
def retry(self): '''retrys Return None '''
'''runs process
'''run process
def run(self): '''runs process Return None '''
aScriptContext = " self.getScriptFileName(), anArgument) open( self.__theTmpScriptFileName, 'w' ).write( aScriptContext)
aScriptContext = " %(os.getenv('SHELL'), ECELL3_SESSION, self.getScriptFileName(), anArgument) open( self.__theTmpScriptFileName, 'w' ).write( aScriptContext )
def run(self): '''runs process Return None '''
aContext = "%s -cwd -S /bin/sh -o %s -e %s %s" %(QSUB,
aContext = "%s -cwd -S %s -o %s -e %s %s" \ %(QSUB, os.getenv('SHELL'),
def run(self): '''runs process Return None '''
'''updates jobs's status
'''update jobs's status
def update( self ): '''updates jobs's status Return None '''
'''stops the job
'''stop the job
def stop(self): '''stops the job Return None '''
print "Window: can't read %s." % gladefile raise IOError()
raise IOError( "can't read %s." % gladefile )
def __init__( self, gladefile=None, root=None ):
self.updateEntityList )
self.updateSystemSelection )
def __init__( self, aMainWindow ):
anInterpreter.interact( 'ecell3-session' ) def loadModel( self, aFile ): if type( aFile ) == str: aFileObject = open( aFile )
self._prompt = self._session_prompt( self ) anInterpreter.runsource( 'import sys; sys.ps1=theSession._prompt' ) anInterpreter.interact( BANNERSTRING ) def loadModel( self, aModel ): if type( aModel ) == type( eml.Eml ): anEml = aModel aModelName = '<eml.Eml>' elif type( aModel ) == str: aFileObject = open( aModel ) aModelName = aModel anEml = eml.Eml( aFileObject )
def interact( self, parameters={} ):
aFileObject = aFile anEml = eml.Eml( aFileObject )
aFileObject = aModel aModelName = aModel.name anEml = eml.Eml( aFileObject )
def loadModel( self, aFile ): if type( aFile ) == str: aFileObject = open( aFile ) else: aFileObject = aFile
self.__loadEntityList( 'Variable', aSystemPath, aVariableList ) self.__loadEntityList( 'Process', aSystemPath, aProcessList ) self.__loadEntityList( 'System', aSystemPath, aSubSystemList )
self.__loadEntityList( anEml, 'Variable', aSystemPath, aVariableList ) self.__loadEntityList( anEml, 'Process', aSystemPath, aProcessList ) self.__loadEntityList( anEml, 'System', aSystemPath, aSubSystemList )
def __loadEntity( self, anEml, aSystemPath='/' ):
self.__loadEntity( aSubSystemPath )
self.__loadEntity( anEml, aSubSystemPath )
def __loadEntity( self, anEml, aSystemPath='/' ):
self.__loadEntityPropertyList( aFullID, aPropertyList )
self.__loadEntityPropertyList( anEml, aFullID, aPropertyList )
def __loadEntityList( self, anEml, anEntityTypeString, aSystemPath, anIDList ): for anID in anIDList:
else: self.theSession.printMessage( 'WARNING:need load model or script!!\n' )
def startSimulation( self, a ) : if self.theLoadModelChecker == 1: self.theRunningFlag = 1 self.theSession.printMessage( "Start\n" ) self.theTimer = gtk.timeout_add(self.theUpdateInterval, self.updateByTimeOut, 0) self.theLoggerWindow.update() self.theSession.run() self.removeTimeOut()
else: self.theSession.printMessage( 'WARNING:need load model or script!!\n' )
def stopSimulation( self, a ) : if self.theLoadModelChecker == 1: if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
else: self.theSession.printMessage( 'WARNING:need load model or script!!\n' )
def stepSimulation( self, a ) : if self.theLoadModelChecker == 1: self.theSession.printMessage( "Step\n" ) self['step_combo_entry'].set_text( str( self.theStepSize ) ) self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.updateByTimeOut, 0 ) if self.theStepType == 0: self.theSession.run( self.theStepSize ) else: self.theSession.step( self.theStepSize ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
if self.theStepperChecker == 0 and self.theEntryChecker == 0: self.theSession.printMessage( 'WARNING:need load model or script!!\n' )
def toggleEntryList( self, button_obj ): #fix me: this part is Root System's bug. if self.theStepperChecker == 1 and self.theEntryChecker == 0: self.theEntryListWindow = EntryListWindow.EntryListWindow( self ) self.theEntryListWindowWindow = self.theEntryListWindow[ 'entry_list_window' ] self.theEntryChecker = 1 if self.theEntryChecker == 1: if button_obj.get_active() : self.theEntryListWindowWindow.show_all() self.theEntryListWindow.update() else : self.theEntryListWindowWindow.hide()
aFileObject.readlines()
def __init__( self, aFileObject=None ): """read EML file and make domtree"""
if type( aModel ) == type( eml.Eml ):
if type( aModel ) == type( eml.Eml ) or\ type( aModel ) == type( eml.Eml() ):
def loadModel( self, aModel ): # aModel : an EML instance, a file name (string) or a file object # return -> None # This method can thwor exceptions.
dirname = os.path.dirname( aModel ) if dirname != "": os.chdir( dirname )
if type( aModel ) == type( eml.Eml ) or\ type( aModel ) == type( eml.Eml() ): dirname = os.path.dirname( aModel ) if dirname != "": os.chdir( dirname )
def loadModel( self, aModel ): # aModel : an EML instance, a file name (string) or a file object # return -> None # This method can thwor exceptions.
if aClass.endswith(DM_SYSTEM_CLASS):
if aClass.endswith('System'):
def __getFullID( self, aClass):
raise Exception("Class type unambiguous")
print "%s classname is ambigouos"%aClass return None
def __getFullID( self, aClass):
propertylist : propertylist property
propertylist : property propertylist
def p_propertylist(t): ''' propertylist : propertylist property | property | empty ''' t[0] = createList( 'propertylist', t )
valuelist : valuelist value
valuelist : value valuelist
def p_valuelist(t): ''' valuelist : valuelist value | value ''' t[0] = createList( 'valuelist', t )
matrixlist : matrixlist matrix
matrixlist : matrix matrixlist
def p_matrixlist(t): ''' matrixlist : matrixlist matrix | matrix ''' t[0] = createList( 'matrixlist', t )
self.theEntityListWindow.setSession( self.theSession )
def __loadData( self, *arg ) : """loads model or script file arg[0] --- ok button of FileSelection arg[1] --- 'Model'/'Script' (str) Return None """
if( self.extraCount == 12 ):
if( self.extraCount == 5 ):
def animate( self ): if ( self.__running ):
argList.extend([ '\"' + cmd + '\"', '\"' + fileName + '\"' ])
argList.extend([ '\"' + cmd + '\"', fileName ])
def editFile( self, fileName ):
print 'DEBUG:', aStepperProperty
def loadStepperProperty( self ): aStepperPropertyList = self.__theEml.getStepperPropertyList() for aStepperProperty in aStepperPropertyList:
self.theEntityListWindow = self.theSession.createEntityListWindow()
def openWindow( self ):
self.theEntityListWindow = self.theSession.createEntityListWindow()
def openWindow( self ):
self.stopSimulation('')
self.stopSimulation()
def exit( self, anObject=None ):
self.theRunningFlag = 0
def startSimulation( self, obj ) :
else: pass
self.theRunningFlag = 0
def startSimulation( self, obj ) :
def stopSimulation( self, obj ) :
def stopSimulation( self, obj=None ) :
def stopSimulation( self, obj ) :
else: self.theRunningFlag = 0
def stopSimulation( self, obj ) :
self.theRunningFlag = 1
def stepSimulation( self, obj ) :
self.theSession.run( self.theStepSize ) else: self.theSession.step( self.theStepSize )
self.theSession.run( float( self.theStepSize ) ) else: self.theSession.step( int( self.theStepSize ) ) self.theRunningFlag = 0
def stepSimulation( self, obj ) :
else: pass
self.theRunningFlag = 0
def stepSimulation( self, obj ) :
column=gtk.TreeViewColumn('Property',gtk.CellRendererText(),text=0)
column=gtk.TreeViewColumn( 'Property',gtk.CellRendererText(),\ text=PROPERTY_INDEX )
def openWindow(self):
column=gtk.TreeViewColumn('Number',gtk.CellRendererText(),text=1)
column=gtk.TreeViewColumn( 'Value',gtk.CellRendererText(),\ text=VALUE_INDEX )
def openWindow(self):
column=gtk.TreeViewColumn('Value',gtk.CellRendererText(),text=2)
column=gtk.TreeViewColumn( 'Get',gtk.CellRendererText(),\ text=GET_INDEX )
def openWindow(self):
column=gtk.TreeViewColumn('Getable',gtk.CellRendererText(),text=3) self.thePropertyList.append_column(column) column=gtk.TreeViewColumn('Settable',gtk.CellRendererText(),text=4)
column=gtk.TreeViewColumn( 'Set',gtk.CellRendererText(),\ text=SET_INDEX )
def openWindow(self):
aList.append( '' )
def selectStepperID( self, *objects ):
for i in range(0,5):
for i in range(0,4):
def selectStepperID( self, *objects ):
if type(data) != type(()): aList = [ aProperty, ] aList.append( '' ) aList.append( str(data) ) anAttribute = self.theSession.theSimulator.getStepperPropertyAttributes( aStepperID, aProperty ) aList.append( decodeAttribute(anAttribute[GETABLE]) ) aList.append( decodeAttribute(anAttribute[SETTABLE]) ) iter = PropertyModel.append( ) for i in range(0,5): PropertyModel.set_value(iter,i,aList[i]) else: aNumber = 0 for anElement in data: aList = [ aProperty ] anAttribute = self.theSession.theSimulator.getStepperPropertyAttributes( aStepperID, aProperty ) aList.append( `aNumber` ) aList.append( str(anElement) ) aList.append( decodeAttribute(anAttribute[GETABLE]) ) aList.append( decodeAttribute(anAttribute[SETTABLE]) ) iter = PropertyModel.append( ) for i in range(0,5): PropertyModel.set_value(iter,i,aList[i]) aNumber = aNumber + 1
aList = [ aProperty, ] aDataString = str( data ) if( len( aDataString ) > 20 ): aDataString = aDataString[:20]\ + '...' aList.append( aDataString ) anAttribute = self.theSession.theSimulator.getStepperPropertyAttributes( aStepperID, aProperty ) aList.append( decodeAttribute(anAttribute[GETABLE]) ) aList.append( decodeAttribute(anAttribute[SETTABLE]) ) iter = PropertyModel.append( ) for i in range(0,4): PropertyModel.set_value(iter,i,aList[i])
def selectStepperID( self, *objects ):
aNumber = self['property_list'].get_model().get_value( self.theSelectedRowOfPropertyList, NUMBER_INDEX )
def updateProperty( self, *objects ):
self.plotarea[3])
self.plotarea[3]+1)
def shiftplot(self,realshift): #save plotarea self.pm2.draw_drawable(self.pm2.new_gc(),self.pm,self.origo[0]+realshift, self.plotarea[1],0,0,self.plotarea[2]-realshift, self.plotarea[3]) self.clearplotarea() #paste self.pm.draw_drawable(self.pm.new_gc(),self.pm2,0,0,self.origo[0], self.plotarea[1],self.plotarea[2]-realshift, self.plotarea[3]) self.theWidget.queue_draw()
self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange)
if self.minmax[0]<0: self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) else: self.yframe[0]=0
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: if self.minmax[0]==0: self.minmax[1]=1 else: self.minmax[1]=self.minmax[0]+abs(self.minmax[0]) #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) if self.yframe[0]==self.yframe[1]:self.yframe[1]=self.yframe[0] exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
mantissa0=abs(floor(self.yframe[0]/exponent)) if mantissa1<=1.0:mantissa1=1.0 elif mantissa1<=2.0:mantissa1=2.0 elif mantissa1<=5.0:mantissa1=5.0 else: mantissa1=10.0 self.yticks_no=10 if self.yframe[0]<0: if mantissa0<=1.0:mantissa0=1.0 elif mantissa0<=2.0:mantissa0=2.0 elif mantissa0<=5.0:mantissa0=5.0 else: mantissa0=10.0 if mantissa1>mantissa0: lesser=mantissa0 bigger=mantissa1 else: lesser=mantissa1 bigger=mantissa0 tick_step=bigger/5.0 lesser_step_no=ceil(lesser/tick_step) lesser=tick_step*float(lesser_step_no) lesser=int(lesser*1000) lesser/=1000.0 self.yticks_no=5+lesser_step_no if mantissa0<mantissa1: mantissa0=lesser else: mantissa1=lesser
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: if self.minmax[0]==0: self.minmax[1]=1 else: self.minmax[1]=self.minmax[0]+abs(self.minmax[0]) #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) if self.yframe[0]==self.yframe[1]:self.yframe[1]=self.yframe[0] exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
self.yframe[0]=mantissa0*exponent
self.yframe[0]=(-1)*(mantissa0*exponent)
def reframey(self): #no redraw! #get max and min from databuffers if self.zoomlevel==0: self.getminmax() if self.minmax[0]==self.minmax[1]: if self.minmax[0]==0: self.minmax[1]=1 else: self.minmax[1]=self.minmax[0]+abs(self.minmax[0]) #calculate yframemin, max if self.scale_type=='linear': yrange=(self.minmax[1]-self.minmax[0])/(self.yframemax_when_rescaling-self.yframemin_when_rescaling) self.yframe[1]=self.minmax[1]+(1-self.yframemax_when_rescaling)*yrange self.yframe[0]=self.minmax[0]-(self.yframemin_when_rescaling*yrange) if self.yframe[0]==self.yframe[1]:self.yframe[1]=self.yframe[0] exponent=pow(10,floor(log10(self.yframe[1]-self.yframe[0]))) mantissa1=ceil(self.yframe[1]/exponent) mantissa0=floor(self.yframe[0]/exponent) ticks=mantissa1-mantissa0 if ticks>10: mantissa0=floor(mantissa0/2)*2 mantissa1=ceil(mantissa1/2)*2 ticks=(mantissa1-mantissa0)/2 elif ticks<5: ticks*=2 self.yticks_no=ticks
point[1]<self.plotaread[3] and point[1]>self.plotaread[1]
point[1]<=self.plotaread[3] and point[1]>=self.plotaread[1]
def withinframes(self,point): return point[0]<self.plotaread[2] and point[0]>self.plotaread[0] and\ point[1]<self.plotaread[3] and point[1]>self.plotaread[1]
self.theSession.setPrintMethod( self.theMessageWindow )
self.theSession.setPrintMethod( self.theMessageWindow.printMessage )
def __init__( self ):
self.theStepperChacker = 0
self.theStepperChecker = 0
def __init__( self ):
self.theStepperChacker = 1
self.theStepperChecker = 1
def loadRule( self, button_obj ) : self.theStepperChacker = 1 aFileName = self.theRuleFileSelection.get_filename() self.theRuleFileSelection.hide() self.theSession.printMessage( 'load rule file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap) self.theModelInterpreter.load( self.theCellModelObject ) self.theEntryListWindow.update() self.theSession.theSimulator.initialize()
self.theSession.printMessage( 'load rule file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap) self.theModelInterpreter.load( self.theCellModelObject ) self.theEntryListWindow.update()
self.theSession.printMessage( 'loading rule file %s\n' % aFileName ) self.theSession.loadModel( aFileName )
def loadRule( self, button_obj ) : self.theStepperChacker = 1 aFileName = self.theRuleFileSelection.get_filename() self.theRuleFileSelection.hide() self.theSession.printMessage( 'load rule file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap) self.theModelInterpreter.load( self.theCellModelObject ) self.theEntryListWindow.update() self.theSession.theSimulator.initialize()
self.theStepperChacker = 1
self.theStepperChecker = 1
def loadScript( self, button_obj ): self.theStepperChacker = 1 aFileName = self.theScriptFileSelection.get_filename() self.theScriptFileSelection.hide() self.theSession.printMessage( 'load script file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap) self.update()
self.theSession.printMessage( 'load script file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap)
self.theSession.printMessage( 'loading script file %s\n' % aFileName ) aGlobalNameMap = { 'theMainWindow' : self } execfile( aFileName, aGlobalNameMap )
def loadScript( self, button_obj ): self.theStepperChacker = 1 aFileName = self.theScriptFileSelection.get_filename() self.theScriptFileSelection.hide() self.theSession.printMessage( 'load script file %s\n' % aFileName ) aGlobalNameMap = { 'aMainWindow' : self } execfile(aFileName, aGlobalNameMap) self.update()
os.rename(self.theTmpSessionRecordFilename, self.thePreSessionRecordFilename)
def exit( self, obj ): mainQuit() os.rename(self.theTmpSessionRecordFilename, self.thePreSessionRecordFilename)
if self.theStepperChacker == 1:
if self.theStepperChecker == 1:
def toggleEntryList( self, button_obj ):
def openPreferences( self ) : pass def openAbout( self ) : pass
def openPreferences( self ) : pass
aSystem[ 'FullId' ] = str( aSystem[ 'Type' ] + ':' \
aSystem[ 'FullId' ] = str( 'System:' \
def getSystemEntityList( self ):
%s -- start up E-Cell3 GUI
%s -- E-Cell3 Session Monitor
def usage(): aProgramName = 'ecell3-session-monitor' print '''
Do not use -e and -f at same time.
Do not use -e and -f at the same time.
def usage(): aProgramName = 'ecell3-session-monitor' print '''
def createEntity( self, anEntityType, aClass, anId, aName ):
def createEntity( self, anEntityType, aClass, aFullId, aName ):
def createEntity( self, anEntityType, aClass, anId, aName ): """create an entity: system, substance and reactor"""
if self.checkEntityExistence( anId )[0]: print 'already exists' return 'error'
def createEntity( self, anEntityType, aClass, anId, aName ): """create an entity: system, substance and reactor"""
else: anEntityElement.setAttribute( 'id', anId.split( ':' )[2] ) aTargetFullPath = anId.split( ':' )[1]
elif( anEntityType == 'Substance' or anEntityType == 'Reactor' ): anId = aFullId.split( ':' )[2] anEntityElement.setAttribute( 'id', anId ) aTargetFullPath = aFullId.split( ':' )[1]
def createEntity( self, anEntityType, aClass, anId, aName ): """create an entity: system, substance and reactor"""
aPropertyExistence = self.checkPropertyExistence( aFullId ) if self.checkPropertyExistence( aFullId ): print 'already exists' return 'error'
aPropertyExistence = 0
def setProperty( self, aFullId, aName, aValueList ):
aTargetSystemFullId = aTargetSystem.getAttribute( 'id' )
aTargetSystemId = aTargetSystem.getAttribute( 'id' ) aTargetSystemFullId = self.convertSystemId2SystemFullId( aTargetSystemId )
def setProperty( self, aFullId, aName, aValueList ):
def asPathToSystem( self, aFullPathOfSystem ): if( aFullPathOfSystem == '/' ): aPathToTargetSystem = ':/'
def convertSystemFullId2SystemId( self, aSystemFullId ): """ aSystemFullId : ex) System:/CELL:CYTOPLASM return -> aSystemId [string] : ex) /CELL/CYTOPLASM """ aPathToSystem = aSystemFullId.split( ':' )[1] aSystemSimpleId = aSystemFullId.split( ':' )[2] if( aSystemSimpleId == '/' ): aSystemId = '/' elif( aPathToSystem == '/' ): aSystemId = '/' +aSystemSimpleId
def asPathToSystem( self, aFullPathOfSystem ):
aFullPathInfo = aFullPathOfSystem.split( '/' ) aTargetSystemId = aFullPathInfo[-1] del aFullPathInfo[-1] aPathToTargetSystemInfo = aFullPathInfo if( len( aPathToTargetSystemInfo ) == 1 ): aPathToTargetSystem = '/:' + aTargetSystemId else: aPathToTargetSystem = str( string.join( aPathToTargetSystemInfo, '/' ) + ':' + aTargetSystemId ) return aPathToTargetSystem
aSystemId = aPathToSystem + '/' +aSystemSimpleId return aSystemId def convertSystemId2SystemFullId( self, aSystemId ): """ aSystemId : ex) /CELL/CYTOPLASM return -> aSystemFullId [string] : ex) System:/CELL:CYTOPLASM """ aSystemIdArray = aSystemId.split( '/' ) aSystemSimpleId = aSystemIdArray[-1] if ( aSystemId == '/' ): aSystemFullId = 'System::/' elif( len( aSystemIdArray ) == 2 ): aSystemFullId = 'System:/:' + aSystemSimpleId else: del aSystemIdArray[-1] aPathToSystem = string.join( aSystemIdArray, '/' ) aSystemFullId = 'System:' + aPathToSystem + ':' + aSystemSimpleId return aSystemFullId
def asPathToSystem( self, aFullPathOfSystem ):
aLoggerStub = LoggerStub( theSimulator, aFullPNString )
aLoggerStub = LoggerStub( self.theSimulator, aFullPNString )
def saveData( self, obj ):
Session.saveLoggerData( self, fullpn=0, aSaveDirectory='./Data', aStartTime=-1, anEndTime=-1, anInterval=-1 )
Session.saveLoggerData( self, fullpn, aSaveDirectory, aStartTime, anEndTime, anInterval )
def saveLoggerData( self, fullpn=0, aSaveDirectory='./Data', aStartTime=-1, anEndTime=-1, anInterval=-1 ): Session.saveLoggerData( self, fullpn=0, aSaveDirectory='./Data', aStartTime=-1, anEndTime=-1, anInterval=-1 )
aValue = self.__getNewUnitValue( anUnit, aValue ) return aValue
aValue = aValue * self.__getNewUnitValue( anUnit ) newValue.append( aValue )
def convertUnit( self, aValueUnit, aValue ):
aValue = self.__getNewUnitValue( anUnit, aValue ) return aValue def __getNewUnitValue( self, anUnit, aValue ):
aValue = aValue * self.__getNewUnitValue( anUnit ) newValue.append( aValue ) if( newValue == [] ): return aValue else: return newValue[0] def __getNewUnitValue( self, anUnit ): aValue = 1
def convertUnit( self, aValueUnit, aValue ):
pass
self['EntityPopupMenu'].prepend( aMenuItem )
def __initializePopupMenu( self ): """Initialize popup menu Returns None [Note]:In this method, only 'PluginWindow type' menus, 'Create Logger' menu and 'Add to Board' menu are created. The menus of PluginWindow instances are appended dinamically in self.popupMenu() method. """
pass
self['EntityPopupMenu'].append( aMenuItem )
def __initializePopupMenu( self ): """Initialize popup menu Returns None [Note]:In this method, only 'PluginWindow type' menus, 'Create Logger' menu and 'Add to Board' menu are created. The menus of PluginWindow instances are appended dinamically in self.popupMenu() method. """
self['EntityPopupMenu'].append( gtk.MenuItem() )
def __initializePopupMenu( self ): """Initialize popup menu Returns None [Note]:In this method, only 'PluginWindow type' menus, 'Create Logger' menu and 'Add to Board' menu are created. The menus of PluginWindow instances are appended dinamically in self.popupMenu() method. """
self['EntityPopupMenu'].append( aMenuItem )
def __initializePopupMenu( self ): """Initialize popup menu Returns None [Note]:In this method, only 'PluginWindow type' menus, 'Create Logger' menu and 'Add to Board' menu are created. The menus of PluginWindow instances are appended dinamically in self.popupMenu() method. """
Window.__init__( self )
OsogoWindow.__init__( self, 'MainWindow.glade' ) OsogoWindow.openWindow(self)
def __init__( self ): Window.__init__( self )
self.theMessageWindowWindow = self.theMessageWindow[ 'message_window' ]
def __init__( self ): Window.__init__( self )
self.theLoggerWindowWindow = self.theLoggerWindow[ 'logger_window' ]
def __init__( self ): Window.__init__( self )
self.theInterfaceWindowWindow = self.theInterfaceWindow[ 'interface_window' ] self.thePluginManager = OsogoPluginManager( self.theSession, self.theLoggerWindow, self.theInterfaceWindow, self.theMessageWindow )
self.thePluginManager = OsogoPluginManager( self.theSession, self.theLoggerWindow, self.theInterfaceWindow, self.theMessageWindow )
def __init__( self ): Window.__init__( self )
self.theScriptFileSelection.complete( '*.' + self.ScriptFileExtension )
def __init__( self ): Window.__init__( self )
self.theRuleFileSelection.complete( '*.' + self.RuleFileExtension )
def __init__( self ): Window.__init__( self )
self.theSaveFileSelection.complete( '*.' + self.CellStateFileExtension )
def __init__( self ): Window.__init__( self )
def closeParentWindow( self, button_obj): aParentWindow = button_obj.get_parent_window()
self.setInitialWidgetStatus() def setInitialWidgetStatus( self ): self['start_button'].set_sensitive(0) self['stop_button'].set_sensitive(0) self['step_button'].set_sensitive(0) self['entry_list'].set_sensitive(0) self['palette_togglebutton'].set_sensitive(0) self['create_new_entry_list_menu'].set_sensitive(0) def closeParentWindow( self, obj ): aParentWindow = obj.get_parent_window()
def __init__( self ): Window.__init__( self )
self.theStepperChecker = 1 aFileName = self.theRuleFileSelection.get_filename() self.theRuleFileSelection.hide() self.theSession.printMessage( 'loading rule file %s\n' % aFileName) aModelFile = open( aFileName ) self.theSession.loadModel( aModelFile ) aModelFile.close() self.theSession.theSimulator.initialize() self.update()
try: aFileName = self.theRuleFileSelection.get_filename() self.theRuleFileSelection.hide() self.theSession.printMessage( 'loading rule file %s\n' % aFileName) aModelFile = open( aFileName ) self.theSession.loadModel( aModelFile ) aModelFile.close() self.theSession.theSimulator.initialize() self.update() except: import sys import traceback aErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback) self.theMessageWindow.printMessage(aErrorMessage) else: self.theStepperChecker = 1 self['start_button'].set_sensitive(1) self['stop_button'].set_sensitive(1) self['step_button'].set_sensitive(1) self['entry_list'].set_sensitive(1) self['palette_togglebutton'].set_sensitive(1) self['create_new_entry_list_menu'].set_sensitive(1) self['load_rule_menu'].set_sensitive(0) self['load_script_menu'].set_sensitive(0)
def loadRule( self, button_obj ) : self.theStepperChecker = 1 aFileName = self.theRuleFileSelection.get_filename() self.theRuleFileSelection.hide() self.theSession.printMessage( 'loading rule file %s\n' % aFileName) aModelFile = open( aFileName ) self.theSession.loadModel( aModelFile ) aModelFile.close() self.theSession.theSimulator.initialize() self.update()
def loadScript( self, button_obj ): self.theStepperChecker = 1 aFileName = self.theScriptFileSelection.get_filename() self.theScriptFileSelection.hide() self.theSession.printMessage( 'loading script file %s\n' % aFileName ) aGlobalNameMap = { 'theMainWindow' : self } execfile( aFileName, aGlobalNameMap ) self.update()
def loadScript( self, obj ): try: aFileName = self.theScriptFileSelection.get_filename() self.theScriptFileSelection.hide() self.theSession.printMessage( 'loading script file %s\n' % aFileName ) aGlobalNameMap = { 'theMainWindow' : self } execfile( aFileName, aGlobalNameMap ) self.update() except: import sys import traceback aErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback) self.theMessageWindow.printMessage(aErrorMessage) else: self.theStepperChecker = 1 self['start_button'].set_sensitive(1) self['stop_button'].set_sensitive(1) self['step_button'].set_sensitive(1) self['entry_list'].set_sensitive(1) self['palette_togglebutton'].set_sensitive(1) self['create_new_entry_list_menu'].set_sensitive(1) self['load_rule_menu'].set_sensitive(0) self['load_script_menu'].set_sensitive(0)
def loadScript( self, button_obj ): self.theStepperChecker = 1 aFileName = self.theScriptFileSelection.get_filename() self.theScriptFileSelection.hide() self.theSession.printMessage( 'loading script file %s\n' % aFileName ) aGlobalNameMap = { 'theMainWindow' : self } execfile( aFileName, aGlobalNameMap ) self.update()