Added property page for interfaces.

git-svn-id: file:///Users/arjan/backup/gaphor/gaphor/trunk@1322 a8418922-720d-0410-834f-a69b97ada669
This commit is contained in:
Arjan Molenaar 2007-05-31 06:51:38 +00:00
parent 13fb576a43
commit 0bfffcd07b
5 changed files with 67 additions and 27 deletions

15
FAQ
View File

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

17
TODO
View File

@ -6,24 +6,13 @@ 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
- Popups for diagram items should be aranged through
<popup action='<class>-item-popup'>..</>.
- popups is a UI thing. Create adapters?
- Separate service for stereotype handling
- popups should be aware of the cursor position (e.g. near the end of a
line). (+1 for adapters)
- ...
- allow comments to render multi-line.
- add more property pages.
- Load / save regression testing
!!! Create some example diagrams,
- get rid of resource(). Create an Application instance instead (should
make unit testing easier too).
This should get rid of the pseudo singletons (_default* instances per module)
- replace DataDir code with pkg_resources (ui.stock)
- copy-buffer (separate copy service?)
- make a service of ElementFactory
- using stereotypes
- reimplement the mechanism that adds already existing relationships to the
diagram if an item is copied to that diagram.

View File

@ -5,6 +5,10 @@ Adapters for the Property Editor
# Add hidden columns for list stores where i can put the actual object
# being edited.
TODO:
- stereotypes
- association / association ends.
-
"""
import gtk
@ -89,6 +93,45 @@ class ClassPropertyPage(NamedItemPropertyPage):
component.provideAdapter(ClassPropertyPage, name='Properties')
class InterfacePropertyPage(NamedItemPropertyPage):
"""
Adapter which shows a property page for an interface view.
"""
interface.implements(IPropertyPage)
component.adapts(items.InterfaceItem)
def __init__(self, context):
super(InterfacePropertyPage, self).__init__(context)
def construct(self):
page = super(InterfacePropertyPage, self).construct()
# Fold toggle
hbox = gtk.HBox()
label = gtk.Label(_("Fold"))
label.set_justify(gtk.JUSTIFY_LEFT)
self.size_group.add_widget(label)
hbox.pack_start(label, expand=False)
button = gtk.CheckButton()
button.set_active(self.context.folded)
button.connect('toggled', self._on_fold_change)
hbox.pack_start(button)
hbox.show_all()
page.pack_start(hbox, expand=False)
hbox.show_all()
page.pack_start(hbox, expand=True)
return page
def _on_fold_change(self, button):
self.context.folded = button.get_active()
component.provideAdapter(InterfacePropertyPage, name='Properties')
class AttributesPropertyPage(object):
"""
An editor for attributes associated with classes and interfaces

View File

@ -82,14 +82,21 @@ class InterfaceItem(ClassItem):
"""
return self.drawing_style == self.DRAW_ICON
def _set_folded(self, folded):
if folded:
self.drawing_style = self.DRAW_ICON
for h in self._handles: h.movable = False
else:
self.drawing_style = self.DRAW_COMPARTMENT
for h in self._handles: h.movable = True
folded = property(is_folded, _set_folded)
def pre_update_icon(self, context):
"""
Figure out if this interface represents a required, provided,
assembled (wired) or dotted (minimal) look.
"""
for h in self._handles: h.movable = False
self.style.name_outside = True
h_nw = self._handles[NW]
cx, cy = h_nw.x + self.width/2, h_nw.y + self.height/2
self._draw_required = self._draw_provided = False

View File

@ -38,6 +38,12 @@ class NamedItem(ElementItem):
self.name_y = 0
self._name_size = (0, 0)
def on_subject_notify(self, pspec, notifiers=()):
#log.debug('Class.on_subject_notify(%s, %s)' % (pspec, notifiers))
ElementItem.on_subject_notify(self, pspec, ('name',) + notifiers)
def on_subject_notify__name(self, subject, pspec=None):
self.request_update()
def get_name_size(self):
"""