Commit 6f8c898a1967861cc615cc19cf0dc70788bbd08d
1 parent
68c68639
Exists in
master
and in
5 other branches
Resolved the problem with removing measures and when opening a inv3 file and all…
… measures are showed in the same slice The problem with removing measures was because a change in pubsub: it only accepts strings in the sendMessage message parameter or tuples of string. I was using int. So it was only necessary to change that in this way: "Remove Actor " + str(slice_number). The problem when opening an inv3 file was because I was not verifying if the measure being added is from the actual showed slice. Squashed commit of the following: commit 59bd23b0141aaa504b4af5a3cdc781b07e09889f Author: Thiago Franco de Moraes <totonixsame@gmail.com> Date: Mon Jun 25 14:43:53 2012 -0300 When opening a inv3 file only the measures from the showing slice in showed commit 07fc45a907438cb7ebdcaca84d47f2b04d301da2 Author: Thiago Franco de Moraes <totonixsame@gmail.com> Date: Mon Jun 25 14:24:47 2012 -0300 Adding measures actor from saved inv3 when it's opened commit 46b02de95bd2f1676a8bd96b18c48301047f9939 Author: Thiago Franco de Moraes <totonixsame@gmail.com> Date: Mon Jun 25 14:17:15 2012 -0300 Removing the measures is working again
Showing
2 changed files
with
8 additions
and
6 deletions
Show diff stats
invesalius/data/measures.py
... | ... | @@ -51,7 +51,7 @@ class MeasurementManager(object): |
51 | 51 | for point in m.points: |
52 | 52 | x, y, z = point |
53 | 53 | actors = mr.AddPoint(x, y, z) |
54 | - Publisher.sendMessage(("Add actors", m.location), | |
54 | + Publisher.sendMessage(("Add actors " + str(m.location)), | |
55 | 55 | (actors, m.slice_number)) |
56 | 56 | self.current = None |
57 | 57 | |
... | ... | @@ -103,8 +103,8 @@ class MeasurementManager(object): |
103 | 103 | print "---To REMOVE" |
104 | 104 | actors = self.current[1].GetActors() |
105 | 105 | slice_number = self.current[0].slice_number |
106 | - Publisher.sendMessage(('Remove actors', | |
107 | - self.current[0].location), (actors, slice_number)) | |
106 | + Publisher.sendMessage(('Remove actors ' + str(self.current[0].location)), | |
107 | + (actors, slice_number)) | |
108 | 108 | if self.current[0].location == const.SURFACE: |
109 | 109 | Publisher.sendMessage('Render volume viewer') |
110 | 110 | else: |
... | ... | @@ -156,7 +156,7 @@ class MeasurementManager(object): |
156 | 156 | m, mr = self.measures.pop(index) |
157 | 157 | actors = mr.GetActors() |
158 | 158 | prj.Project().RemoveMeasurement(index) |
159 | - Publisher.sendMessage(('Remove actors', m.location), | |
159 | + Publisher.sendMessage(('Remove actors ' + str(m.location)), | |
160 | 160 | (actors, m.slice_number)) |
161 | 161 | Publisher.sendMessage('Update slice viewer') |
162 | 162 | Publisher.sendMessage('Render volume viewer') | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -1505,6 +1505,7 @@ class Viewer(wx.Panel): |
1505 | 1505 | def AddActors(self, pubsub_evt): |
1506 | 1506 | "Inserting actors" |
1507 | 1507 | actors, n = pubsub_evt.data |
1508 | + pos = self.scroll.GetThumbPosition() | |
1508 | 1509 | print actors |
1509 | 1510 | #try: |
1510 | 1511 | #renderer = self.renderers_by_slice_number[n] |
... | ... | @@ -1512,8 +1513,9 @@ class Viewer(wx.Panel): |
1512 | 1513 | #renderer.AddActor(actor) |
1513 | 1514 | #except KeyError: |
1514 | 1515 | #pass |
1515 | - for actor in actors: | |
1516 | - self.slice_data.renderer.AddActor(actor) | |
1516 | + if pos == n: | |
1517 | + for actor in actors: | |
1518 | + self.slice_data.renderer.AddActor(actor) | |
1517 | 1519 | |
1518 | 1520 | try: |
1519 | 1521 | self.actors_by_slice_number[n].extend(actors) | ... | ... |