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

Revision 1464, 0.8 kB (checked in by wrobe..@pld-linux.org, 2 years ago)

- make package bit higher than named item due to package tab

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 """
2 Package diagram item.
3 """
4
5 from gaphor import UML
6 from gaphor.diagram.nameditem import NamedItem
7
8 class PackageItem(NamedItem):
9
10     __uml__ = UML.Package, UML.Profile
11     __stereotype__ = {
12         'profile': UML.Profile,
13     }
14     __style__ = {
15         'min-size': (NamedItem.style.min_size[0], 70),
16         'name-padding': (25, 10, 5, 10),
17         'tab-x': 50,
18         'tab-y': 20,
19     }
20
21     def draw(self, context):
22         super(PackageItem, self).draw(context)
23
24         cr = context.cairo
25         o = 0.0
26         h = self.height
27         w = self.width
28         x = self.style.tab_x
29         y = self.style.tab_y
30         cr.move_to(x, y)
31         cr.line_to(x, o)
32         cr.line_to(o, o)
33         cr.line_to(o, h)
34         cr.line_to(w, h)
35         cr.line_to(w, y)
36         cr.line_to(o, y)
37         cr.stroke()
38
39
40 # vim:sw=4:et
Note: See TracBrowser for help on using the browser.