21 |
""" |
""" |
22 |
|
|
23 |
from Thuban import _ |
from Thuban import _ |
24 |
|
from Thuban.Model.color import Color |
25 |
|
|
26 |
|
from wxPython.wx import * |
27 |
|
|
28 |
# constants |
# constants |
29 |
RANGE_MIN = 0 |
RANGE_MIN = 0 |
121 |
|
|
122 |
return self.NullData |
return self.NullData |
123 |
|
|
124 |
|
def TreeInfo(self): |
125 |
|
items = [] |
126 |
|
|
127 |
|
# |
128 |
|
# shouldn't print anything if there are no classifications |
129 |
|
# |
130 |
|
|
131 |
|
|
132 |
|
def color_string(color): |
133 |
|
if color is None: |
134 |
|
return "None" |
135 |
|
return "(%.3f, %.3f, %.3f)" % (color.red, color.green, color.blue) |
136 |
|
|
137 |
|
if self.NullData is not None: |
138 |
|
i = [] |
139 |
|
for key, value in self.NullData.items(): |
140 |
|
if isinstance(value, Color): |
141 |
|
i.append((_("%s: %s") % (key, color_string(value)), value)) |
142 |
|
else: |
143 |
|
i.append(_("%s: %s") % (key, value)) |
144 |
|
items.append((_("'NULL'"), i)) |
145 |
|
|
146 |
|
for name, data in self.points.items(): |
147 |
|
i = [] |
148 |
|
for key, value in data.items(): |
149 |
|
if isinstance(value, Color): |
150 |
|
i.append((_("%s: %s") % (key, color_string(value)), value)) |
151 |
|
else: |
152 |
|
i.append(_("%s: %s") % (key, value)) |
153 |
|
items.append((_("%s") % name, i)) |
154 |
|
|
155 |
|
for p in self.ranges: |
156 |
|
i = [] |
157 |
|
data = p[RANGE_DATA] |
158 |
|
for key, value in data.items(): |
159 |
|
if isinstance(value, Color): |
160 |
|
i.append((_("%s: %s") % (key, color_string(value)), value)) |
161 |
|
else: |
162 |
|
i.append(_("%s: %s") % (key, value)) |
163 |
|
items.append((_("%s-%s") % (p[RANGE_MIN], p[RANGE_MAX], i))) |
164 |
|
|
165 |
|
return (_("Classifications"), items) |
166 |
|
|