Commit 6f8c898a1967861cc615cc19cf0dc70788bbd08d
1 parent
68c68639
Exists in
master
and in
67 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,7 +51,7 @@ class MeasurementManager(object): | ||
| 51 | for point in m.points: | 51 | for point in m.points: |
| 52 | x, y, z = point | 52 | x, y, z = point |
| 53 | actors = mr.AddPoint(x, y, z) | 53 | actors = mr.AddPoint(x, y, z) |
| 54 | - Publisher.sendMessage(("Add actors", m.location), | 54 | + Publisher.sendMessage(("Add actors " + str(m.location)), |
| 55 | (actors, m.slice_number)) | 55 | (actors, m.slice_number)) |
| 56 | self.current = None | 56 | self.current = None |
| 57 | 57 | ||
| @@ -103,8 +103,8 @@ class MeasurementManager(object): | @@ -103,8 +103,8 @@ class MeasurementManager(object): | ||
| 103 | print "---To REMOVE" | 103 | print "---To REMOVE" |
| 104 | actors = self.current[1].GetActors() | 104 | actors = self.current[1].GetActors() |
| 105 | slice_number = self.current[0].slice_number | 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 | if self.current[0].location == const.SURFACE: | 108 | if self.current[0].location == const.SURFACE: |
| 109 | Publisher.sendMessage('Render volume viewer') | 109 | Publisher.sendMessage('Render volume viewer') |
| 110 | else: | 110 | else: |
| @@ -156,7 +156,7 @@ class MeasurementManager(object): | @@ -156,7 +156,7 @@ class MeasurementManager(object): | ||
| 156 | m, mr = self.measures.pop(index) | 156 | m, mr = self.measures.pop(index) |
| 157 | actors = mr.GetActors() | 157 | actors = mr.GetActors() |
| 158 | prj.Project().RemoveMeasurement(index) | 158 | prj.Project().RemoveMeasurement(index) |
| 159 | - Publisher.sendMessage(('Remove actors', m.location), | 159 | + Publisher.sendMessage(('Remove actors ' + str(m.location)), |
| 160 | (actors, m.slice_number)) | 160 | (actors, m.slice_number)) |
| 161 | Publisher.sendMessage('Update slice viewer') | 161 | Publisher.sendMessage('Update slice viewer') |
| 162 | Publisher.sendMessage('Render volume viewer') | 162 | Publisher.sendMessage('Render volume viewer') |
invesalius/data/viewer_slice.py
| @@ -1505,6 +1505,7 @@ class Viewer(wx.Panel): | @@ -1505,6 +1505,7 @@ class Viewer(wx.Panel): | ||
| 1505 | def AddActors(self, pubsub_evt): | 1505 | def AddActors(self, pubsub_evt): |
| 1506 | "Inserting actors" | 1506 | "Inserting actors" |
| 1507 | actors, n = pubsub_evt.data | 1507 | actors, n = pubsub_evt.data |
| 1508 | + pos = self.scroll.GetThumbPosition() | ||
| 1508 | print actors | 1509 | print actors |
| 1509 | #try: | 1510 | #try: |
| 1510 | #renderer = self.renderers_by_slice_number[n] | 1511 | #renderer = self.renderers_by_slice_number[n] |
| @@ -1512,8 +1513,9 @@ class Viewer(wx.Panel): | @@ -1512,8 +1513,9 @@ class Viewer(wx.Panel): | ||
| 1512 | #renderer.AddActor(actor) | 1513 | #renderer.AddActor(actor) |
| 1513 | #except KeyError: | 1514 | #except KeyError: |
| 1514 | #pass | 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 | try: | 1520 | try: |
| 1519 | self.actors_by_slice_number[n].extend(actors) | 1521 | self.actors_by_slice_number[n].extend(actors) |