root/gaphor/trunk/gaphor/diagram/node.py

Revision 1121, 0.8 kB (checked in by arjanmol, 2 years ago)

Merged changed from new-canvas branch to trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 """
2 Node item.
3 """
4
5 from gaphor import UML
6 from gaphor.diagram.classifier import ClassifierItem
7
8 class NodeItem(ClassifierItem):
9
10     __uml__ = UML.Node
11
12     DEPTH = 10
13
14     def __init__(self, id=None):
15         ClassifierItem.__init__(self, id)
16         self.drawing_style = self.DRAW_COMPARTMENT
17         self.height = 50
18         self.width = 120
19
20     def draw_compartment(self, context):
21         cr = context.cairo
22         cr.save()
23         super(NodeItem, self).draw_compartment(context)
24         cr.restore()
25
26         d = self.DEPTH
27         w = self.width
28         h = self.height
29
30         cr.move_to(0, 0)
31         cr.line_to(d, -d)
32         cr.line_to(w + d, -d)
33         cr.line_to(w + d, h - d)
34         cr.line_to(w, h)
35         cr.move_to(w, 0)
36         cr.line_to(w + d, -d)
37
38         cr.stroke()
39
40
41 # vim:sw=4:et
Note: See TracBrowser for help on using the browser.