def __palette_toggled( self, *args ):
     aButtonName=args[0].get_name().split('_')[0]
     if self.isFirst:
         if aButtonName =='custom' or aButtonName =='text':
             utils.showPopupMessage(
                 utils.OK_MODE,
                 "Sorry, not implemented !",
                 ME_ERROR )
         if aButtonName!=self.__CurrPaletteButton:
             self.isFirst=False
             self.toggle(aButtonName,True)   
             self.toggle(self.__CurrPaletteButton,False) 
             self.__CurrPaletteButton=aButtonName
             
         elif aButtonName==self.__CurrPaletteButton:
             self.isFirst=False
             if self.__CurrPaletteButton=='selector':
                 self.toggle(self.__CurrPaletteButton,True)
             else:   
                 self.toggle(self.__CurrPaletteButton,False)
                 self.toggle('selector',True)    
                 self.__CurrPaletteButton='selector'
         
     else:
         self.isFirst=True
Exemple #2
0
 def popupObjectEditor( self, anObjectID ):
     anObject = self.getObject( anObjectID )
     if anObject.getProperty(OB_PROP_TYPE) == OB_PROP_TYPE_CONNECTION:
         self.layoutManager.theModelEditor.createConnObjectEditorWindow(self.theName, anObjectID)
     else:
         if  anObject.getProperty(OB_PROP_HAS_FULLID): 
             self.layoutManager.theModelEditor.createObjectEditorWindow(self.theName, anObjectID)
         else:
             utils.showPopupMessage(
                 utils.OK_MODE,
                 "Sorry, not implemented!",
                 ME_ERROR )
    def __CloneLayoutButton_clicked(self, *args):
        layoutManager = self.theModelEditor.theLayoutManager
        layoutName = self.theLayout.getName()

        if layoutName == 'Choose...':
            utils.showPopupMessage("This is not a valid layout name", ME_WARNING) 
            return

        aCommand = CloneLayout( layoutManager, layoutName)
        self.theModelEditor.doCommandList( [ aCommand ] )
        newLayoutName = "copyOf" + layoutName

        self.theModelEditor.createPathwayEditor( layoutManager.getLayout( newLayoutName ) )
    def __DeleteLayoutButton_clicked(self, *args):
        layoutManager = self.theModelEditor.theLayoutManager
        layoutName = self.theLayout.getName()   

        if layoutName == 'Choose...':
            utils.showPopupMessage(
                utils.OK_MODE,
                "This is not a valid layout name",
                ME_ERROR )
            return
 
        aCommand = DeleteLayout( layoutManager, layoutName)
        self.theModelEditor.doCommandList( [ aCommand ] )
 def __rename_layout( self, *args ):
     if len(self.theEntry.get_text())>0:
         oldName = self.theLayout.getName()
         newName = self.theEntry.get_text()
         aCommand = RenameLayout( self.theLayout.theLayoutManager, oldName, newName )
         if not ecell.util.validateIDString( newName ):
             utils.showPopupMessage(
                 utils.OK_MODE,
                 "Only alphanumeric characters and _ are allowed in " \
                 +" layout names!",
                 ME_ERROR )
         if aCommand.isExecutable() and ecell.util.validateIDString( newName ):
             self.theModelEditor.doCommandList( [aCommand] )
         else:
             self.theEntry.set_text(oldName)
             self.theLabel.set_text(oldName)
         self.theHBox.remove( self.theEntry )
         self.theHBox.pack_start( self.theLabel)
         self.theLabel.show()
         self['rename_button'].set_sensitive( True )
 def changeName( self, newName ):
     if not ecell.util.validateIDString( newName ):
         utils.showPopupMessage(
             utils.OK_MODE,
             "Only alphanumeric characters and _ are allowed in "
             + "entity names!", ME_ERROR )
         return
     oldID = self.theModelEditor.getModel().getFullIDOf(
         self.theDisplayedEntity )
     obj = self.theLayout.getObjectByFullID( oldID )
     newID = identifiers.FullID( oldID )
     newID.id = newName
     aCommand = SetObjectProperty(
         self.theLayout, obj.getID(), OB_PROP_FULLID, newID )
     if not aCommand.isExecutable():
         utils.showPopupMessage( utils.OK_MODE, "OOPS", ME_ERROR )
         return
     self.theModelEditor.doCommandList ( [ aCommand ] )
     self.theParentWindow.selectEntity( [ newID ] )
     self.updateEditor()
    def rename ( self, newName, anIter ):

        # if nothing changed make nothing
        #newSelection = self.__getSelection()
        #wholePropertyList = self.getPropertyList()
        #changedID = newName
        #for aSelection in newSelection:
        #   if aSelection not in wholePropertyList:
        #       changedID = aSelection
        #       break
        if not self.theModelEditor.theRuntimeObject.checkState( ME_DESIGN_MODE ):
            return
        changedID = self.theListStore.get_value( anIter, 0 )
        if changedID == newName:
            return
        if not ecell.util.validateIDString( newName ):
            utils.showPopupMessage(
                utils.OK_MODE,
                "Only alphanumeric characters and _ are allowed in " \
                + "fullid names!",
                ME_ERROR )
            self.theListStore.set_value( anIter, 0, changedID )
            return
        if isinstance( self.theDisplayedEntity, objs.Stepper ):
            aCommand = RenameStepperProperty( self.theModelEditor, self.theDisplayedEntity, changedID, newName )
        else:
            aCommand = RenameEntityProperty( self.theModelEditor, self.theDisplayedEntity, changedID, newName )


        if aCommand.isExecutable():
            self.theSelection = [ newName ]
            
            self.theModelEditor.doCommandList( [ aCommand ] )
            self.__changeColor()
        else:
            utils.showPopupMessage(
                utils.OK_MODE,
                "%s cannot be renamed to %s" % (changedID, newName),
                ME_ERROR )
            self.theListStore.set_value( anIter, 0, changedID )
    def rename ( self, newName, anIter ):
        if not self.theModelEditor.theRuntimeObject.checkState( ME_DESIGN_MODE ):
            return

        # if nothing changed make nothing
        #newSelection = self.__getSelection()
        #oldID = newName
        #for anOldID in self.theSelection:
        #   if anOldID.split(':')[2] not in newSelection:
        #       oldID = anOldID
        #       break
        oldName = self.theListStore.get_value( anIter, 0 )
        if oldName == newName:
            return
        oldTuple = [ self.theType, ecell.util.convertFullIDStringToSystemPath( self.theDisplayedSysID ), oldName ]
        oldID = ':'.join( oldTuple )


        newTuple = oldID.split(':')
        newTuple[2] = newName
        newID = ':'.join( newTuple )

        aCommand = RenameEntity( self.theModelEditor, oldID, newID )
        if not ecell.util.validateIDString( newName ):
            utils.showPopupMessage(
                utils.OK_MODE,
                "Only alphanumeric characters and _ are allowed in entity names!",
                ME_ERROR )
        elif aCommand.isExecutable():

            self.theModelEditor.doCommandList( [ aCommand ] )
            self.theSelection = [ newID ]
            self.restoreSelection()
            self.theParentWindow.update()
        else:
            self.theListStore.set_value( anIter, 0, oldName )
    def changeValue( self, newValue, anIter ):
        
        aName = self.theListStore.get_value( anIter, 0 )

        oldValue = self.getPropertyValue( aName )
        if str(oldValue) == str(newValue):
            return
        if self.theModelEditor.getMode() == ME_RUN_MODE:
            #try:
            if isinstance( self.theDisplayedEntity, objs.Stepper ):
                self.theModel.setEntityProperty(
                    identifiers.FullPN( self.theDisplayedEntity, aName ),
                    newValue )
            else:
                self.theModel.setEntityProperty(
                    identifiers.FullPN( self.theDisplayedEntity, aName ),
                    newValue )
            self.update()
            return
        if isinstance( self.theDisplayedEntity, objs.Stepper ):
            aCommand = ChangeStepperProperty( self.theModelEditor, self.theDisplayedEntity, aName, newValue )
        else:
            fpn = identifiers.FullPN(
                self.theModel.getFullIDOf( self.theDisplayedEntity ),
                aName )
            aCommand = ChangeEntityProperty( self.theModelEditor, fpn, newValue )

        if aCommand.isExecutable():
            self.theModelEditor.doCommandList( [ aCommand ] )
            self.__changeColor()
        else:
            utils.showPopupMessage(
                utils.OK_MODE,
                "Illegal value for %s" % aName,
                ME_ERROR )
            self.theListStore.set_value( anIter, 1, oldValue )
 def __search( self, *args ):
     utils.showPopupMessage( utils.OK_MODE, "Sorry, not implemented !", ME_ERROR )