root/gaphor/trunk/gaphor/diagram/interaction.py

Revision 1531, 0.9 kB (checked in by wrobe..@pld-linux.org, 1 year ago)

- code cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 """
2 Interaction diagram item.
3 """
4
5 from gaphor import UML
6 from gaphor.diagram.nameditem import NamedItem
7 from gaphor.diagram.style import ALIGN_LEFT, ALIGN_TOP
8
9 class InteractionItem(NamedItem):
10
11     __uml__ = UML.Interaction
12
13     __style__ = {
14         'min-size': (300, 300),
15         'name-align': (ALIGN_TOP, ALIGN_LEFT),
16     }
17
18     def draw(self, context):
19         super(InteractionItem, self).draw(context)
20         cr = context.cairo
21         cr = context.cairo
22         cr.rectangle(0, 0, self.width, self.height)
23         if context.dropzone:
24             cr.save()
25             cr.set_source_rgba(1.0, 1.0, 0.0, 0.6)
26             cr.fill()
27             cr.restore()
28             cr.rectangle(0, 0, self.width, self.height)
29        
30         # draw pentagon
31         w, h = self._header_size
32         h2 = h / 2.0
33         cr.move_to(0, h)
34         cr.line_to(w - 4, h)
35         cr.line_to(w, h2)
36         cr.line_to(w, 0)
37         cr.stroke()
38
39
40 # vim:sw=4:et
Note: See TracBrowser for help on using the browser.