[schema view] properly display inheritance (closes #870073). stable
authorDamien Garaud <damien.garaud@logilab.fr>
Fri, 10 Feb 2012 16:23:26 +0100
branchstable
changeset 8213 076c80543fcd
parent 8212 a045d3821990
child 8215 4b32678c21a7
[schema view] properly display inheritance (closes #870073).
web/views/schema.py
--- a/web/views/schema.py	Fri Feb 10 16:22:38 2012 +0100
+++ b/web/views/schema.py	Fri Feb 10 16:23:26 2012 +0100
@@ -204,11 +204,11 @@
         _ = self._cw._
         # inheritance
         if entity.specializes:
-            self.w(u'<div>%s' % _('Parent class:'))
+            self.w(u'<div><strong>%s</strong>' % _('Parent class:'))
             self.wview('csv', entity.related('specializes', 'subject'))
             self.w(u'</div>')
         if entity.reverse_specializes:
-            self.w(u'<div>%s' % _('Sub-classes:'))
+            self.w(u'<div><strong>%s</strong>' % _('Sub-classes:'))
             self.wview('csv', entity.related('specializes', 'object'))
             self.w(u'</div>')
         # entity schema image
@@ -565,8 +565,14 @@
 
     def edge_properties(self, rschema, subjnode, objnode):
         """return default DOT drawing options for a relation schema"""
+        # Inheritance relation (i.e 'specializes').
+        if rschema is None:
+            kwargs = {'label': 'Parent class',
+                      'color' : 'grey',  'style' : 'filled',
+                      'arrowhead': 'empty',
+                      'fontsize': '10px'}
         # symmetric rels are handled differently, let yams decide what's best
-        if rschema.symmetric:
+        elif rschema.symmetric:
             kwargs = {'label': rschema.type,
                       'color': '#887788', 'style': 'dashed',
                       'dir': 'both', 'arrowhead': 'normal', 'arrowtail': 'normal',