root/gaphor/tags/gaphor-0.12.0/gaphor/diagram/extension.py

Revision 1413, 1.1 kB (checked in by arj..@yirdis.nl, 2 years ago)

Removed popup_menu entries

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 """
2 ExtensionItem -- Graphical representation of an association.
3 """
4
5 # TODO: for Extension.postload(): in some cases where the association ends
6 # are connected to the same Class, the head_end property is connected to the
7 # tail end and visa versa.
8
9 from gaphor import UML
10 from gaphor.diagram.diagramline import NamedLine
11
12 class ExtensionItem(NamedLine):
13     """
14     ExtensionItem represents associations.
15     An ExtensionItem has two ExtensionEnd items. Each ExtensionEnd item
16     represents a Property (with Property.association == my association).
17     """
18
19     __uml__ = UML.Extension
20
21     def __init__(self, id=None):
22         NamedLine.__init__(self, id)
23
24     def on_subject_notify(self, pspec, notifiers=()):
25         NamedLine.on_subject_notify(self, pspec,
26                 notifiers + ('ownedEnd',))
27
28     def on_subject_notify__ownedEnd(self, subject, pspec):
29         self.request_update()
30
31     def draw_head(self, context):
32         cr = context.cairo
33         cr.move_to(0, 0)
34         cr.line_to(15, -10)
35         cr.line_to(15, 10)
36         cr.line_to(0, 0)
37         cr.set_source_rgb(0, 0, 0)
38         cr.fill()
39         cr.move_to(15, 0)
40
41
42 # vim:sw=4:et:ai
Note: See TracBrowser for help on using the browser.