Commit d544e8919696298cd1ff28dce8d979997397c674

Authored by tatiana
1 parent 238015b5

ENH: In the process of load measures to viewers

invesalius/data/measures.py
@@ -35,6 +35,30 @@ class MeasurementManager(object): @@ -35,6 +35,30 @@ class MeasurementManager(object):
35 ps.Publisher().subscribe(self._change_name, "Change measurement name") 35 ps.Publisher().subscribe(self._change_name, "Change measurement name")
36 ps.Publisher().subscribe(self._remove_measurements, "Remove measurements") 36 ps.Publisher().subscribe(self._remove_measurements, "Remove measurements")
37 ps.Publisher().subscribe(self._set_visibility, "Show measurement") 37 ps.Publisher().subscribe(self._set_visibility, "Show measurement")
  38 + ps.Publisher().subscribe(self._load_measurements, "Load measurement dict")
  39 +
  40 +
  41 + def _load_measurements(self, pubsub_evt):
  42 + print "_load_measurements"
  43 + dict = pubsub_evt.data
  44 + for i in dict:
  45 + m = dict[i]
  46 + if m.type == const.LINEAR:
  47 + mr = LinearMeasure(m.colour)
  48 + else:
  49 + mr = AngularMeasure(m.colour)
  50 + self.current = (m, mr)
  51 + self.measures.append(self.current)
  52 + print "m.index", m.index
  53 + print "m.points", m.points
  54 + for point in m.points:
  55 + print "-- point", point
  56 + x, y, z = point
  57 + actors = mr.AddPoint(x, y, z)
  58 + ps.Publisher().sendMessage(("Add actors", m.location),
  59 + (actors, m.slice_number))
  60 + print "----"
  61 +
38 62
39 def _add_point(self, pubsub_evt): 63 def _add_point(self, pubsub_evt):
40 position = pubsub_evt.data[0] 64 position = pubsub_evt.data[0]
invesalius/gui/data_notebook.py
@@ -1120,7 +1120,6 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): @@ -1120,7 +1120,6 @@ class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin):
1120 1120
1121 def InsertNewItem(self, index=0, label="Measurement 1", colour=None, 1121 def InsertNewItem(self, index=0, label="Measurement 1", colour=None,
1122 type_="LINEAR", location="SURFACE", value="0 mm"): 1122 type_="LINEAR", location="SURFACE", value="0 mm"):
1123 - print index, label, colour, type_, location, value  
1124 self.InsertStringItem(index, "") 1123 self.InsertStringItem(index, "")
1125 self.SetStringItem(index, 1, label, 1124 self.SetStringItem(index, 1, label,
1126 imageId = self._list_index[index]) 1125 imageId = self._list_index[index])