def __init__(self, aReceiver, *args): """ convert Layout receiver to LayoutName """ if isinstance( aReceiver, Layout ): self.theLayoutName = aReceiver.getName() self.theLayoutManager = aReceiver.getLayoutManager() else: self.theLayoutName = None Command.__init__( self, aReceiver, *args )
def execute(self): """ must convert LayoutName into receiver """ if self.theLayoutName != None: self.theReceiver = self.theLayoutManager.getLayout( self.theLayoutName ) return Command.execute( self )
def __new__(self, *args, **nargs): # a tweak to cope with circular dependency global Layout, LayoutManager if Layout == None: from ecell.ui.model_editor.Layout import Layout if LayoutManager == None: from ecell.ui.model_editor.LayoutManager import LayoutManager return Command.__new__(self, *args, **nargs)