Changeset 1252

Show
Ignore:
Timestamp:
04/26/07 07:52:41 (2 years ago)
Author:
arj..@yirdis.nl
Message:

updated actions document

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/doc/actions.txt

    r1250 r1252  
    4747      radio actions may (but this is not always the case) and the Recent files 
    4848      functionality. 
     49 
     50 
     51Solution for simple actions 
     52=========================== 
     53 
     54For an action to actually be useful a piece of menu xml is needed. 
     55 
     56Hence an interface IActionProvider has to be defined:: 
     57 
     58    class IActionProvider(interface.Interface): 
     59        menu_xml = interface.Attribute("The menu XML") 
     60        action_group = interface.Attribute("The accompanying ActionGroup") 
     61        def update(self)? 
     62 
     63Support for actions can be arranged by decorating actions with an @action 
     64decorator and let the class create an ActionGroup using some 
     65actionGroup factory function (no inheritance needed here).  
     66 
     67Note that ActionGroup is a GTK class and should technically only be used in the 
     68gaphor.ui package. 
     69 
     70Autonom controllers can be defined, which provide a piece of functionality. 
     71They can register handlers in order to update their state. 
     72 
     73Maybe it's nice to configure those through the egg-info system. I suppose 
     74gaphor.service will serve well (as they need to be initialized anyway) 
     75 ==> also inherit IActionProvider from IService? 
     76 
     77    [gaphor.services] 
     78    xx = gaphor.actions.whatever:SomeActionProviderClass 
     79 
     80 
     81Solution for context sensitive menus 
     82==================================== 
     83 
     84Context sensitive menus, such as popup menus, should be generated and switched 
     85on and off on demand. 
     86 
     87Technically they should be enabled through services/action-providers. 
     88 
     89It becomes even tougher when popup menu's should act on parts of a diagram item 
     90(such as association ends). This should be avoided. It may be a good idea to 
     91provide such functionality through a special layer on the canvas, by means of 
     92some easy clickable buttons around the "hot spot" (we already have something 
     93like that for text around association ends). 
     94