def __init__( self, aModelEditor, aLayoutName, anObjectId ): """ sets up a modal dialogwindow displaying the EntityEditor and the ShapeProperty # objectID can be None, String, list of strings """ self.theModelEditor = aModelEditor self.theTopFrame = gtk.VBox() self.theEntityEditor = EntityEditor( self, self.theTopFrame,'Entity', True ) self.theLastDisplayedEntity = None self.theShapeProperty = self.theEntityEditor.getShapeProperty() self.setDisplayObjectEditorWindow(aLayoutName, anObjectId)
class ObjectEditorWindow : def __init__( self, aModelEditor, aLayoutName, anObjectId ): """ sets up a modal dialogwindow displaying the EntityEditor and the ShapeProperty # objectID can be None, String, list of strings """ self.theModelEditor = aModelEditor self.theTopFrame = gtk.VBox() self.theEntityEditor = EntityEditor( self, self.theTopFrame,'Entity', True ) self.theLastDisplayedEntity = None self.theShapeProperty = self.theEntityEditor.getShapeProperty() self.setDisplayObjectEditorWindow(aLayoutName, anObjectId) def setDisplayObjectEditorWindow(self,aLayoutName, anObjectID): self.theLayoutName = aLayoutName self.theLayout =self.theModelEditor.theLayoutManager.getLayout(aLayoutName) self.theObjectDict = {} self.theType = "None" if anObjectID == None: objectIDList = [] elif type(anObjectID ) == str: objectIDList = [ anObjectID ] elif type( anObjectID ) in ( list, tuple ): objectIDList = anObjectID for anID in objectIDList: anObject = self.theLayout.getObject( anID ) self.theObjectDict[anID] = anObject aType = anObject.getProperty( OB_PROP_TYPE ) if self.theType == "None": self.theType = aType elif self.theType != aType: self.theType = "Mixed" self.selectEntity( objectIDList ) self.theShapeProperty.setDisplayedShapeProperty( self.theObjectDict, self.theType ) def bringToTop( self ): self.theModelEditor.theMainWindow.setSmallWindow( self.theTopFrame ) self.theEntityEditor.bringToTop() def update(self, aType = None, aFullID = None): #if aFullID not None, see whether all objects exist deletion = False existObjectList = self.theLayout.getObjectList() for anObjectID in self.theObjectDict.keys(): if anObjectID not in existObjectList: self.theObjectDict.__delitem__( anObjectID ) deletion = True if deletion: self.setDisplayObjectEditorWindow( self.theLayoutName, self.theObjectDict.keys() ) else: self.updatePropertyList() self.updateShapeProperty() def updatePropertyList ( self, aFullID = None ): """ in: anID where changes happened """ # get selected objectID propertyListEntity = self.theEntityEditor.getDisplayedEntity() # check if displayed fullid is affected by changes if propertyListEntity != self.theLastDisplayedEntity: self.theEntityEditor.setDisplayedEntity ( self.theLastDisplayedEntity ) else: self.theEntityEditor.update() def updateShapeProperty(self): if self.theModelEditor.getMode() != ME_DESIGN_MODE: return self.theShapeProperty.updateShapeProperty() def destroy( self, *arg ): """destroy dialog """ pass def selectEntity( self, anEntityList ): objects = self.theObjectDict.values() if not len(objects) == 1: return theObject = objects[0] if not theObject.getProperty(OB_PROP_HAS_FULLID): return selectedFullID = theObject.getProperty( OB_PROP_FULLID ) selectedEntity = self.theModelEditor.getModel().getEntity( selectedFullID ) if selectedEntity == None: return self.theLastDisplayedEntity = selectedEntity self.theEntityEditor.setDisplayedEntity( selectedEntity ) self.theEntityEditor.update() self.bringToTop()