root/gaphor/tags/gaphor-0.3.0/gaphor/diagram/attribute.py

Revision 263, 1.7 kB (checked in by arjanmol, 5 years ago)

*** empty log message ***

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 # vim:sw=4:et
2 """Attribute item.
3 """
4
5 import gobject
6 import diacanvas
7 from gaphor.diagram import initialize_item
8
9 from feature import FeatureItem
10
11 class AttributeItem(FeatureItem):
12
13     popup_menu = FeatureItem.popup_menu + (
14         'EditItem',
15         'DeleteAttribute',
16         'separator',
17         'CreateAttribute'
18     )
19
20     def __init__(self, id=None):
21         FeatureItem.__init__(self, id)
22
23     def on_subject_notify(self, pspec, notifiers=()):
24         FeatureItem.on_subject_notify(self, pspec, ('name',
25                                                     'isDerived',
26                                                     'visibility',
27                                                     'lowerValue.value',
28                                                     'upperValue.value',
29                                                     'defaultValue.value',
30                                                     'typeValue.value',
31                                                     'taggedValue.value')
32                                                     + notifiers)
33
34     def on_subject_notify__name(self, subject, pspec):
35         self._expression.set_text(self.subject.render())
36         self.request_update()
37
38     on_subject_notify__isDerived = on_subject_notify__name
39     on_subject_notify__visibility = on_subject_notify__name
40     on_subject_notify__lowerValue_value = on_subject_notify__name
41     on_subject_notify__upperValue_value = on_subject_notify__name
42     on_subject_notify__defaultValue_value = on_subject_notify__name
43     on_subject_notify__typeValue_value = on_subject_notify__name
44     on_subject_notify__taggedValue_value = on_subject_notify__name
45
46 initialize_item(AttributeItem)
Note: See TracBrowser for help on using the browser.