Commit 45fcc00e8b0283535faf15abdbe23bce19435feb

Authored by tatiana
1 parent 0e4def26

FIX: Problem with volume viewer bindings - Volume disabled after [1660]

invesalius/constants.py
... ... @@ -428,11 +428,16 @@ STATE_SPIN = 1002
428 428 STATE_ZOOM = 1003
429 429 STATE_ZOOM_SL = 1004
430 430 STATE_PAN = 1005
431   -SLICE_STATE_CROSS = 1006
432   -SLICE_STATE_SCROLL = 1007
433   -SLICE_STATE_EDITOR = 1008
  431 +STATE_ANNOTATE = 1006
  432 +STATE_MEASURE_DISTANCE = 1007
  433 +STATE_MEASURE_ANGLE = 1008
  434 +
  435 +SLICE_STATE_CROSS = 3006
  436 +SLICE_STATE_SCROLL = 3007
  437 +SLICE_STATE_EDITOR = 3008
  438 +
434 439 VOLUME_STATE_SEED = 2001
435   -STATE_LINEAR_MEASURE = 3001
  440 +#STATE_LINEAR_MEASURE = 3001
436 441  
437 442  
438 443 TOOL_STATES = [ STATE_WL, STATE_SPIN, STATE_ZOOM,
... ... @@ -445,18 +450,20 @@ SLICE_STYLES = TOOL_STATES + TOOL_SLICE_STATES
445 450 SLICE_STYLES.append(STATE_DEFAULT)
446 451 SLICE_STYLES.append(SLICE_STATE_EDITOR)
447 452  
448   -VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_LINEAR_MEASURE]
  453 +VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_MEASURE_DISTANCE]
449 454 VOLUME_STYLES.append(STATE_DEFAULT)
450 455  
451 456  
452 457 STYLE_LEVEL = {SLICE_STATE_EDITOR: 1,
453 458 SLICE_STATE_CROSS: 2,
454 459 SLICE_STATE_SCROLL: 2,
  460 + STATE_ANNOTATE: 2,
455 461 STATE_DEFAULT: 0,
  462 + STATE_MEASURE_ANGLE: 2,
  463 + STATE_MEASURE_DISTANCE: 2,
456 464 STATE_WL: 2,
457 465 STATE_SPIN: 2,
458 466 STATE_ZOOM: 2,
459 467 STATE_ZOOM_SL: 2,
460 468 STATE_PAN:2,
461   - VOLUME_STATE_SEED:1,
462   - STATE_LINEAR_MEASURE: 2}
  469 + VOLUME_STATE_SEED:1}
... ...
invesalius/data/viewer_volume.py
... ... @@ -262,6 +262,8 @@ class Viewer(wx.Panel):
262 262 pass
263 263  
264 264 def SetInteractorStyle(self, state):
  265 + print "SetInteractorStyle"
  266 + print "state: ", state
265 267 action = {
266 268 const.STATE_PAN:
267 269 {
... ... @@ -294,7 +296,7 @@ class Viewer(wx.Panel):
294 296 {
295 297 "LeftButtonPressEvent": self.OnInsertSeed
296 298 },
297   - const.STATE_LINEAR_MEASURE:
  299 + const.STATE_MEASURE_DISTANCE:
298 300 {
299 301 "LeftButtonPressEvent": self.OnInsertLinearMeasurePoint
300 302 }
... ... @@ -310,6 +312,9 @@ class Viewer(wx.Panel):
310 312 self.text.Hide()
311 313 self.interactor.Render()
312 314  
  315 + if state == const.STATE_MEASURE_DISTANCE:
  316 + self.interactor.SetPicker(self.measure_picker)
  317 +
313 318 if (state == const.STATE_ZOOM_SL):
314 319 style = vtk.vtkInteractorStyleRubberBandZoom()
315 320 self.interactor.SetInteractorStyle(style)
... ... @@ -319,9 +324,6 @@ class Viewer(wx.Panel):
319 324 self.interactor.SetInteractorStyle(style)
320 325 self.style = style
321 326  
322   - if state == const.STATE_LINEAR_MEASURE:
323   - self.interactor.SetPicker(self.measure_picker)
324   -
325 327 # Check each event available for each mode
326 328 for event in action[state]:
327 329 # Bind event
... ...