root/gaphor/trunk/gaphor/diagram/classes/package.py

Revision 2290, 1.0 kB (checked in by arj..@yirdis.nl, 8 months ago)

set default style to normal. make name style for classifiers and package bold.

Fixes #118.

  • 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 import gaphor.diagram.font as font
8
9
10 class PackageItem(NamedItem):
11
12     __uml__ = UML.Package, UML.Profile
13     __stereotype__ = {
14         'profile': UML.Profile,
15     }
16     __style__ = {
17         'min-size': (NamedItem.style.min_size[0], 70),
18         'name-padding': (25, 10, 5, 10),
19         'tab-x': 50,
20         'tab-y': 20,
21     }
22
23     def __init__(self, id=None):
24         super(PackageItem, self).__init__(id)
25
26         self._name.font = font.FONT_NAME
27
28
29     def draw(self, context):
30         super(PackageItem, self).draw(context)
31
32         cr = context.cairo
33         o = 0.0
34         h = self.height
35         w = self.width
36         x = self.style.tab_x
37         y = self.style.tab_y
38         cr.move_to(x, y)
39         cr.line_to(x, o)
40         cr.line_to(o, o)
41         cr.line_to(o, h)
42         cr.line_to(w, h)
43         cr.line_to(w, y)
44         cr.line_to(o, y)
45         cr.stroke()
46
47
48 # vim:sw=4:et
Note: See TracBrowser for help on using the browser.