rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
if x1>self.plotaread[2] and x0<=self.plotaread[2]:
|
if x1>self.plotaread[2] :
|
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
|
y0=self.plotaread[1] x0=xi+round((y0-yi)*my) y02=self.plotaread[3] x02=xi+round((y02-yi)*my) if x02<x0: x0=x02 y0=y02
|
if y0<self.plotaread[1]: y0=self.plotaread[1] x0=xi+round((y0-yi)*my) elif y0>self.plotaread[3]: y0=self.plotaread[3] x0=xi+round((y0-yi)*my) if x0<self.plotaread[0] or x0>self.plotaread[2] or x0<xi or x0>x1: return
|
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
|
y1=self.plotaread[1] x1=xi+round((y1-yi)*my) y12=self.plotaread[3] x12=xi+round((y12-yi)*my) if x12>x1: x1=x12 y1=y12
|
if y1<self.plotaread[1]: y1=self.plotaread[1] x1=xi+round((y1-yi)*my) elif y1>self.plotaread[3]: y1=self.plotaread[3] x1=xi+round((y1-yi)*my) if x1<self.plotaread[0] or x1>self.plotaread[2] or x1<x0 or x1>xe: return
|
def drawpoint_connect(self, aFullPNString, datapoint): #get datapoint x y values #convert to plot coordinates if self.trace_onoff[aFullPNString]==gtk.FALSE: return 0 x=self.convertx_to_plot(datapoint[0]) y=self.converty_to_plot(datapoint[1]) cur_point_within_frame=self.withinframes([x,y]) #getlastpoint, calculate change to the last lastx=self.lastx[aFullPNString] lasty=self.lasty[aFullPNString] self.lastx[aFullPNString]=x self.lasty[aFullPNString]=y last_point_within_frame=self.withinframes([lastx,lasty]) lastymax=self.lastymax[aFullPNString] lastymin=self.lastymin[aFullPNString] if lastx!=None : dx=abs(lastx-x)
|
pb=gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,gtk.TRUE,root.get_visual().bits_per_rgb,10,10)
|
pb=gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,gtk.TRUE,8,10,10)
|
def __init__( self, scale_type, root, plottitle="" ):
|
self.theEntityListStore.clear() self.updateSystemSelection()
|
def update( self ): self.theEntityListStore.clear()
|
|
self.selectSystem( aSelectedSystemIter )
|
def updateSystemSelection( self, obj=None ): aSelectedSystemIter = self.theSystemTree.get_selection().get_selected()[1] if aSelectedSystemIter == None: return
|
|
self.theEntityListWindow = EntityListWindow.EntityListWindow( self.theSession )
|
def __init__( self, aSession ):
|
|
self.theEntityListWindow.openWindow()
|
self.theEntityListWindow = self.theSession.createEntityListWindow()
|
def openWindow( self ):
|
aModel.clear()
|
if aModel != None: aModel.clear()
|
def update( self ): aModel = self.theInterfaceListWidget.get_model()
|
self['entitylist_window_menu'].set_sensitive(aDataLoadedStatus) self['message_window_menu'].set_sensitive(aDataLoadedStatus) self['toolbar_menu'].set_sensitive(aDataLoadedStatus) self['statusbar_menu'].set_sensitive(aDataLoadedStatus)
|
def __setMenuAndButtonsStatus( self, aDataLoadedStatus ): """sets initial widgets status aDataLoadedStatus -- the status of loading data (TRUE:Model or Script is loaded / FALSE:Not loaded) Returns None """
|
|
def getStepperList():
|
def getStepperList( self ):
|
def getStepperList(): return self.theSimulator.getStepperList()
|
def createEntityListWindow( self ):
|
def createEntityListWindow( self, rootWidget = 'EntityListWindow' ):
|
def createEntityListWindow( self ): """creates and returns an EntityListWindow """ anEntityListWindow = None
|
anEntityListWindow = EntityListWindow.EntityListWindow( self )
|
anEntityListWindow = EntityListWindow.EntityListWindow( self, rootWidget ) anEntityListWindow.openWindow() self.theEntityListInstanceMap[ anEntityListWindow ] = None self.updateFundamentalWindows()
|
def createEntityListWindow( self ): """creates and returns an EntityListWindow """ anEntityListWindow = None
|
anEntityListWindow = EntityListWindow.EntityListWindow( None )
|
anEntityListWindow = EntityListWindow.EntityListWindow( None, rootWidget ) anEntityListWindow.openWindow()
|
def createEntityListWindow( self ): """creates and returns an EntityListWindow """ anEntityListWindow = None
|
anEntityListWindow.openWindow() self.theEntityListInstanceMap[ anEntityListWindow ] = None self.updateFundamentalWindows()
|
self.theEntityListInstanceMap[ anEntityListWindow ] = None
|
def createEntityListWindow( self ): """creates and returns an EntityListWindow """ anEntityListWindow = None
|
aVariableID[0] = '(' + aVariableID[0]+ '/'+ aReactionPath[aLastSlash+1:] + '/' + 'N_A)'
|
if( aVariableReference[1][aLastColon+1:] == 'SIZE' ): if ( aReactionPath == '/' ): aVariableID[0] = 'default' else: aVariableID[0] = aReactionPath[aLastSlash+1:] else: if ( aReactionPath == '/' ): aVariableID[0] = '(' + aVariableID[0]+ '/default/N_A)' else: aVariableID[0] = '(' + aVariableID[0]+ '/'+ aReactionPath[aLastSlash+1:] + '/N_A)'
|
def p_expression_variablereference(t): 'VariableReference : NAME COMMA NAME'
|
aVariableID[0] = '(' + aVariableID[0] + '/'+ aSystemPath[aLastSlash+1:] + '/' + 'N_A)'
|
if( aVariableReference[1][aLastColon+1:] == 'SIZE' ): if ( aSystemPath == '/' ): aVariableID[0] = 'default' else: aVariableID[0] = aSystemPath[aLastSlash+1:] else: if ( aSystemPath == '/' ): aVariableID[0] = '(' + aVariableID[0] + '/default/N_A)' else: aVariableID[0] = '(' + aVariableID[0] + '/'+ aSystemPath[aLastSlash+1:] + '/N_A)'
|
def p_expression_variablereference(t): 'VariableReference : NAME COMMA NAME'
|
lex.lex( lextab=lextabname, optimize=1 ) return yacc.yacc( optimize=1, tabmodule=yacctabname )
|
lex.lex() return yacc.yacc()
|
def initializePLY(): lextabname = "expressionlextab" yacctabname = "expressionparsetab" lex.lex( lextab=lextabname, optimize=1 )
|
aFastColon = string.index( aVariableReference, ':' )
|
aFirstColon = string.index( aVariableReference, ':' )
|
def getVariableReferenceId( aVariableReference ): aFastColon = string.index( aVariableReference, ':' ) aLastColon = string.rindex( aVariableReference, ':' ) # set Species Id to Reactant object if ( aVariableReference[aFastColon+1:aLastColon] == '.' ): aSpeciesReferencePath = string.replace( aReactionPath[1:], '/', '_S_' ) else: aSpeciesReferencePath = string.replace( aVariableReference[aFastColon+2:aLastColon], '/', '_S_' ) return aSpeciesReferencePath + '_' + aVariableReference[aLastColon+1:]
|
if ( aVariableReference[aFastColon+1:aLastColon] == '.' ): aSpeciesReferencePath = string.replace( aReactionPath[1:], '/', '_S_' )
|
if ( aVariableReference[aFirstColon+1:aLastColon] == '.' ): if ( aReactionPath[1:] == '' ): return aVariableReference[aLastColon+1:] else: aSpeciesReferencePath = string.replace( aReactionPath[1:], '/', '__' ) elif ( aVariableReference[aFirstColon+1:aLastColon] == '/' ): return aVariableReference[aLastColon+1:]
|
def getVariableReferenceId( aVariableReference ): aFastColon = string.index( aVariableReference, ':' ) aLastColon = string.rindex( aVariableReference, ':' ) # set Species Id to Reactant object if ( aVariableReference[aFastColon+1:aLastColon] == '.' ): aSpeciesReferencePath = string.replace( aReactionPath[1:], '/', '_S_' ) else: aSpeciesReferencePath = string.replace( aVariableReference[aFastColon+2:aLastColon], '/', '_S_' ) return aSpeciesReferencePath + '_' + aVariableReference[aLastColon+1:]
|
aSpeciesReferencePath = string.replace( aVariableReference[aFastColon+2:aLastColon], '/', '_S_' ) return aSpeciesReferencePath + '_' + aVariableReference[aLastColon+1:]
|
aSpeciesReferencePath = string.replace( aVariableReference[aFirstColon+2:aLastColon], '/', '__' ) return aSpeciesReferencePath + '__' + aVariableReference[aLastColon+1:]
|
def getVariableReferenceId( aVariableReference ): aFastColon = string.index( aVariableReference, ':' ) aLastColon = string.rindex( aVariableReference, ':' ) # set Species Id to Reactant object if ( aVariableReference[aFastColon+1:aLastColon] == '.' ): aSpeciesReferencePath = string.replace( aReactionPath[1:], '/', '_S_' ) else: aSpeciesReferencePath = string.replace( aVariableReference[aFastColon+2:aLastColon], '/', '_S_' ) return aSpeciesReferencePath + '_' + aVariableReference[aLastColon+1:]
|
gobject.timeout_add( self.delay-50, LogoAnimation.animate, self )
|
gobject.timeout_add( 60, LogoAnimation.animate, self )
|
def animate( self ): if ( self.__running ):
|
self.realtimeVisible = False
|
self.timerVisible = False
|
def __init__( self, aSession ):
|
'on_sec_step_entry_activate' : self.__setStepSizeOrSec, 'on_real_time_clear_button_clicked' : self.__clearRealTime, 'on_load_model_button_clicked' : self.__openFileSelection,
|
'on_sec_step_entry_activate' : self.__setStepSizeOrSec, 'on_timer_clear_button_clicked' : self.__clearTimer, 'on_load_model_button_clicked' : self.__openFileSelection,
|
def openWindow( self ):
|
'on_real_time_activate' : self.__displayRealtime,
|
'on_timer_activate' : self.__displayTimer,
|
def openWindow( self ):
|
self['real_time_entry'].set_text( str( 0 ) ) self['real_time_entry'].modify_base( gtk.STATE_NORMAL,
|
self['timer_entry'].set_text( str( 0 ) ) self['timer_entry'].modify_base( gtk.STATE_NORMAL,
|
def openWindow( self ):
|
self['real_time_entry'].set_property( 'xalign', 1 ) self['real_time_box'].hide()
|
self['timer_entry'].set_property( 'xalign', 1 ) self['timer_box'].hide()
|
def openWindow( self ):
|
self['real_time_clear_button'].set_sensitive(aDataLoadedStatus)
|
self['timer_clear_button'].set_sensitive(aDataLoadedStatus)
|
def __setMenuAndButtonsStatus( self, aDataLoadedStatus ): """sets initial widgets status aDataLoadedStatus -- the status of loading data (TRUE:Model or Script is loaded / FALSE:Not loaded) Returns None """
|
self.theEntityListWindow.setSession( self.theSession )
|
self.theEntityListWindow.initializeComponents( self.theSession )
|
def __loadData( self, *arg ) : """loads model or script file arg[0] --- ok button of FileSelection arg[1] --- 'Model'/'Script' (str) Return None """
|
aRealTime = time.time()
|
def update( self ): """updates this window Returns None """ if not self.exists(): return None # updates time aTime = self.theSession.theSimulator.getCurrentTime() self.theCurrentTime = aTime self['time_entry'].set_text( str( self.theCurrentTime ) ) self['sec_step_entry'].set_text( str( self.theStepSizeOrSec ) )
|
|
self.realtimeVisible ): self['real_time_entry'].set_text( str( round( aRealTime - self.startTime + self.tempTime, 2 ) ) )
|
self.timerVisible ): self['timer_entry'].set_text( self.getCurrentTime( time.time() - self.startTime + self.tempTime ) )
|
def update( self ): """updates this window Returns None """ if not self.exists(): return None # updates time aTime = self.theSession.theSimulator.getCurrentTime() self.theCurrentTime = aTime self['time_entry'].set_text( str( self.theCurrentTime ) ) self['sec_step_entry'].set_text( str( self.theStepSizeOrSec ) )
|
aRealTime = time.time()
|
def update( self ): """updates this window Returns None """ if not self.exists(): return None # updates time aTime = self.theSession.theSimulator.getCurrentTime() self.theCurrentTime = aTime self['time_entry'].set_text( str( self.theCurrentTime ) ) self['sec_step_entry'].set_text( str( self.theStepSizeOrSec ) )
|
|
def getCurrentTime( self, aTime ): theTime = self.datetime.fromtimestamp( aTime ) return str( theTime.hour-9 )+" : "+str( theTime.minute ) + " : " + str( theTime.second )
|
def update( self ): """updates this window Returns None """ if not self.exists(): return None # updates time aTime = self.theSession.theSimulator.getCurrentTime() self.theCurrentTime = aTime self['time_entry'].set_text( str( self.theCurrentTime ) ) self['sec_step_entry'].set_text( str( self.theStepSizeOrSec ) )
|
|
def __displayRealtime( self, *arg ):
|
def __displayTimer( self, *arg ):
|
def __displayRealtime( self, *arg ): # show Indicator
|
if self.realtimeVisible: self['real_time_box'].hide() self.realtimeVisible = False
|
if self.timerVisible: self['timer_box'].hide() self.setTimerActive(False) self.timerVisible = False
|
def __displayRealtime( self, *arg ): # show Indicator
|
self['real_time_box'].show() self.realtimeVisible = True
|
self['timer_box'].show() self.setTimerActive(True) self.timerVisible = True
|
def __displayRealtime( self, *arg ): # show Indicator
|
self['real_time_entry'].set_text( str(0.0) )
|
self['timer_entry'].set_text( "0 : 0 : 0" )
|
def __displayRealtime( self, *arg ): # show Indicator
|
self['real_time_entry'].set_text( str( round( self.tempTime, 2 ) ) )
|
self['timer_entry'].set_text( self.getCurrentTime( self.tempTime ) )
|
def __displayRealtime( self, *arg ): # show Indicator
|
self['real_time_entry'].set_text( str( round( time.time() - self.startTime + self.tempTime, 2 ) ) )
|
self['timer_entry'].set_text( self.getCurrentTime( time.time() - self.startTime + self.tempTime ) ) def setIndicatorActive( self, isActive ): self['run_speed_indicator'].set_active(isActive) ( self['indicator_button'].get_child() ).set_active(isActive) def setTimerActive( self, isActive ): self['timer_menu'].set_active(isActive) ( self['timer_button'].get_child() ).set_active(isActive)
|
def __displayRealtime( self, *arg ): # show Indicator
|
def __clearRealTime( self, *arg ): self['real_time_entry'].set_text( str(0.0) )
|
def __clearTimer( self, *arg ): self['timer_entry'].set_text( "0 : 0 : 0" )
|
def __clearRealTime( self, *arg ):
|
anEntityListWindow = EntityListWindow.EntityListWindow( None, rootWidget, aStatusBar )
|
anEntityListWindow = EntityListWindow.EntityListWindow( self, rootWidget, aStatusBar )
|
def createEntityListWindow( self, rootWidget = 'EntityListWindow', aStatusBar=None ): """creates and returns an EntityListWindow """ anEntityListWindow = None
|
elif self.theUpdateInterval >300: self.theUpdateInterval /=2
|
elif self.theUpdateInterval >=225: self.theUpdateInterval /=1.5
|
def __updateByTimeOut( self, arg ): """when time out, calls updates method() Returns None """ if not gtk.events_pending(): self.updateWindows() if self.stuckRequests > 0: self.stuckRequests -= 1 elif self.theUpdateInterval >300: self.theUpdateInterval /=2 else: self.stuckRequests +=1 if self.stuckRequests >20: self.theUpdateInterval *= 2 self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.__updateByTimeOut, 0 )
|
if self.stuckRequests >20: self.theUpdateInterval *= 2 self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.__updateByTimeOut, 0 )
|
if self.stuckRequests >6: self.theUpdateInterval *= 1.5 self.stuckRequests = 3 self.theTimer = gtk.timeout_add( int(self.theUpdateInterval), self.__updateByTimeOut, 0 )
|
def __updateByTimeOut( self, arg ): """when time out, calls updates method() Returns None """ if not gtk.events_pending(): self.updateWindows() if self.stuckRequests > 0: self.stuckRequests -= 1 elif self.theUpdateInterval >300: self.theUpdateInterval /=2 else: self.stuckRequests +=1 if self.stuckRequests >20: self.theUpdateInterval *= 2 self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.__updateByTimeOut, 0 )
|
self.theFileMap[aKey].setFileName(aFileName) self.theFileMap[aKey].save()
|
self.theFileMap[aKey].save(aFileName)
|
def saveAll(self):
|
anEml = ecell.eml.Eml()
|
anEml = anEmlObject
|
def convertEm2Eml( anEmFileObject, debug=0 ): # initialize eml object global anEml anEml = ecell.eml.Eml() # Build the lexer aLexer = lex.lex(lextab="emlextab") # Tokenizen test.. #while debug == 1: # Give the lexer some input for test # lex.input(anEmFileObject.read()) # tok = aLexer.token( anEmFileObject.read() ) # if not tok: break # No more input # print tok # Parsing aParser = yacc.yacc(optimize=1, tabmodule="emparsetab") anAst = aParser.parse( anEmFileObject.read(), lexer=aLexer ,debug=debug ) import pprint if debug != 0: print pprint.pprint(anAst) if anAst == None: sys.exit(0) return anEml
|
def synchronize(self): self.updateWindows() while gtk.events_pending(): gtk.main_iteration_do() def GUI_interact(self):
|
def GUI_interact(self):
|
def __init__(self, aSimulator = None ): """sets up the osogo session, creates Mainwindow and other fundamental windows but doesn't show them"""
|
self.updateWindows()
|
if not gtk.events_pending(): self.updateWindows()
|
def __updateByTimeOut( self, arg ): """when time out, calls updates method() Returns None """ self.updateWindows() self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.__updateByTimeOut, 0 )
|
aVarobj = aLayout.getObject( newVariableID )
|
def __pasteConnectionObjectBuffer( self, aLayout, conBuffer, translationList ): anID = conBuffer.getID() processID = conBuffer.getProperty( CO_PROCESS_ATTACHED )
|
|
conObject = aLayout.getObject( newID )
|
def __pasteConnectionObjectBuffer( self, aLayout, conBuffer, translationList ): anID = conBuffer.getID() processID = conBuffer.getProperty( CO_PROCESS_ATTACHED )
|
|
propertyList = conBuffer.getPropertyList() for aProperty in propertyList:
|
def __pasteConnectionObjectBuffer( self, aLayout, conBuffer, translationList ): anID = conBuffer.getID() processID = conBuffer.getProperty( CO_PROCESS_ATTACHED )
|
|
if aProperty not in (CO_ENDPOINT1, CO_ENDPOINT2, CO_PROCESS_ATTACHED, CO_VARIABLE_ATTACHED): aValue = conBuffer.getProperty( aProperty ) conObject.setProperty( aProperty, aValue )
|
def __pasteConnectionObjectBuffer( self, aLayout, conBuffer, translationList ): anID = conBuffer.getID() processID = conBuffer.getProperty( CO_PROCESS_ATTACHED )
|
|
return newID
|
def __pasteConnectionObjectBuffer( self, aLayout, conBuffer, translationList ): anID = conBuffer.getID() processID = conBuffer.getProperty( CO_PROCESS_ATTACHED )
|
|
if type( aModel ) == type( eml.Eml ) or\ type( aModel ) == type( eml.Eml() ):
|
if type( aModel ) != type( eml.Eml ) and\ 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.
|
self.thePluginManager.updateFandamentalWindows()
|
self.thePluginManager.updateFundamentalWindows()
|
def setValue( self, aFullPN, aValue ):
|
self.thePluginManager.updateFandamentalWindows()
|
self.thePluginManager.updateFundamentalWindows()
|
def createLogger( self, *objects ):
|
self.thePluginManager.updateFandamentalWindows()
|
self.thePluginManager.updateFundamentalWindows()
|
def changeFullPN( self, anObject ):
|
self.setFunctionDefinitionToDictionaly() def setFunctionDefinitionToDictionaly( self ):
|
self.setFunctionDefinitionToDictionary() def setFunctionDefinitionToDictionary( self ):
|
def __init__( self, aSBMLDocument, aSBMLmodel ):
|
return aSpecies[9]
|
return 1
|
def getConstant( self, aSpecies ):
|
return aSpecies[11]
|
return 1
|
def getConstant( self, aSpecies ):
|
if event.button = gtk.gdk._2BUTTON_PRESS
|
if event.button == gtk.gdk._2BUTTON_PRESS:
|
def __buttonPressed( self, *args ): event = args[2] if event.button = gtk.gdk._2BUTTON_PRESS self.__popUpMenu() return gtk.TRUE
|
selectedFullID = self.__getSelectedFullID() if selectedFullID == None: isFullIDReal = False else: isFullIDReal = self.__doesExistEntity( selectedFullID ) openItem = gtk.MenuItem( "Open" ) if isFullIDReal: openItem.connect( "activate", self.__openAction, selectedFullID ) else: openItem.set_sensitive( gtk.FALSE ) aMenu.append( openItem ) openNewItem = gtk.MenuItem( "Open in new" ) if isFullIDReal: openNewItem.connect( "activate", self.__openNewAction, selectedFullID ) else: openNewItem.set_sensitive( gtk.FALSE ) aMenu.append( openNewItem ) aMenu.append( gtk.SeparatorMenuItem() )
|
def __popUpMenu(self ): aMenu = gtk.Menu() addItem = gtk.MenuItem( "Add" ) addItem.connect("activate", self.__addAction ) aMenu.append( addItem ) selectedIter = self.__getSelectedIter() if selectedIter != None:
|
|
selectedIter = self.__getSelectedIter()
|
deleteItem = gtk.MenuItem( "Delete" )
|
def __popUpMenu(self ): aMenu = gtk.Menu() addItem = gtk.MenuItem( "Add" ) addItem.connect("activate", self.__addAction ) aMenu.append( addItem ) selectedIter = self.__getSelectedIter() if selectedIter != None:
|
deleteItem.connect( "activate", self.__deleteAction, anIter ) else: deleteItem.set_sensitive( gtk.FALSE ) aMenu.append( addItem ) aMenu.popup( None, None, None, 1, 0 ) def __openAction( self, *args ): aFullIDString = args[1] self.theSession.thePluginManager.createInstance( "PropertyWindow", [convertFullIDToFullPN( aFullIDString.split(':') )] ) def __openNewAction ( self, *args ): pass def __addAction ( self, *args ): pass def __deleteAction( self, *args ): pass def __getSelectedFullID( self ): anIter = self.__getSelectedIter() if anIter == None: return None aVarref = self.theListStore.get_value( anIter, FULLID_COLUMN ) return self.__getAbsoluteReference( aVarref )
|
def __popUpMenu(self ): aMenu = gtk.Menu() addItem = gtk.MenuItem( "Add" ) addItem.connect("activate", self.__addAction ) aMenu.append( addItem ) selectedIter = self.__getSelectedIter() if selectedIter != None:
|
|
if os.access( gladefile, os.R_OK ):
|
if os.access( os.path.join( GLADEFILE_PATH, gladefile ), os.R_OK ):
|
def __init__( self, gladefile=None, root=None ):
|
t[0] = createList( 'stmts', t)
|
t[0] = createListleft( t )
|
def p_stmts(t): ''' stmts : stmts stmt | stmt ''' t[0] = createList( 'stmts', t)
|
t[0] = createList( 'stmt', t )
|
t[0] = t[1]
|
def p_stmt(t): ''' stmt : stepper_stmt | system_stmt ''' t[0] = createList( 'stmt', t )
|
t[0] = t[1], t[2], t[4]
|
t[0] = t[1], t[3]
|
def p_stepper_stmt(t): ''' stepper_stmt : stepper_object_decl LBRACE propertylist RBRACE ''' t[0] = t[1], t[2], t[4]
|
t[0] = t[1], t[2], t[4]
|
t[0] = t[1], t[3]
|
def p_system_stmt(t): ''' system_stmt : system_object_decl LBRACE property_entity_list RBRACE ''' t[0] = t[1], t[2], t[4]
|
t[4] = flatten_propertylist(t[4]) t[0] = t[1], t[2], t[4]
|
t[0] = t[1], t[3]
|
def p_entity_other_stmt (t): ''' entity_other_stmt : entity_other_object_decl LBRACE propertylist RBRACE ''' t[4] = flatten_propertylist(t[4]) t[0] = t[1], t[2], t[4]
|
propertylist : property propertylist
|
propertylist : propertylist property
|
def p_propertylist(t): ''' propertylist : property propertylist | property | empty ''' t[0] = createList( 'propertylist', t )
|
t[0] = createList( 'propertylist', t )
|
t[0] = createListleft( t )
|
def p_propertylist(t): ''' propertylist : property propertylist | property | empty ''' t[0] = createList( 'propertylist', t )
|
t[2] = flatten_nodelist(t[2])
|
if type(t[2]) == str: t[2] = [t[2]]
|
def p_property(t): ''' property : name value SEMI ''' t[2] = flatten_nodelist(t[2]) if t.type == 'Stepper': anEml.setStepperProperty(t.id, t[1], t[2]) else: anEml.setEntityProperty(t.fullid, t[1], t[2]) t[0] = t[1], t[2]
|
t[0] = createList( 'property_entity_list', t )
|
t[0] = createListleft( t )
|
def p_property_entity_list(t): ''' property_entity_list : property_entity_list property_entity | property_entity | empty ''' t[0] = createList( 'property_entity_list', t )
|
t[0] = createList( 'property_entity', t )
|
t[0] = t[1]
|
def p_property_entity(t): ''' property_entity : property | entity_other_stmt ''' t[0] = createList( 'property_entity', t )
|
t[0] = createList( 'value', t )
|
t[0] = t[1]
|
def p_value(t): ''' value : quotedstring | name | number | matrixlist ''' t[0] = createList( 'value', t )
|
t[0] = createList( 'valuelist', t )
|
t[0] = createListleft( t )
|
def p_valuelist(t): ''' valuelist : value valuelist | value ''' t[0] = createList( 'valuelist', t )
|
t[0] = flatten_nodetree(t[2])
|
t[0] = t[2]
|
def p_matrix(t): ''' matrix : LBRACKET valuelist RBRACKET ''' t[0] = flatten_nodetree(t[2])
|
t[0] = createList( 'matrixlist', t )
|
t[0] = createListleft( t )
|
def p_matrixlist(t): ''' matrixlist : matrix matrixlist | matrix ''' t[0] = createList( 'matrixlist', t )
|
def createList( type, t): length = len(t.slice) - 1 if length != 1: aList = [] i = 1 while i <= length: aList.append( t[i] ) i = i + 1
|
def createListleft( t ): if hasattr(t, 'slice'): length = len(t.slice) - 1 else: return [t] if length == 2: aList = t[1] aList.append( t[2] )
|
def createList( type, t): length = len(t.slice) - 1 if length != 1: aList = [] i = 1 while i <= length: aList.append( t[i] ) i = i + 1 return aList elif t[1] == None: return [] else: return t[1]
|
return t[1] def flatten_propertylist( node ): if node is None or len( node ) == 0: return [] aList = list() while len( node ) >= 1: if len( node ) == 1 and type(node) != str: break elif type(node[0]) == str: aList.append( node ) break else: aList.append( node[0] ) node = node[1] return aList def flatten_nodelist( node ): if node is None or len( node ) == 0: return [] aList = list() while len( node ) >= 1: if len( node ) == 1 and type(node) != str: break elif type(node[0]) == str: aList.append( node ) break else: aList.append( node[0] ) node = node[1] return aList def flatten_nodetree( node ): if node is None or len( node ) == 0: return [] aList = list() while len( node ) >= 1: if type(node) == str: aList.append( node ) break elif len( node ) == 1 : break else: aList.append( node[0] ) node = node[1] return aList def flatten_node( node ): if len( node ) == 1: return node[0] else: return flatten_propertytree( node[1] ) def flatten_propertytree( node ): return map( flatten_node, flatten_nodetree( node ) )
|
return [t[1]]
|
def createList( type, t): length = len(t.slice) - 1 if length != 1: aList = [] i = 1 while i <= length: aList.append( t[i] ) i = i + 1 return aList elif t[1] == None: return [] else: return t[1]
|
aSession.message( Message )
|
aSession.message( aMessage )
|
def main(): # ------------------------------------- # initialize file names # ------------------------------------- anEmlFile = None anEssFile = None # ------------------------------------- # gets options # ------------------------------------- try: opts , args = getopt.getopt( sys.argv[1:] , 'he:f:', ["help", "exec=", "file="]) except: usage() sys.exit(1) # ------------------------------------- # checks argument # ------------------------------------- for anOption, anArg in opts: # prints help message if anOption in ( "-h", '--help' ): usage() sys.exit(0) # executes script file (.ess) if anOption in ( "-e", '--exec'): anEssFile = anArg # load model file (.eml) if anOption in ( "-f", '--file' ): anEmlFile = anArg # ------------------------------------- # prohibits to use -e and -f options # ------------------------------------- if anEmlFile != None and anEssFile != None: usage() sys.exit(0) # ------------------------------------- # creates an instance of GtkSession and # creates MainWindow instance # ------------------------------------- aSession = ecell.GtkSessionMonitor.GtkSessionMonitor() # ------------------------------------- # executes options # ------------------------------------- # load model file (.eml) if anEmlFile != None: # check EML File if os.path.isfile( anEmlFile ): pass else: aMessage = " Error ! [%s] No such file. \n" %anEmlFile aSession.message( Message ) sys.exit(1) # print message aSession.message("%s is loaded.\n" %anEmlFile ) # load model try: aSession.loadModel( anEmlFile ) except: aSession.message(' can\'t load [%s]' %anEmlFile) anErrorMessage = string.join( traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback), '\n' ) aSession.message("-----------") aSession.message(anErrorMessage) aSession.message("-----------") else: # initialize & update windows aSession.theSimulator.initialize() aMainWindow = aSession.openWindow('MainWindow') aSession.updateWindows() # executes script file (.ess) elif anEssFile != None: # check ESS File if os.path.isfile( anEssFile ): pass else: aMessage = " Error ! [%s] No such file. \n" %anEssFile aSession.message( aMessage ) sys.exit(1) # print message on MainWindow aSession.message("%s is being loaded and executed.\n" %anEssFile ) gtk.timeout_add( 1, loadScript, [aSession, anEssFile] ) else: aMainWindow = aSession.openWindow('MainWindow') # ------------------------------------- # calls gtk.mainloop() # ------------------------------------- aSession.GUI_interact()
|
createLayout deleteLayout renameLayout cloneLayout pastelayout copylayout
|
def __checkArgs( self ): if type (self._Command__theReceiver) == 'object': if self._Command__theReceiver.__class__.__name__ == 'Layout': return True
|
|
createobject deleteobject changeobjectProperty copyobject cutobject pasteobject moveobject resize object
|
def __checkArgs( self ): if type (self._Command__theReceiver) == 'object': if self._Command__theReceiver.__class__.__name__ == 'Layout': return True
|
|
createConnection redirectConnection
|
def __checkArgs( self ): if type (self._Command__theReceiver) == 'object': if self._Command__theReceiver.__class__.__name__ == 'Layout': return True
|
|
rightLimit = self.thePlot.thePlotAreaBox[2] + 1
|
rightLimit = self.thePlot.thePlotAreaBox[2] - 1
|
def drawPoint(self, aColor, x, y, lastx, lasty ): #get datapoint x y values
|
s.step()
|
for i in xrange( 1000 ): s.step() printProperty( s, ( SYSTEM, '/', '/', 'CurrentTime' ) ) printProperty( s, ( SYSTEM, '/', '/', 'StepInterval' ) ) printProperty( s, ( SYSTEM, '/', 'CYTOPLASM', 'StepInterval' ) )
|
def printList( sim, primitivetype, systempath,list ): for i in list: printAllProperties( sim, ( primitivetype, systempath, i ) )
|
print aNode.nodeName
|
def getSBaseAnnotation( sbaseObj, pn, aXMLNamespaceList ): propertyName = '%s:%s' % ( ECELL_XML_NAMESPACE_PREFIX, pn ) if sbaseObj.isSetAnnotation(): annotationString = '<xml' for i in range( aXMLNamespaceList.getLength() ): annotationString += ' xmlns:%s="%s"' % ( aXMLNamespaceList.getPrefix( i ), aXMLNamespaceList.getURI( i ) ) annotationString = '%s>%s</xml>' % ( annotationString, sbaseObj.getAnnotation() ) annotationDoc = xml.dom.minidom.parseString( annotationString ) annotationNode = annotationDoc.childNodes[ 0 ].childNodes[ 0 ] targetNode = None for aNode in annotationNode.childNodes: print aNode.nodeName if str( aNode.nodeName ) == propertyName: targetNode = aNode break if targetNode != None: if len( targetNode.childNodes ) != 1: raise SBMLConvertError, 'Annotation [%s] is invalid' % ( propertyName ) return targetNode.childNodes[ 0 ].data annotationDoc.unlink() return None
|
|
property : name value SEMI
|
property : name valuelist SEMI
|
def p_property(t): ''' property : name value SEMI ''' if type(t[2]) == str: t[2] = [t[2]] if t.type == 'Stepper': anEml.setStepperProperty(t.id, t[1], t[2]) else: anEml.setEntityProperty(t.fullid, t[1], t[2]) t[0] = t[1], t[2]
|
| matrixlist ''' t[0] = t[1]
|
| LBRACKET valuelist RBRACKET ''' if t[1] == '[': t[0] = t[2] else: t[0] = t[1]
|
def p_value(t): ''' value : quotedstring | name | number | matrixlist ''' t[0] = t[1]
|
def p_matrix(t): ''' matrix : LBRACKET valuelist RBRACKET ''' t[0] = t[2] def p_matrixlist(t): ''' matrixlist : matrixlist matrix | matrix ''' t[0] = createListleft( t )
|
def p_matrix(t): ''' matrix : LBRACKET valuelist RBRACKET ''' t[0] = t[2]
|
|
print aSubSystemList
|
def __loadEntity( self, aSystemPath='/' ):
|
|
self['increase_button'].set_relief( gtk.RELIEF_HALF ) self['decrease_button'].set_relief( gtk.RELIEF_HALF ) self.addHandlers( { 'input_value' :self.inputValue, 'increase_value' :self.increaseValue, 'decrease_value' :self.decreaseValue, 'window_exit' :self.exit, 'test' :self.test } )
|
self.addHandlers( { 'on_value_frame_changed' :self.inputValue, 'on_increase_button_clicked' :self.increaseValue, 'on_decrease_button_clicked' :self.decreaseValue, 'on_DigitalWindow_delete_event' :self.exit } )
|
def __init__( self, aDirName, aData, aPluginManager, aRoot=None ):
|
def inputValue( self, obj ): aValue = string.atof(obj.get_text()) self.setValue( self.theFullPN(), aValue )
|
def update( self ):
|
|
def test( self, obj ): print 'you did it'
|
def test( self, obj ): print 'you did it'
|
|
print "yacc: Syntax error at line %d, token=%s" % (lineno, errtoken.type)
|
print "yacc: Syntax error at line %s, token=%s, in %s" % (lineno, errtoken.type, errtoken.lexer.filename)
|
def parse(self,input=None,lexer=None,debug=0): lookahead = None # Current lookahead symbol lookaheadstack = [ ] # Stack of lookahead symbols actions = self.action # Local reference to action table goto = self.goto # Local reference to goto table prod = self.productions # Local reference to production list pslice = YaccSlice(None) # Slice object passed to grammar rules pslice.parser = self # Parser object self.errorcount = 0 # Used during error recovery
|
print self.theEntityListStore.get_value(iter,0)
|
def listEntity( self, aEntityTypeString, aSystemFullID ):
|
|
aFileName = os.path.expanduser( RECENTFILELIST_FILENAME )
|
aFileName = self.__getHomeDir() + os.sep + RECENTFILELIST_FILENAME
|
def __loadRecentFileList ( self ): """ in: nothing returns nothing """ self.__theRecentFileList = [] aFileName = os.path.expanduser( RECENTFILELIST_FILENAME )
|
aTargetSystem.removeChild( aPropertyNode )
|
aTargetNode.removeChild( aChild )
|
def deleteEntityProperty( self, aFullID, aPropertyName ):
|
self.thePlotArea[2] - 2, self.thePlotArea[3] -2 )
|
self.thePlotArea[2] - 1, self.thePlotArea[3] -1 )
|
def clearPlotarea(self): self.drawBox( PLOTAREA_COLOR, self.thePlotArea[0] + 1, self.thePlotArea[1] + 1, self.thePlotArea[2] - 2, self.thePlotArea[3] -2 )
|
anInstance[anInstance.__class__.__name__].destroy()
|
if anInstance[anInstance.__class__.__name__] != None: anInstance[anInstance.__class__.__name__].destroy()
|
def removeInstance( self, anInstance ):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.