コード例 #1
0
    def openWindow( self ):
        """
        in: nothing
        returns nothing
        """
        # superclass openwindow
        ListWindow.openWindow( self )

        # add stepperlist
        self.theClassList = ClassList( self, self['ClassListFrame'] )

        # add stepperpropertylist
        self.theClassPropertyList = ClassEditor( self, self['ClassPropertyFrame'] )

        # add signal handlers
        # self.addHandlers({  })
        self.theClassList.update()
        classList = self.theModelEditor.getModel().getStepperList()
        if len(classList) == 0:
            aClassList = []
        else:
            aClassList = [ classList[0] ]
        self.selectStepper( aClassList )
コード例 #2
0
ファイル: ClassEditorWindow.py プロジェクト: ecell/ecell3
    def openWindow( self ):
        """
        in: nothing
        returns nothing
        """
        # superclass openwindow
        ListWindow.openWindow( self )

        # add stepperlist
        self.theClassList = ClassList( self, self['ClassListFrame'] )

        # add stepperpropertylist
        self.theClassPropertyList = ClassEditor( self, self['ClassPropertyFrame'] )

        # add signal handlers
        # self.addHandlers({  })
        self.theClassList.update()
        classList = self.theModelEditor.getModel().getStepperList()
        if len(classList) == 0:
            aClassList = []
        else:
            aClassList = [ classList[0] ]
        self.selectStepper( aClassList )
コード例 #3
0
class ClassEditorWindow(ListWindow):


    def __init__( self, aModelEditor,aRoot=None ):
        """
        in: ModelEditor theModelEditor
        returns nothing
        """
        self.theModelEditor = aModelEditor
        #self.aRoot=aRoot
        # init superclass
        ListWindow.__init__( self, self.theModelEditor )
        


    def openWindow( self ):
        """
        in: nothing
        returns nothing
        """
        # superclass openwindow
        ListWindow.openWindow( self )

        # add stepperlist
        self.theClassList = ClassList( self, self['ClassListFrame'] )

        # add stepperpropertylist
        self.theClassPropertyList = ClassEditor( self, self['ClassPropertyFrame'] )

        # add signal handlers
        # self.addHandlers({  })
        self.theClassList.update()
        classList = self.theModelEditor.getModel().getStepperList()
        if len(classList) == 0:
            aClassList = []
        else:
            aClassList = [ classList[0] ]
        self.selectStepper( aClassList )




    def updateEntityList ( self ):
        if not self.exists():
            return
        self.theClassList.update(  )

        self.updatePropertyList( )



    def updatePropertyList ( self, anID = None ):
        """
        in: anID ( system or stepper ) where changes happened
        """
        
        if not self.exists():
            return
        oldDisplayedID = self.theClassPropertyList.getDisplayedStepper()

        selectedIDs = self.theClassList.getSelectedIDs()
        if len( selectedIDs) != 1:
            newDisplayedID =  None
        else:
            newDisplayedID = selectedIDs[0]

        if oldDisplayedID != newDisplayedID or newDisplayedID == anID or anID == None:
            self.theClassPropertyList.setDisplayedStepper( newDisplayedID )


    def setLastActiveComponent( self, aComponent ):
        pass
            

    def update( self, aType = None, anID = None ):
        # anID None means all for steppers
        if aType == ME_STEPPER_TYPE:
            if anID == None:
                # update all
                self.updateEntityList()
            else:
                self.updatePropertyList( anID )

        elif aType in [ ME_SYSTEM_TYPE, ME_PROCESS_TYPE, None]:
            self.updatePropertyList()
        elif aType == ME_PROPERTY_TYPE:
            self.updatePropertyList( anID )


    def selectStepper( self, aStepperList ):
        self.theClassList.changeSelection( aStepperList )
        self.theClassList.selectByUser()



    #############################
    #      SIGNAL HANDLERS      #
    #############################

    def deleted( self, *args ):
        ListWindow.deleted( self, *args )
        self.theClassList.close()
        self.theClassPropertyList.close()
        self.theModelEditor.theClassEditor = None
        self.theModelEditor.theMainWindow.update()
        return True
コード例 #4
0
ファイル: ClassEditorWindow.py プロジェクト: ecell/ecell3
class ClassEditorWindow(ListWindow):


    def __init__( self, aModelEditor,aRoot=None ):
        """
        in: ModelEditor theModelEditor
        returns nothing
        """
        self.theModelEditor = aModelEditor
        #self.aRoot=aRoot
        # init superclass
        ListWindow.__init__( self, self.theModelEditor )
        


    def openWindow( self ):
        """
        in: nothing
        returns nothing
        """
        # superclass openwindow
        ListWindow.openWindow( self )

        # add stepperlist
        self.theClassList = ClassList( self, self['ClassListFrame'] )

        # add stepperpropertylist
        self.theClassPropertyList = ClassEditor( self, self['ClassPropertyFrame'] )

        # add signal handlers
        # self.addHandlers({  })
        self.theClassList.update()
        classList = self.theModelEditor.getModel().getStepperList()
        if len(classList) == 0:
            aClassList = []
        else:
            aClassList = [ classList[0] ]
        self.selectStepper( aClassList )




    def updateEntityList ( self ):
        if not self.exists():
            return
        self.theClassList.update(  )

        self.updatePropertyList( )



    def updatePropertyList ( self, anID = None ):
        """
        in: anID ( system or stepper ) where changes happened
        """
        
        if not self.exists():
            return
        oldDisplayedID = self.theClassPropertyList.getDisplayedStepper()

        selectedIDs = self.theClassList.getSelectedIDs()
        if len( selectedIDs) != 1:
            newDisplayedID =  None
        else:
            newDisplayedID = selectedIDs[0]

        if oldDisplayedID != newDisplayedID or newDisplayedID == anID or anID == None:
            self.theClassPropertyList.setDisplayedStepper( newDisplayedID )


    def setLastActiveComponent( self, aComponent ):
        pass
            

    def update( self, aType = None, anID = None ):
        # anID None means all for steppers
        if aType == ME_STEPPER_TYPE:
            if anID == None:
                # update all
                self.updateEntityList()
            else:
                self.updatePropertyList( anID )

        elif aType in [ ME_SYSTEM_TYPE, ME_PROCESS_TYPE, None]:
            self.updatePropertyList()
        elif aType == ME_PROPERTY_TYPE:
            self.updatePropertyList( anID )


    def selectStepper( self, aStepperList ):
        self.theClassList.changeSelection( aStepperList )
        self.theClassList.selectByUser()



    #############################
    #      SIGNAL HANDLERS      #
    #############################

    def deleted( self, *args ):
        ListWindow.deleted( self, *args )
        self.theClassList.close()
        self.theClassPropertyList.close()
        self.theModelEditor.theClassEditor = None
        self.theModelEditor.theMainWindow.update()
        return True