fixed bug in UML/properties.py, added some documentation about actions.

git-svn-id: file:///Users/arjan/backup/gaphor/gaphor/trunk@1250 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
Arjan Molenaar 2007-04-25 06:22:43 +00:00
parent 05fdbc1b4a
commit c07247dc3b
6 changed files with 49 additions and 31 deletions

3
TODO
View File

@ -6,6 +6,9 @@ For 0.10.0 and later:
- bug in zope.component package: in zope.component.globalregistry.py zope.testing is included. This package is only a dependency for the [test] setting. zope.testing is not mandatory.
Use a more recent version
- filename should not be part of the main window
Is it a transient property?
- Load / save regression testing
!!! Create some example diagrams,

View File

@ -1,16 +1,17 @@
Actions, menu items, toolbars and toolboxes
===========================================
The GTK+ structure is like this::
UIManager
|
ActionGroup
|
Action
| on_activate
perform action
* Where it should lead:
The do_activate signal is emitted when an action is activated.
Where it should lead:
* Actions should be coded closer to the object their working on
- main actions - not dependent on GUI components (load/save/new/quit)
- main actions dependent on GUI component (sub-windows, console)
@ -19,15 +20,29 @@ Actions, menu items, toolbars and toolboxes
- diagram actions (zoom, grid) work on active diagram (tab)
- menus and actions for diagram items through adapters
* Each window has it's own action group / every item with a menu!
* One action group for the application/gui_manager
* Actions should behave more like adapters. E.g. when a popup menu is created
for an Association item, the menu actions should present themselves in the
context of that menu item (with toggles set right)
- Could be registered as adapters with a name.
* Each window has it's own action group (every item with a menu?)
* One action group for the application/gui_manager (new/load/save/quit)
* One toplevel UIManager per window or one per application/gui_manager?
? Actions should inherit from gtk.Action
? Actions should inherit from gtk.Action.
Depends on the structure. Preferbly not, since it ties actions to GTK+
(which is not a good thing for testing)
? Actions should be modeled as functions (methods) with action as
first (sec) parameter.
* filename should not be part of the main window
Normal actions can be modeled as functions. If an action is sensitive or
visible depends on the state in the action. Hence we require the update()
method.
* some sort of factory mechanism (MultiAction?).
- contains an ActionGroup and menu-XML.
- RecentFiles will manage up to 10 recent files entries.
- same for stereotypes: should be managed by one "ObjectAction".
- can Placeholders play a role here?
- can Placeholders play a role here? Yes, they can be used to identify the
section where the actions should be put.
- In some cases multiple menu items may refer to the same action:
radio actions may (but this is not always the case) and the Recent files
functionality.

View File

@ -366,7 +366,7 @@ class association(umlproperty):
# undosetassociationaction(self, obj, value)
setattr(obj, self._name, value)
if do_notify:
component.handle(AssociationSetEvent(obj, self, old, value))
event = AssociationSetEvent(obj, self, old, value)
else:
# Set the actual value
c = self._get(obj)
@ -381,7 +381,7 @@ class association(umlproperty):
# undosetassociationaction(self, obj, value)
c.items.append(value)
if do_notify:
component.handle(AssociationAddEvent(obj, self, value))
event = AssociationAddEvent(obj, self, value)
# Callbacks are only connected if a new relationship has
# been established.
@ -394,6 +394,7 @@ class association(umlproperty):
if do_notify:
self.notify(obj)
component.handle(event)
def _del(self, obj, value, from_opposite=False):
"""

View File

@ -246,6 +246,7 @@ class PlacementTool(gaphas.tool.PlacementTool):
if Application.get_service('properties')('reset-tool-after-create', False):
pool = Application.get_service('action_manager')
pool.get_action('Pointer').active = True
log.debug('button-release pointer set to %s' % pool.get_action('Pointer').active)
return gaphas.tool.PlacementTool.on_button_release(self, context, event)
finally:
self._tx.commit()

View File

@ -8,7 +8,6 @@ import gobject
import gtk
import operator
import stock
from gaphas.decorators import async
from gaphor import UML
from gaphor.transaction import Transaction
@ -201,7 +200,6 @@ class NamespaceModel(gtk.GenericTreeModel):
map(list.index,
[original] * len(children), children))
@async()
def on_ownedmember_changed(self, element, pspec):
"""
Update the tree model when the ownedMember list changes.

View File

@ -62,7 +62,7 @@ setup(
install_requires = [
# 'PyGTK >= 2.8.0', - Exclude, since it will not build anyway
'decorator >= 2.0.1',
'gaphas >= 0.1.5.dev-r1235',
'gaphas >= 0.1.5.dev-r1236',
'zope.component >= 3.3.0', # - won't compile on windows.
# Add dependency on zope.testing to work around bug in zope.component
'zope.testing >= 3.3.0',