Permalink
Browse files

BUG: #3262 update data probe on non-mouse-move events

Allow key strokes and other events that change the slice display
to trigger updates to the DataProbe window.  Only update the display
for the sliceView that matches the one most recently entered by
the mouse pointer.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22253 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
pieper committed Aug 1, 2013
1 parent d944a27 commit 4d2dd723ea7111ba6fc22888c1792e0efac43665
Showing with 23 additions and 1 deletion.
  1. +23 −1 Modules/Scripted/DataProbe/DataProbe.py
@@ -68,6 +68,12 @@ class DataProbeInfoWidget(object):
def __init__(self, parent=None,type='small'):
self.type = type
self.nameSize = 24
# the currentLayoutName is tag on the slice node that corresponds
# view which should currently be shown in the DataProbe window.
# Keeping track of this allows us to respond to non-interactor updates
# to the slice (like from an external tracker) but only in the view where
# the mouse has most recently entered.
self.currentLayoutName = None
# Default observer priority is 0.0, and the widgets have a 0.5 priority
# so we set this to 1 in order to get events that would
@@ -132,7 +138,8 @@ def refreshObservers(self):
for event in events:
tag = style.AddObserver(event, self.processEvent, self.priority)
self.styleObserverTags.append([style,tag])
# TODO: also observe the slice nodes
tag = sliceNode.AddObserver("ModifiedEvent", self.processEvent, self.priority)
self.styleObserverTags.append([sliceNode,tag])
def getPixelString(self,volumeNode,ijk):
"""Given a volume node, create a human readable
@@ -202,6 +209,7 @@ def getPixelString(self,volumeNode,ijk):
def processEvent(self,observee,event):
# TODO: use a timer to delay calculation and compress events
if event == 'LeaveEvent':
self.currentLayoutName = None
# reset all the readouts
self.viewerColor.setText( "" )
self.viewerName.setText( "" )
@@ -214,6 +222,20 @@ def processEvent(self,observee,event):
self.layerIJKs[layer].setText( "" )
self.layerValues[layer].setText( "" )
return
if event == 'EnterEvent':
sliceWidget = self.sliceWidgetsPerStyle[observee]
self.currentLayoutName = None
sliceLogic = sliceWidget.sliceLogic()
sliceNode = sliceWidget.mrmlSliceNode()
self.currentLayoutName = sliceNode.GetLayoutName()
if observee.IsA('vtkMRMLSliceNode'):
# for a slice node, get the corresponding style and
# set it as the observee so update is made for that sliceWidget
# if it is the current layout name
layoutManager = slicer.app.layoutManager()
sliceWidget = layoutManager.sliceWidget(observee.GetLayoutName())
if sliceWidget and observee.GetLayoutName() == self.currentLayoutName:
observee = sliceWidget.sliceView().interactor()
if self.sliceWidgetsPerStyle.has_key(observee):
sliceWidget = self.sliceWidgetsPerStyle[observee]
sliceLogic = sliceWidget.sliceLogic()

0 comments on commit 4d2dd72

Please sign in to comment.