rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def saveCellState ( self, button_obj ) :
def saveCellState ( self, obj ) :
def saveCellState ( self, button_obj ) : pass
def startSimulation( self, a ) : self.theSession.theSimulator.initialize() 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()
def startSimulation( self, obj ) : try: self.theRunningFlag = 1 self.theSession.theSimulator.initialize() self.theSession.printMessage( "Start\n" ) self.theTimer = gtk.timeout_add(self.theUpdateInterval, self.updateByTimeOut, 0) self.theLoggerWindow.update() self.theSession.run() self.removeTimeOut() except: self.theRunningFlag = 0 import sys import traceback aErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback) self.theMessageWindow.printMessage(aErrorMessage) else: pass
def startSimulation( self, a ) :
def stopSimulation( self, a ) : if self.theRunningFlag:
def stopSimulation( self, obj ) : try: if self.theRunningFlag: self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update() except: import sys import traceback aErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback) self.theMessageWindow.printMessage(aErrorMessage) else:
def stopSimulation( self, a ) : if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
self.theSession.stop() self.theSession.printMessage( "Stop\n" )
def stepSimulation( self, obj ) : try: self.theSession.theSimulator.initialize() 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 )
def stopSimulation( self, a ) : if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
def stepSimulation( self, a ) : self.theSession.theSimulator.initialize() 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()
except: import sys import traceback aErrorMessage = traceback.format_exception(sys.exc_type,sys.exc_value,sys.exc_traceback) self.theMessageWindow.printMessage(aErrorMessage) else: pass
def stopSimulation( self, a ) : if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
def changeStepType ( self, a ):
def changeStepType ( self, obj ):
def changeStepType ( self, a ): self.theStepType = 1 - self.theStepType
def updateByTimeOut( self, a ):
def updateByTimeOut( self, obj ):
def updateByTimeOut( self, a ): self.update() self.theTimer = gtk.timeout_add( self.theUpdateInterval, self.updateByTimeOut, 0 )
self.theEntryListWindowWindow = self.theEntryListWindow[ 'entry_list_window' ]
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.theStepperChecker == 0 and self.theEntryChecker == 0: self.theSession.printMessage( 'WARNING:need load model or script!!\n' ) if self.theEntryChecker == 1: if button_obj.get_active() : self.theEntryListWindowWindow.show_all() self.theEntryListWindow.update() else : self.theEntryListWindowWindow.hide()
if button_obj.get_active() : self.theEntryListWindowWindow.show_all() self.theEntryListWindow.update() else : self.theEntryListWindowWindow.hide()
if button_obj.get_active(): if ( self.theEntryListWindow.getExist() == 0 ): self.theEntryListWindow = EntryListWindow.EntryListWindow( self ) else: self.theEntryListWindow['EntryListWindow'].show_all() else: if ( self.theEntryListWindow.getExist() == 0 ): pass else: self.theEntryListWindow['EntryListWindow'].hide()
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.theStepperChecker == 0 and self.theEntryChecker == 0: self.theSession.printMessage( 'WARNING:need load model or script!!\n' ) if self.theEntryChecker == 1: if button_obj.get_active() : self.theEntryListWindowWindow.show_all() self.theEntryListWindow.update() else : self.theEntryListWindowWindow.hide()
self.theLoggerWindowWindow.show_all() self.theLoggerWindow.update() else : self.theLoggerWindowWindow.hide()
if ( self.theLoggerWindow.getExist() == 0 ): self.theLoggerWindow = LoggerWindow.LoggerWindow( self.theSession , self ) self.theLoggerWindow.update() else: self.theLoggerWindow['LoggerWindow'].show_all() else: if ( self.theLoggerWindow.getExist() == 0 ): pass else: self.theLoggerWindow['LoggerWindow'].hide()
def toggleLoggerWindow( self, button_obj ):
self.theMessageWindowWindow.show_all() else : self.theMessageWindowWindow.hide()
if ( self.theMessageWindow.getExist() == 0 ): self.theMessageWindow.openWindow() else: self.theMessageWindow['MessageWindow'].show_all() else: if ( self.theMessageWindow.getExist() == 0 ): pass else: self.theMessageWindow['MessageWindow'].hide()
def toggleMessageWindow( self, button_obj ) :
def initializePaletteWindow( self ): self.thePaletteWindow = PaletteWindow.PaletteWindow() self.thePaletteWindow.setPluginList( self.thePluginManager.thePluginMap )
def openPreferences( self, button_obj ): aPropertyBox = gnome.ui.GnomePropertyBox() aLabel = gtk.GtkLabel( 'NOT IMPLEMENTED YET' ) aTabLabel = gtk.GtkLabel( 'warning' ) aPropertyBox.append_page( aLabel, aTabLabel )
if button_obj.get_active() :
if button_obj.get_active(): if self.thePaletteWindow.getExist() == 0: self.initializePaletteWindow() else: pass
def togglePaletteWindow( self, button_obj ) : if button_obj.get_active() : self.thePaletteWindow.show_all() else : self.thePaletteWindow.hide()
else : self.thePaletteWindow.hide()
else: if self.thePaletteWindow.getExist() == 0: pass else: self.thePaletteWindow.hide()
def togglePaletteWindow( self, button_obj ) : if button_obj.get_active() : self.thePaletteWindow.show_all() else : self.thePaletteWindow.hide()
self.theInterfaceWindowWindow.show_all() else : self.theInterfaceWindowWindow.hide() def saveCellStateToTheFile( self ) : pass
if ( self.theInterfaceWindow.getExist() == 0 ): self.theInterfaceWindow.openWindow() self.theInterfaceWindow.update() else: self.theInterfaceWindow['InterfaceWindow'].show_all() else: if ( self.theInterfaceWindow.getExist() == 0 ): pass else: self.theInterfaceWindow['InterfaceWindow'].hide() def saveCellStateToTheFile( self ): pass
def toggleInterfaceListWindow( self, button_obj ) : if button_obj.get_active() : self.theInterfaceWindowWindow.show_all() else : self.theInterfaceWindowWindow.hide()
aPropertyValueList = [] for aChildNode in anEntityPropertyNode.childNodes: if aChildNode.tagName == 'value': aPropertyValueList.append( self.__createValueList( aChildNode ) ) return aPropertyValueList
return self.__createValueList( anEntityPropertyNode )
def getEntityProperty( self, aFullPNString ):
aValueList.append( self.__createValueList( aChildNode ) )
if aChildNode.tagName == 'value': aValueList.append( self.__createValueList( aChildNode ) )
def __createValueList( self, aValueNode ): if aValueNode.firstChild.nodeType == minidom.Node.TEXT_NODE:
'on_value_spinbutton_changed' : self.changeValue,
'on_value_spinbutton_changed' : self.changeValue, 'input_value': self.changeValue, 'input_concentration': self.inputConcentration,
def __init__( self, dirname, data, pluginmanager, root=None ): OsogoPluginWindow.__init__( self, dirname, data, pluginmanager, root )
self.theQtyFPN = convertFullIDToFullPN( self.theFullID(), 'Value' ) self.theConcFPN = convertFullIDToFullPN( self.theFullID(), 'Concentration' )
self.theSession = pluginmanager.theSession
def __init__( self, dirname, data, pluginmanager, root=None ): OsogoPluginWindow.__init__( self, dirname, data, pluginmanager, root )
self["id_label"].set_text( aFullIDString ) self.theSession = pluginmanager.theSession self.theValueChangedByTextField = FALSE
self.theStub = self.theSession.createEntityStub( aFullIDString ) self["id_label"].set_text( self.theStub.getName() )
def __init__( self, dirname, data, pluginmanager, root=None ): OsogoPluginWindow.__init__( self, dirname, data, pluginmanager, root )
self.theQtyValue = self.getValue( self.theQtyFPN ) self.theConcValue = self.getValue( self.theConcFPN )
self.theValue = self.theStub.getProperty( 'Value' ) self.theConcValue = self.theStub.getProperty( 'Concentration' ) self.theIsFixed = self.theStub.getProperty( 'Fixed' )
def update( self ):
if self.theValueChangedByTextField == FALSE: self['value_spinbutton'].set_text( str( self.theQtyValue ) )
self['value_spinbutton'].set_text( str( self.theValue ) )
def update( self ):
self.theValueChangedByTextField == FALSE
def update( self ):
self.theFixFlag = 1 - self.theFixFlag if self.theFixFlag == 0: self.theSession.message( "not fixed" ) else: self.theSession.message( "fixed" )
self.theFixFlag = not self.theFixFlag self.theStub.setProperty( 'Fixed', self.theFixFlag )
def fix_mode( self, a ) : self.theFixFlag = 1 - self.theFixFlag if self.theFixFlag == 0: self.theSession.message( "not fixed" ) else: self.theSession.message( "fixed" )
self.theQtyValue = string.atof( aText ) self.theValueChangedByTextField = TRUE self.setValue( self.theQtyFPN, self.theQtyValue )
self.theValue = string.atof( aText ) self.theStub.setProperty( 'Value', self.theValue )
def changeValue( self, obj ):
self.setValue( self.theConcFPN, self.theConcValue )
self.theStub.setProperty( 'Concentration', self.theConcValue )
def inputConcentration( self, obj ): self.theConcValue = string.atof( obj.get_text() ) self.setValue( self.theConcFPN, self.theConcValue )
if self.getValue( self.theQtyFPN ): self.theQtyValue *= 2.0
if self.theStub.getProperty( 'Value' ): self.theValue *= 2.0
def increaseValue( self, button_object ):
self.theQtyValue = 1.0
self.theValue = 1.0
def increaseValue( self, button_object ):
self.setValue( self.theQtyFPN, self.theQtyValue )
self.theStub.setProperty( 'Value', self.theValue )
def increaseValue( self, button_object ):
self.theQtyValue *= 0.5 self.setValue( self.theQtyFPN, self.theQtyValue )
self.theValue *= 0.5 self.setProperty( 'Value', self.theValue ) self.thePluginManager.updateAllPluginWindow()
def decreaseValue( self, button_object ):
self.setValue( self.theConcFPN, self.theConcValue )
self.setProperty( 'Concentration', self.theConcValue )
def increaseConcentration( self, button_object ):
self.setValue( self.theConcFPN, self.theConcValue )
self.setProperty( 'Concentration', self.theConcValue )
def decreaseConcentration( self, button_object ):
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()
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()
def startSimulation( self, a ) : 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()
if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" )
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() 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 )
def stopSimulation( self, a ) : if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
def stepSimulation( self, a ) : 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()
def stopSimulation( self, a ) : if self.theRunningFlag: self.theRunningFlag = 0 self.theSession.stop() self.theSession.printMessage( "Stop\n" ) self.removeTimeOut() self.update() self.theLoggerWindow.update()
if self.theStepperChecker == 1:
if self.theStepperChecker == 1 and self.theEntryChecker == 0:
def toggleEntryList( self, button_obj ):
else: pass if self.theStepperChecker == 1:
self.theEntryChecker = 1 if self.theEntryChecker == 1:
def toggleEntryList( self, button_obj ):
anAttribute = self.theSimulator.getStepperPropertyAttributes( aStepper, aProperty)
anAttributeList = self.theSimulator.getStepperPropertyAttributes( aStepper, aProperty)
def __saveStepper( self , anEml ): """stepper loader"""
if anAttribute[3] != 0: pass else:
if anAttributeList[3] != 0:
def __saveStepper( self , anEml ): """stepper loader"""
anAttribute = self.theSimulator.getEntityPropertyAttributes(aFullPN)
anAttributeList = self.theSimulator.getEntityPropertyAttributes(aFullPN)
def __savePropertyList( self, anEml, anEntityTypeString,\ aSystemPath, anIDList ):
if anAttribute[3] != 0:
if anAttributeList[3] != 0:
def __savePropertyList( self, anEml, anEntityTypeString,\ aSystemPath, anIDList ):
aValue = self.theSimulator.getEntityProperty(aFullPN)
aValue = self.theSimulator.saveEntityProperty(aFullPN)
def __savePropertyList( self, anEml, anEntityTypeString,\ aSystemPath, anIDList ):
self.message( "Zero step value overridden to 1\n" )
def step( self, num = None ): """ step according to num, if num is not given, according to set step parameters """ if self.theRunningFlag == 1: return
anEntityListWindow = self.theSession.createEntityListWindow()
anEntityListWindow = self.theSession.createEntityListWindow( "EntityListWindow", self['statusbar'] )
def __createEntityListWindow( self, *arg ): anEntityListWindow = self.theSession.createEntityListWindow()
aPropertyBox = gnome.ui.GnomePropertyBox() aLabel = gtk.Label( 'NOT IMPLEMENTED YET' ) aTabLabel = gtk.Label( 'warning' ) aPropertyBox.append_page( aLabel, aTabLabel ) aPropertyBox.hide() aPropertyBox.show_all()
aMessage = ' Sorry ! Not implemented... [%s]\n' %'08/Dec/2002' self.printMessage(aMessage) aDialog = ConfirmWindow(0,aMessage,'Sorry!') return None
def openPreferences( self, button_obj ):
aValue = anEml.getStepperProperty( aProperty )
aValue = anEml.getStepperProperty( aStepper, aProperty )
def __loadStepper( self, anEml ): """stepper loader"""
self.donotHandle = True
self.donotHandle = False
def selectSystem( self, obj ): if self.donotHandle: return
yPoint2 = yWalker.getNext( aTime )
yPoint2 = yWalker.findPrevious( aTime )
def requestData( self, aDataSeries, numberOfElements ): ''' update aDataSeries with new data points gotten from whole Logger ''' xAxis = aDataSeries.getXAxis() dataList = zeros( (0,5), LOGGER_TYPECODE ) fullPNString = aDataSeries.getFullPNString() if xAxis == "Time": if self.hasLogger( fullPNString ) : aStartTime = self.theLoggerAdapter.getStartTime( fullPNString ) anEndTime = self.theLoggerAdapter.getEndTime ( fullPNString ) requiredResolution = ( anEndTime - aStartTime ) / numberOfElements
self.theSimulator.createLogger( fullpn )
self.theSimulator.getLogger( fullpn ) def getLogger( self, fullpn ): return self.theSimulator.getLogger( fullpn )
def createLogger( self,fullpn ): self.theSimulator.createLogger( fullpn )
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./Data'): try: os.mkdir( aSaveDirectory )
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
aDataFileManager = DataFileManager()
except: print "\'" + aSaveDirectory + "\'" + " file exists." aDataFileManager = ecell.DataFileManager.DataFileManager()
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
aFileName=split(join(split(aFullPNString,':')[1:],'-'),'/')[-1]
aFileName=string.split(string.join(string.split(aFullPNString,':')[1:],'-'),'/')[-1]
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
aECDDataFile = ECDDataFile()
aECDDataFile = ecell.ECDDataFile.ECDDataFile()
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
self.__plainPrintMethod( __name__ )
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
print "All files are saved."
def saveLoggerData( self, aFullPNString='', aStartTime=-1, aEndTime=-1, aInterval=-1, aSaveDirectory='./'):
self.theSimulator.setEntityProperty( str( aStepperProperty[ 'FullPn' ] ), \
self.theSimulator.setProperty( str( aStepperProperty[ 'FullPn' ] ), \
def __loadStepperProperty( self ): aStepperPropertyList = self.theEml.getStepperPropertyList() for aStepperProperty in aStepperPropertyList:
aPropertyList = self.theEml.getEntityPropertyList()
aPropertyList = self.theEml.getPropertyList()
def __loadProperty( self ): aPropertyList = self.theEml.getEntityPropertyList() for aProperty in aPropertyList:
self.theSimulator.setEntityProperty( aProperty[ 'FullPn' ], \
self.theSimulator.setProperty( aProperty[ 'FullPn' ], \
def __loadProperty( self ): aPropertyList = self.theEml.getEntityPropertyList() for aProperty in aPropertyList:
import ecs aSession = Session( ecs.Simulator() ) aSimulator = aSession.theSimulator anEmlFileName = sys.argv[1] anEcsFileName = sys.argv[2] aFile = open( anEmlFileName ) aSession.loadModel( aFile ) aFile.close() aSession.loadScript( anEcsFileName )
pass
def __loadProperty( self ): aPropertyList = self.theEml.getEntityPropertyList() for aProperty in aPropertyList:
'Unknown'
aValue_Pa = 'Unknown'
def getParameter( aSBMLmodel ): " [[ Id , Name , Value , Unit , Constant ]] " LIST = [] if aSBMLmodel.getParameter(0): NumParameter = aSBMLmodel.getNumParameters() for Num_Pa in range( NumParameter ): ListOfParameter = [] aParameter = aSBMLmodel.getParameter( Num_Pa ) anId_Pa = aParameter.getId() aName_Pa = aParameter.getName() if aParameter.isSetValue(): aValue_Pa = aParameter.getValue() else: 'Unknown' anUnit_Pa = aParameter.getUnits() aConstant_Pa = aParameter.getConstant() ListOfParameter.append( anId_Pa ) ListOfParameter.append( aName_Pa ) ListOfParameter.append( aValue_Pa ) ListOfParameter.append( anUnit_Pa ) ListOfParameter.append( aConstant_Pa ) LIST.append( ListOfParameter ) return LIST
def __init__( self, owner, scale_type, root, width, heigth ):
def __init__( self, owner, scale_type, root, width, height ):
def __init__( self, owner, scale_type, root, width, heigth ):
self.plotheigth=heigth
self.plotheight=height
def __init__( self, owner, scale_type, root, width, heigth ):
self.theWidget.set_size_request(self.plotwidth,self.plotheigth)
self.theWidget.set_size_request(self.plotwidth,self.plotheight)
def __init__( self, owner, scale_type, root, width, heigth ):
self.pm=gtk.gdk.Pixmap(root.window,self.plotwidth,self.plotheigth,-1) self.pm2=gtk.gdk.Pixmap(root.window,self.plotwidth,self.plotheigth,-1)
self.pm=gtk.gdk.Pixmap(root.window,self.plotwidth,self.plotheight,-1) self.pm2=gtk.gdk.Pixmap(root.window,self.plotwidth,self.plotheight,-1)
def __init__( self, owner, scale_type, root, width, heigth ):
self.max_yticks_no=int(self.plotheigth/150)*5
self.max_yticks_no=int(self.plotheight/150)*5
def recalculate_size(self): self.max_yticks_no=int(self.plotheigth/150)*5 self.max_xticks_no=int(self.plotwidth/100) self.origo=[70,self.plotheigth-30] self.plotarea=[self.origo[0],30,\ self.plotwidth-60-self.origo[0],\ self.origo[1]-30] self.plotaread=[self.plotarea[0],self.plotarea[1],\ self.plotarea[2]+self.plotarea[0],\ self.plotarea[3]+self.plotarea[1]] self.ylabelsarea=[0,0,self.origo[0]-1,self.origo[1]+5] self.xlabelsarea=[0,self.origo[1]+5,\ self.plotwidth,25] self.xticksarea=[self.origo[0],self.origo[1]+2,\ self.plotwidth-self.origo[0],3] self.yaxis_x=self.origo[0]-1 self.xaxis_y=self.origo[1]+1 self.xaxislength=self.plotarea[2]+1 self.yaxislength=self.plotarea[3]+1 self.gui_button_area = [self.plotwidth-20, 0, 20, 20 ] self.xmes_ltop=[self.plotaread[2]+10,self.origo[1]-10]
self.origo=[70,self.plotheigth-30]
self.origo=[70,self.plotheight-30]
def recalculate_size(self): self.max_yticks_no=int(self.plotheigth/150)*5 self.max_xticks_no=int(self.plotwidth/100) self.origo=[70,self.plotheigth-30] self.plotarea=[self.origo[0],30,\ self.plotwidth-60-self.origo[0],\ self.origo[1]-30] self.plotaread=[self.plotarea[0],self.plotarea[1],\ self.plotarea[2]+self.plotarea[0],\ self.plotarea[3]+self.plotarea[1]] self.ylabelsarea=[0,0,self.origo[0]-1,self.origo[1]+5] self.xlabelsarea=[0,self.origo[1]+5,\ self.plotwidth,25] self.xticksarea=[self.origo[0],self.origo[1]+2,\ self.plotwidth-self.origo[0],3] self.yaxis_x=self.origo[0]-1 self.xaxis_y=self.origo[1]+1 self.xaxislength=self.plotarea[2]+1 self.yaxislength=self.plotarea[3]+1 self.gui_button_area = [self.plotwidth-20, 0, 20, 20 ] self.xmes_ltop=[self.plotaread[2]+10,self.origo[1]-10]
self.drawbox("background",0,0,self.plotwidth,self.plotheigth)
self.drawbox("background",0,0,self.plotwidth,self.plotheight)
def clearplot(self): self.drawbox("background",0,0,self.plotwidth,self.plotheigth)
self.pm.draw_point(self.GCFullPNMap[aFullPNString],x,y) self.theWidget.queue_draw_area(x,y,1,1)
self.pm.draw_point(self.GCFullPNMap[aFullPNString],int(x),int(y)) self.theWidget.queue_draw_area(int(x),int(y),1,1)
def drawpoint_on_plot(self, aFullPNString,x,y): #uses raw plot coordinates! self.pm.draw_point(self.GCFullPNMap[aFullPNString],x,y) self.theWidget.queue_draw_area(x,y,1,1)
self.pm.draw_line(self.GCFullPNMap[aFullPNString],x0,y0,x1,y1) self.theWidget.queue_draw_area(min(x0,x1),min(y0,y1),abs(x1-x0)+1,\ abs(y1-y0)+1)
self.pm.draw_line(self.GCFullPNMap[aFullPNString],int(x0),int(y0),\ int(x1),int(y1)) self.theWidget.queue_draw_area(int(min(x0,x1)),int(min(y0,y1)),\ int(abs(x1-x0)+1),int(abs(y1-y0)+1))
def drawline(self, aFullPNString,x0,y0,x1,y1): #uses raw plot coordinates! self.pm.draw_line(self.GCFullPNMap[aFullPNString],x0,y0,x1,y1) self.theWidget.queue_draw_area(min(x0,x1),min(y0,y1),abs(x1-x0)+1,\ abs(y1-y0)+1) return [x1,y1]
def drawbox(self, aFullPNString,x0,y0,width,heigth):
def drawbox(self, aFullPNString,x0,y0,width,height):
def drawbox(self, aFullPNString,x0,y0,width,heigth): #uses raw plot coordinates! self.pm.draw_rectangle(self.GCFullPNMap[aFullPNString],gtk.TRUE,x0,y0,width,heigth) self.theWidget.queue_draw_area(x0,y0,width,heigth)
self.pm.draw_rectangle(self.GCFullPNMap[aFullPNString],gtk.TRUE,x0,y0,width,heigth) self.theWidget.queue_draw_area(x0,y0,width,heigth)
self.pm.draw_rectangle(self.GCFullPNMap[aFullPNString],gtk.TRUE,x0,y0,width,height) self.theWidget.queue_draw_area(x0,y0,width,height)
def drawbox(self, aFullPNString,x0,y0,width,heigth): #uses raw plot coordinates! self.pm.draw_rectangle(self.GCFullPNMap[aFullPNString],gtk.TRUE,x0,y0,width,heigth) self.theWidget.queue_draw_area(x0,y0,width,heigth)
self.pm.draw_rectangle(newgc,gtk.TRUE,x0,y0,x1-x0,y1-y0) self.theWidget.queue_draw_area(x0,y0,x1,y1)
self.pm.draw_rectangle(newgc,gtk.TRUE,int(x0),int(y0),int(x1-x0),int(y1-y0)) self.theWidget.queue_draw_area(int(x0),int(y0),int(x1),int(y1))
def drawxorbox(self,x0,y0,x1,y1): newgc=self.pm.new_gc() newgc.set_function(gtk.gdk.INVERT) self.pm.draw_rectangle(newgc,gtk.TRUE,x0,y0,x1-x0,y1-y0) self.theWidget.queue_draw_area(x0,y0,x1,y1)
self.pm.draw_text(self.font,self.GCFullPNMap[aFullPNString],x0,y0+self.ascent,t) self.theWidget.queue_draw_area(x0,y0,self.font.string_width(t),self.ascent+self.descent)
self.pm.draw_text(self.font,self.GCFullPNMap[aFullPNString],int(x0),int(y0+self.ascent),t) self.theWidget.queue_draw_area(int(x0),int(y0),self.font.string_width(t),self.ascent+self.descent)
def drawtext(self,aFullPNString,x0,y0,text): t=str(text) self.pm.draw_text(self.font,self.GCFullPNMap[aFullPNString],x0,y0+self.ascent,t) self.theWidget.queue_draw_area(x0,y0,self.font.string_width(t),self.ascent+self.descent)
self.pixelheigth=float(self.yframe[1]-self.yframe[0])/self.plotarea[3] else: self.pixelheigth=float(log10(self.yframe[1])-log10(self.yframe[0]))/self.plotarea[3]
self.pixelheight=float(self.yframe[1]-self.yframe[0])/self.plotarea[3] else: self.pixelheight=float(log10(self.yframe[1])-log10(self.yframe[0]))/self.plotarea[3]
def reframey2(self): if self.scale_type=='linear': self.pixelheigth=float(self.yframe[1]-self.yframe[0])/self.plotarea[3] else: self.pixelheigth=float(log10(self.yframe[1])-log10(self.yframe[0]))/self.plotarea[3] #reprint_ylabels self.reprint_ylabels()
return self.origo[1]-round((y-self.yframe[0])/float(self.pixelheigth)) else: return self.origo[1]-round((log10(max(y,self.zerovalue))-log10(self.yframe[0]))/self.pixelheigth)
return self.origo[1]-round((y-self.yframe[0])/float(self.pixelheight)) else: return self.origo[1]-round((log10(max(y,self.zerovalue))-log10(self.yframe[0]))/self.pixelheight)
def converty_to_plot(self,y): if self.scale_type=='linear': return self.origo[1]-round((y-self.yframe[0])/float(self.pixelheigth)) else: return self.origo[1]-round((log10(max(y,self.zerovalue))-log10(self.yframe[0]))/self.pixelheigth)
for tick in range(self.yticks_no+1):
for tick in range(int(self.yticks_no+1)):
def reprint_ylabels(self): #clears ylabel area self.clearylabelarea() tick=1 if self.scale_type=='linear': for tick in range(self.yticks_no+1): tickvalue=self.ygrid[0]+tick*self.yticks_step self.printylabel(tick,tickvalue) else: tickvalue=self.ygrid[1] while tickvalue>self.ygrid[0]: self.printylabel(tick,tickvalue) tickvalue=tickvalue/self.yticks_step self.printylabel(tick,self.ygrid[0])
return (self.origo[1]-ploty)*self.pixelheigth+self.yframe[0] else: return pow(10,(((self.origo[1]-ploty)*self.pixelheigth)+log10(self.yframe[0])))
return (self.origo[1]-ploty)*self.pixelheight+self.yframe[0] else: return pow(10,(((self.origo[1]-ploty)*self.pixelheight)+log10(self.yframe[0])))
def convertplot_to_y(self,ploty): if self.scale_type=='linear': return (self.origo[1]-ploty)*self.pixelheigth+self.yframe[0] else: return pow(10,(((self.origo[1]-ploty)*self.pixelheigth)+log10(self.yframe[0])))
for tick in range(self.xticks_no+1):
for tick in range(int(self.xticks_no+1)):
def reprint_xlabels(self): #clears xlabel area self.clearxlabelarea() for tick in range(self.xticks_no+1): tickvalue=self.xgrid[0]+tick*self.xticks_step self.printxlabel(tickvalue)
new_heigth = args[1] if new_width==self.plotwidth and new_heigth==self.plotheigth:
new_height = args[1] if new_width==self.plotwidth and new_height==self.plotheight:
def resize( self, args): new_width = args[0] new_heigth = args[1] if new_width==self.plotwidth and new_heigth==self.plotheigth: return self.plotwidth=new_width self.plotheigth=new_heigth self.pm=gtk.gdk.Pixmap(self.theRoot.window,self.plotwidth,self.plotheigth,-1) aSizeAlloc= self.theWidget.get_allocation() aSizeAlloc[2]=self.plotwidth aSizeAlloc[3]=self.plotheigth self.theWidget.size_allocate(aSizeAlloc) self.recalculate_size() self.clearplot() self.drawaxes() self.reframey() self.reframex() self.drawall() self.draw_gui_button() self.drawmeasures()
self.plotheigth=new_heigth self.pm=gtk.gdk.Pixmap(self.theRoot.window,self.plotwidth,self.plotheigth,-1)
self.plotheight=new_height self.pm=gtk.gdk.Pixmap(self.theRoot.window,self.plotwidth,self.plotheight,-1)
def resize( self, args): new_width = args[0] new_heigth = args[1] if new_width==self.plotwidth and new_heigth==self.plotheigth: return self.plotwidth=new_width self.plotheigth=new_heigth self.pm=gtk.gdk.Pixmap(self.theRoot.window,self.plotwidth,self.plotheigth,-1) aSizeAlloc= self.theWidget.get_allocation() aSizeAlloc[2]=self.plotwidth aSizeAlloc[3]=self.plotheigth self.theWidget.size_allocate(aSizeAlloc) self.recalculate_size() self.clearplot() self.drawaxes() self.reframey() self.reframex() self.drawall() self.draw_gui_button() self.drawmeasures()
aSizeAlloc[3]=self.plotheigth
aSizeAlloc[3]=self.plotheight
def resize( self, args): new_width = args[0] new_heigth = args[1] if new_width==self.plotwidth and new_heigth==self.plotheigth: return self.plotwidth=new_width self.plotheigth=new_heigth self.pm=gtk.gdk.Pixmap(self.theRoot.window,self.plotwidth,self.plotheigth,-1) aSizeAlloc= self.theWidget.get_allocation() aSizeAlloc[2]=self.plotwidth aSizeAlloc[3]=self.plotheigth self.theWidget.size_allocate(aSizeAlloc) self.recalculate_size() self.clearplot() self.drawaxes() self.reframey() self.reframex() self.drawall() self.draw_gui_button() self.drawmeasures()
self.anEml = eml.Eml()
anEml = eml.Eml()
def saveModel( self , aModel ): # aModel : a file name (string) or a file object # return -> None # This method can thwor exceptions. # creates ana seve an EML instance self.anEml = eml.Eml()
self.anEml.createEntity('System', 'System::/')
anEml.createEntity('System', 'System::/')
def saveModel( self , aModel ): # aModel : a file name (string) or a file object # return -> None # This method can thwor exceptions. # creates ana seve an EML instance self.anEml = eml.Eml()
self.__saveEntity() self.__saveStepper() self.__saveProperty()
self.__saveEntity( anEml ) self.__saveStepper( anEml ) self.__saveProperty( anEml )
def saveModel( self , aModel ): # aModel : a file name (string) or a file object # return -> None # This method can thwor exceptions. # creates ana seve an EML instance self.anEml = eml.Eml()
aString = self.anEml.asString()
aString = anEml.asString()
def saveModel( self , aModel ): # aModel : a file name (string) or a file object # return -> None # This method can thwor exceptions. # creates ana seve an EML instance self.anEml = eml.Eml()
def __saveStepper( self ):
def __saveStepper( self , anEml ):
def __saveStepper( self ): """stepper loader"""
self.anEml.createStepper( str( aClassName ),\
anEml.createStepper( str( aClassName ),\
def __saveStepper( self ): """stepper loader"""
self.anEml.setStepperProperty( aStepper,\
anEml.setStepperProperty( aStepper,\
def __saveStepper( self ): """stepper loader"""
def __saveEntity( self, aSystemPath='/' ):
def __saveEntity( self, anEml, aSystemPath='/' ):
def __saveEntity( self, aSystemPath='/' ):
self.__saveEntityList( 'System', aSystemPath, aSubSystemList ) self.__saveEntityList( 'Variable', aSystemPath, aVariableList ) self.__saveEntityList( 'Process', aSystemPath, aProcessList )
self.__saveEntityList( anEml, 'System', aSystemPath, aSubSystemList ) self.__saveEntityList( anEml, 'Variable', aSystemPath, aVariableList ) self.__saveEntityList( anEml, 'Process', aSystemPath, aProcessList )
def __saveEntity( self, aSystemPath='/' ):
self.__saveEntity( aSubSystemPath )
self.__saveEntity( anEml, aSubSystemPath )
def __saveEntity( self, aSystemPath='/' ):
def __saveEntityList( self, anEntityTypeString,\
def __saveEntityList( self, anEml, anEntityTypeString,\
def __saveEntityList( self, anEntityTypeString,\ aSystemPath, anIDList ):
self.anEml.createEntity( aClassName, aFullID )
anEml.createEntity( aClassName, aFullID )
def __saveEntityList( self, anEntityTypeString,\ aSystemPath, anIDList ):
def __saveProperty( self, aSystemPath='' ):
def __saveProperty( self, anEml, aSystemPath='' ):
def __saveProperty( self, aSystemPath='' ): # the default of aSystemPath is empty because # unlike __loadEntity() this starts with the root system
self.__savePropertyList( 'Variable',\
self.__savePropertyList( anEml, 'Variable', \
def __saveProperty( self, aSystemPath='' ): # the default of aSystemPath is empty because # unlike __loadEntity() this starts with the root system
self.__savePropertyList( 'Process', aSystemPath, aProcessList ) self.__savePropertyList( 'System',\
self.__savePropertyList( anEml, 'Process', \ aSystemPath, aProcessList ) self.__savePropertyList( anEml, 'System', \
def __saveProperty( self, aSystemPath='' ): # the default of aSystemPath is empty because # unlike __loadEntity() this starts with the root system
self.__saveProperty( aSubSystemPath ) def __savePropertyList( self, anEntityTypeString,\
self.__saveProperty( anEml, aSubSystemPath ) def __savePropertyList( self, anEml, anEntityTypeString,\
def __saveProperty( self, aSystemPath='' ): # the default of aSystemPath is empty because # unlike __loadEntity() this starts with the root system
self.anEml.setEntityProperty( aFullID, aProperty, aValueList )
anEml.setEntityProperty( aFullID, aProperty, aValueList )
def __savePropertyList( self, anEntityTypeString,\ aSystemPath, anIDList ):
anEntity[ 'FullId' ] = str( 'Substance' + ':' + \ aSystemPath + ':' + \ aChildElement.getAttribute( 'id' ) )
anEntity[ 'FullId' ] = str( string.capwords( aChildElement.tagName ) + ':' + \ aSystemPath + ':' + \ aChildElement.getAttribute( 'id' ) )
def getSubstanceOrReactorEntityList( self ):
yPoint2 = yWalker.findPrevious( aTime )
while True: yPoint2 = yWalker.getNext( ) if yPoint2 == 1: break if yPoint2[DP_TIME] > yPoint1[DP_TIME]: break
def requestData( self, aDataSeries, numberOfElements ): ''' update aDataSeries with new data points gotten from whole Logger ''' xAxis = aDataSeries.getXAxis() dataList = zeros( (0,5), LOGGER_TYPECODE ) fullPNString = aDataSeries.getFullPNString() if xAxis == "Time": if self.hasLogger( fullPNString ) : aStartTime = self.theLoggerAdapter.getStartTime( fullPNString ) anEndTime = self.theLoggerAdapter.getEndTime ( fullPNString ) requiredResolution = ( anEndTime - aStartTime ) / numberOfElements