Commit 34c37117a547c9615a125f878d472a360843f77b

Authored by tatiana
1 parent 9cec3f0b

ENH: Reverted spin event on volume viewer and improved #53

invesalius/data/viewer_volume.py
... ... @@ -103,8 +103,6 @@ class Viewer(wx.Panel):
103 103 ps.Publisher().subscribe(self.OnSetViewAngle,
104 104 'Set volume view angle')
105 105  
106   - ps.Publisher().subscribe(self.SetNewMode,
107   - ('Set interaction mode', const.MODE_WW_WL))
108 106 ps.Publisher().subscribe(self.OnDisableBrightContrast,
109 107 ('Set interaction mode',
110 108 const.MODE_SLICE_EDITOR))
... ... @@ -151,14 +149,11 @@ class Viewer(wx.Panel):
151 149 "LeftButtonPressEvent": self.OnZoomClick,
152 150 "LeftButtonReleaseEvent": self.OnReleaseZoomClick,
153 151 },
154   - #const.STATE_SPIN:
155   - # {
156   - # "MouseMoveEvent": self.OnSpinMove,
157   - # "LeftButtonPressEvent": self.OnSpinClick,
158   - # "LeftButtonReleaseEvent": self.OnReleaseSpinClick,
159   - # },
160 152 const.STATE_SPIN:
161 153 {
  154 + "MouseMoveEvent": self.OnSpinMove,
  155 + "LeftButtonPressEvent": self.OnSpinClick,
  156 + "LeftButtonReleaseEvent": self.OnReleaseSpinClick,
162 157 },
163 158 const.STATE_WL:
164 159 {
... ... @@ -166,7 +161,7 @@ class Viewer(wx.Panel):
166 161 "LeftButtonPressEvent": self.OnWindowLevelClick,
167 162 "LeftButtonReleaseEvent":self.OnWindowLevelRelease
168 163 },
169   - const.STATE_DEFAULT:
  164 + const.STATE_DEFAULT:
170 165 {
171 166 }
172 167 }
... ... @@ -186,43 +181,16 @@ class Viewer(wx.Panel):
186 181 self.interactor.SetInteractorStyle(style)
187 182 self.style = style
188 183 else:
  184 + print "ELSE!"
189 185 style = vtk.vtkInteractorStyleTrackballCamera()
190 186 self.interactor.SetInteractorStyle(style)
191 187 self.style = style
192 188  
193 189 # Check each event available for each mode
194 190 for event in action[state]:
  191 + print event
195 192 # Bind event
196   - style.AddObserver(event,action[state][event])
197   -
198   - def SetStyle(self, pubsub_evt):
199   - print "SetStyle"
200   - mode = pubsub_evt.data
201   -
202   - if (mode == const.MODE_ZOOM_SELECTION):
203   - self.SetMode('ZOOMSELECT')
204   - elif(mode == const.MODE_MOVE):
205   - self.SetMode('PAN')
206   - elif(mode == const.MODE_ZOOM):
207   - self.SetMode('ZOOM')
208   - elif(mode == const.MODE_ROTATE):
209   - self.SetMode('SPIN')
210   - elif(mode == const.MODE_WW_WL):
211   - self.SetMode('WINDOWLEVEL')
212   -
213   - def SetNewMode(self, pubsub_evt):
214   - mode = pubsub_evt.topic[1]
215   -
216   - if (mode == const.MODE_ZOOM_SELECTION):
217   - self.SetMode('ZOOMSELECT')
218   - elif(mode == const.MODE_MOVE):
219   - self.SetMode('PAN')
220   - elif(mode == const.MODE_ZOOM):
221   - self.SetMode('ZOOM')
222   - elif(mode == const.MODE_ROTATE):
223   - self.SetMode('SPIN')
224   - elif(mode == const.MODE_WW_WL):
225   - self.SetMode('WINDOWLEVEL')
  193 + style.AddObserver(event,action[state][event])
226 194  
227 195 def OnSpinMove(self, evt, obj):
228 196 if (self.mouse_pressed):
... ... @@ -292,7 +260,6 @@ class Viewer(wx.Panel):
292 260 new_state = self.interaction_style.AddState(state)
293 261 self.SetInteractorStyle(new_state)
294 262 else:
295   - #level = const.STYLE_LEVEL[state]
296 263 new_state = self.interaction_style.RemoveState(state)
297 264 self.SetInteractorStyle(new_state)
298 265  
... ... @@ -399,7 +366,12 @@ class Viewer(wx.Panel):
399 366  
400 367 self.ren.AddVolume(volume)
401 368 self.text.SetValue("WL: %d WW: %d"%(wl, ww))
402   -
  369 +
  370 + if self.on_wl:
  371 + self.text.Show()
  372 + else:
  373 + self.text.Hide()
  374 +
403 375 self.ren.SetBackground(colour)
404 376  
405 377 if not (self.view_angle):
... ...
invesalius/version.py
... ... @@ -27,10 +27,10 @@ import re
27 27  
28 28 def get_svn_revision(path=None):
29 29 """
30   - Returns the SVN revision in the form SVN-XXXX,
  30 + Returns the SVN revision in the form pspb-XXXX,
31 31 where XXXX is the revision number.
32 32  
33   - Returns SVN-unknown if anything goes wrong, such as an unexpected
  33 + Returns pspb-unknown if anything goes wrong, such as an unexpected
34 34 format of internal SVN files.
35 35  
36 36 If path is provided, it should be a directory whose SVN info you want to
... ...