Revert "Added a new app property to the Element class. This will return the"

This reverts commit f38404380a441afffeb2cf4b298bec854567b8c7.
This commit is contained in:
Arjan Molenaar 2010-08-26 10:22:25 +02:00
parent b4eaab3564
commit 39c70c34bd
2 changed files with 8 additions and 25 deletions

View File

@ -34,23 +34,14 @@ class Element(object):
# The factory this element belongs to.
self._factory = factory
self.__in_unlink = mutex.mutex()
id = property(lambda self: self._id, doc='Id')
factory = property(lambda self: self._factory,\
factory = property(lambda self: self._factory,
doc="The factory that created this element")
def get_app(self):
"""Return the Gaphor application instance if exists. Otherwise,
return None. If this element isn't bound to a factory, the application
instance is always None since this method accesses it through the
factory. This method is used by the app property."""
if self.factory:
return self.factory._app
app = property(get_app,\
doc="The Gaphor application object.")
def umlproperties(self):
"""
@ -104,10 +95,7 @@ class Element(object):
try:
for prop in self.umlproperties():
prop.unlink(self)
if self.app:
self.app.handle(ElementDeleteEvent(self._factory, self))
else:
component.handle(ElementDeleteEvent(self._factory, self))
component.handle(ElementDeleteEvent(self._factory, self))
finally:
self.__in_unlink.unlock()

View File

@ -155,13 +155,8 @@ class DiagramToolbox(object):
def _after_handler(self, new_item):
if self.properties('reset-tool-after-create', False):
self.action_group.get_action('toolbox-pointer').activate()
app = self.element_factory._app
if app:
app.handle(DiagramItemCreateEvent(new_item))
else:
component.handle(DiagramItemCreateEvent(new_item))
component.handle(DiagramItemCreateEvent(new_item))
##
## Toolbox actions