1.1 --- a/micropython/report.py Mon Aug 16 00:26:23 2010 +0200
1.2 +++ b/micropython/report.py Tue Aug 17 00:07:54 2010 +0200
1.3 @@ -113,15 +113,31 @@
1.4 }
1.5
1.6 .summary-class {
1.7 - background-color: #040;
1.8 - }
1.9 -
1.10 - .summary-instance {
1.11 - background-color: #00F;
1.12 + vertical-align: top;
1.13 }
1.14
1.15 .summary-attr {
1.16 background-color: #070;
1.17 + font-size: smaller;
1.18 + }
1.19 +
1.20 + .summary-attr-absent {
1.21 + border-left: 0.2em solid #070;
1.22 + font-size: small;
1.23 + }
1.24 +
1.25 + .summary-class-attr {
1.26 + background-color: #007;
1.27 + font-size: smaller;
1.28 + }
1.29 +
1.30 + .summary-class-attr-absent {
1.31 + border-left: 0.2em solid #007;
1.32 + font-size: small;
1.33 + }
1.34 +
1.35 + .summary-ref {
1.36 + color: white;
1.37 }
1.38
1.39 </style>
1.40 @@ -299,7 +315,6 @@
1.41 self.stream.write(html_footer)
1.42
1.43 def _write_classes(self, module):
1.44 - self.stream.write("<table cellspacing='5' cellpadding='5'>\n")
1.45
1.46 all_classes = {}
1.47
1.48 @@ -307,13 +322,22 @@
1.49 if isinstance(obj, Class):
1.50 all_classes[obj.name] = obj
1.51
1.52 - all_class_names = all_classes.keys()
1.53 - all_class_names.sort()
1.54 + if all_classes:
1.55 +
1.56 + all_class_names = all_classes.keys()
1.57 + all_class_names.sort()
1.58
1.59 - for name in all_class_names:
1.60 - self._write_class(all_classes[name])
1.61 + self.stream.write("<table cellspacing='5' cellpadding='5'>\n")
1.62 + self.stream.write("<thead>\n")
1.63 + self.stream.write("<tr>\n")
1.64 + self.stream.write("<th>Classes</th><th>Attributes</th>\n")
1.65 + self.stream.write("</tr>\n")
1.66 + self.stream.write("</thead>\n")
1.67
1.68 - self.stream.write("</table>\n")
1.69 + for name in all_class_names:
1.70 + self._write_class(all_classes[name])
1.71 +
1.72 + self.stream.write("</table>\n")
1.73
1.74 def _write_class(self, obj):
1.75
1.76 @@ -321,18 +345,40 @@
1.77
1.78 self.stream.write("<tbody class='class'>\n")
1.79 self.stream.write("<tr>\n")
1.80 - self.stream.write("<th class='summary-class' id='%s'>\n" % obj.full_name())
1.81 - self._keyword("class")
1.82 - self.stream.write(obj.name)
1.83 + self.stream.write("<th class='summary-class' id='%s' rowspan='2'>" % self._attr(obj.full_name()))
1.84 + self._object_name_ref(self.module, obj, classes="class-name")
1.85 self.stream.write("</th>\n")
1.86
1.87 - # ...and instance attribute names in order.
1.88 + # ...and instance attribute names in order...
1.89
1.90 attrs = obj.instance_attributes().values()
1.91 attrs.sort(cmp=lambda x, y: cmp(x.position, y.position))
1.92
1.93 - for attr in attrs:
1.94 - self.stream.write("<th class='summary-attr'>%s</th>\n" % self._text(attr.name))
1.95 + if attrs:
1.96 + for attr in attrs:
1.97 + self.stream.write("<td class='summary-attr'>%s</td>\n" % self._text(attr.name))
1.98 + else:
1.99 + self.stream.write("<td class='summary-attr-absent'>None</td>\n")
1.100 +
1.101 + self.stream.write("</tr>\n")
1.102 + self.stream.write("<tr>\n")
1.103 +
1.104 + # ...and class attribute names in order.
1.105 +
1.106 + attrs = obj.class_attributes().values()
1.107 + attrs.sort(cmp=lambda x, y: cmp(x.position, y.position))
1.108 +
1.109 + if attrs:
1.110 + for attr in attrs:
1.111 + value = attr.get_value()
1.112 + if value is not None:
1.113 + self.stream.write("<td class='summary-class-attr' id='%s'>" % self._attr(value.full_name()))
1.114 + self._object_name_ref(self.module, value, classes="summary-ref")
1.115 + self.stream.write("</td>\n")
1.116 + else:
1.117 + self.stream.write("<td class='summary-class-attr'>%s</td>\n" % self._text(attr.name))
1.118 + else:
1.119 + self.stream.write("<td class='summary-class-attr-absent'>None</td>\n")
1.120
1.121 self.stream.write("</tr>\n")
1.122 self.stream.write("</tbody>\n")