Changeset 1322

Show
Ignore:
Timestamp:
05/30/07 23:51:38 (1 year ago)
Author:
arj..@yirdis.nl
Message:

Added property page for interfaces.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/FAQ

    r463 r1322  
    22========================== 
    33 
    4 Q: I have installed DiaCanvas2 and everything went okay, however when I do a 
    5    "python setup.py config" it complains that it can not find DiaCanvas. 
     4Q: Does Gaphor work on Windows 
    65 
    7 A: There is a good chance the diacanvas-python module is installed correctly, 
    8    but in /usr/local/lib/python2.[23]/site-packages. The easiest solution is 
    9    to add this directory to your PYTHONPATH environment variable: 
     6A: Yes it does. Check out the gaphor-win32-libs package in Gaphor's subversion 
     7   repository. It contains all the libraries required to get Gaphor up and 
     8   running. All you need more is a Python 2.4 installation (the libraries are 
     9   compiled for Python 2.4, not 2.5). 
    1010 
    11      export PYTHONPATH=/usr/local/lib/python2.[23]/site-packages 
    12  
    13    As an alternative a setup.py script is provided in the python/ directory 
    14    in the diacanvas2 source distribution. 
    15  
  • gaphor/trunk/TODO

    r1291 r1322  
    77 Use a more recent version 
    88 
    9  - Popups for diagram items should be aranged through 
    10    <popup action='<class>-item-popup'>..</>. 
    11      - popups is a UI thing. Create adapters? 
    12      - Separate service for stereotype handling  
    13      - popups should be aware of the cursor position (e.g. near the end of a 
    14        line). (+1 for adapters) 
    15      - ... 
     9 - allow comments to render multi-line. 
     10 
     11 - add more property pages. 
    1612 
    1713 - Load / save regression testing 
    1814   !!! Create some example diagrams, 
    1915 
    20  - get rid of resource(). Create an Application instance instead (should 
    21    make unit testing easier too). 
    22    This should get rid of the pseudo singletons (_default* instances per module) 
    23     - replace DataDir code with pkg_resources (ui.stock) 
    24     - copy-buffer (separate copy service?) 
    25     - make a service of ElementFactory 
    26      
    2716 - using stereotypes 
    2817 - reimplement the mechanism that adds already existing relationships to the 
  • gaphor/trunk/gaphor/adapters/propertypages.py

    r1319 r1322  
    66# being edited. 
    77 
     8TODO: 
     9 - stereotypes 
     10 - association / association ends. 
     11 -  
    812""" 
    913 
     
    8892 
    8993component.provideAdapter(ClassPropertyPage, name='Properties') 
     94 
     95 
     96class InterfacePropertyPage(NamedItemPropertyPage): 
     97    """ 
     98    Adapter which shows a property page for an interface view. 
     99    """ 
     100 
     101    interface.implements(IPropertyPage) 
     102    component.adapts(items.InterfaceItem) 
     103 
     104    def __init__(self, context): 
     105        super(InterfacePropertyPage, self).__init__(context) 
     106         
     107    def construct(self): 
     108        page = super(InterfacePropertyPage, self).construct() 
     109 
     110        # Fold toggle 
     111        hbox = gtk.HBox() 
     112        label = gtk.Label(_("Fold")) 
     113        label.set_justify(gtk.JUSTIFY_LEFT) 
     114        self.size_group.add_widget(label) 
     115        hbox.pack_start(label, expand=False) 
     116        button = gtk.CheckButton() 
     117        button.set_active(self.context.folded) 
     118        button.connect('toggled', self._on_fold_change) 
     119        hbox.pack_start(button) 
     120        hbox.show_all() 
     121        page.pack_start(hbox, expand=False) 
     122 
     123        hbox.show_all() 
     124 
     125        page.pack_start(hbox, expand=True) 
     126 
     127        return page 
     128 
     129    def _on_fold_change(self, button): 
     130        self.context.folded = button.get_active() 
     131 
     132component.provideAdapter(InterfacePropertyPage, name='Properties') 
    90133 
    91134 
  • gaphor/trunk/gaphor/diagram/interface.py

    r1178 r1322  
    8383        return self.drawing_style == self.DRAW_ICON 
    8484 
     85    def _set_folded(self, folded): 
     86        if folded: 
     87            self.drawing_style = self.DRAW_ICON 
     88            for h in self._handles: h.movable = False 
     89        else: 
     90            self.drawing_style = self.DRAW_COMPARTMENT 
     91            for h in self._handles: h.movable = True 
     92 
     93    folded = property(is_folded, _set_folded) 
     94 
    8595    def pre_update_icon(self, context): 
    8696        """ 
     
    8898        assembled (wired) or dotted (minimal) look. 
    8999        """ 
    90         for h in self._handles: h.movable = False 
    91         self.style.name_outside = True 
    92  
    93100        h_nw = self._handles[NW] 
    94101        cx, cy = h_nw.x + self.width/2, h_nw.y + self.height/2 
  • gaphor/trunk/gaphor/diagram/nameditem.py

    r1201 r1322  
    3939        self._name_size = (0, 0) 
    4040 
     41    def on_subject_notify(self, pspec, notifiers=()): 
     42        #log.debug('Class.on_subject_notify(%s, %s)' % (pspec, notifiers)) 
     43        ElementItem.on_subject_notify(self, pspec, ('name',) + notifiers) 
     44 
     45    def on_subject_notify__name(self, subject, pspec=None): 
     46        self.request_update() 
    4147 
    4248    def get_name_size(self):