Commit ef60a61bd31f4b83186648f016581bec7d01d2bf

Authored by Paulo Henrique Junqueira Amorim
1 parent 6c8ae9b6

ENH: Changed constant from keyUP and keyDown, represented with number to constan…

…t of the wx (wx.WXK_UP and wx.WXK_DOWN)
Showing 1 changed file with 14 additions and 14 deletions   Show diff stats
invesalius/data/viewer_slice.py
@@ -355,9 +355,9 @@ class Viewer(wx.Panel): @@ -355,9 +355,9 @@ class Viewer(wx.Panel):
355 ### 355 ###
356 ps.Publisher().subscribe(self.ChangeBrushSize, 356 ps.Publisher().subscribe(self.ChangeBrushSize,
357 'Set edition brush size') 357 'Set edition brush size')
358 - ps.Publisher().subscribe(self.ChangeBrushColour, 358 + ps.Publisher().subscribe(self.ChangeBrushColour,
359 'Add mask') 359 'Add mask')
360 - ps.Publisher().subscribe(self.ChangeBrushActor, 360 + ps.Publisher().subscribe(self.ChangeBrushActor,
361 'Set brush format') 361 'Set brush format')
362 ps.Publisher().subscribe(self.ChangeBrushOperation, 362 ps.Publisher().subscribe(self.ChangeBrushOperation,
363 'Set edition operation') 363 'Set edition operation')
@@ -379,7 +379,7 @@ class Viewer(wx.Panel): @@ -379,7 +379,7 @@ class Viewer(wx.Panel):
379 proportion_y = 1.0 / self.layout[1] 379 proportion_y = 1.0 / self.layout[1]
380 for i in xrange(self.layout[0]): 380 for i in xrange(self.layout[0]):
381 for j in xrange(self.layout[1]): 381 for j in xrange(self.layout[1]):
382 - position = ((i*proportion_x, j * proportion_y, 382 + position = ((i*proportion_x, j * proportion_y,
383 (i+1)*proportion_x, (j+1)*proportion_y)) 383 (i+1)*proportion_x, (j+1)*proportion_y))
384 slice_data = self.create_slice_window(image) 384 slice_data = self.create_slice_window(image)
385 slice_data.renderer.SetViewport(position) 385 slice_data.renderer.SetViewport(position)
@@ -456,12 +456,12 @@ class Viewer(wx.Panel): @@ -456,12 +456,12 @@ class Viewer(wx.Panel):
456 if (slice_data.cursor): 456 if (slice_data.cursor):
457 slice_number = slice_data.number 457 slice_number = slice_data.number
458 actor_bound = slice_data.actor.GetBounds() 458 actor_bound = slice_data.actor.GetBounds()
459 - 459 +
460 yz = [actor_bound[1] + 1 + slice_number, y, z] 460 yz = [actor_bound[1] + 1 + slice_number, y, z]
461 xz = [x, actor_bound[3] - 1 - slice_number, z] 461 xz = [x, actor_bound[3] - 1 - slice_number, z]
462 xy = [x, y, actor_bound[5] + 1 + slice_number] 462 xy = [x, y, actor_bound[5] + 1 + slice_number]
463 -  
464 - proj = project.Project() 463 +
  464 + proj = project.Project()
465 orig_orien = proj.original_orientation 465 orig_orien = proj.original_orientation
466 466
467 if (orig_orien == const.SAGITAL): 467 if (orig_orien == const.SAGITAL):
@@ -470,7 +470,7 @@ class Viewer(wx.Panel): @@ -470,7 +470,7 @@ class Viewer(wx.Panel):
470 coordinates = {"SAGITAL": yz, "CORONAL": xy, "AXIAL": xz} 470 coordinates = {"SAGITAL": yz, "CORONAL": xy, "AXIAL": xz}
471 else: 471 else:
472 coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy} 472 coordinates = {"SAGITAL": yz, "CORONAL": xz, "AXIAL": xy}
473 - 473 +
474 slice_data.cursor.SetPosition(coordinates[self.orientation]) 474 slice_data.cursor.SetPosition(coordinates[self.orientation])
475 475
476 def SetOrientation(self, orientation): 476 def SetOrientation(self, orientation):
@@ -494,7 +494,7 @@ class Viewer(wx.Panel): @@ -494,7 +494,7 @@ class Viewer(wx.Panel):
494 orientation = self.orientation 494 orientation = self.orientation
495 proj = project.Project() 495 proj = project.Project()
496 orig_orien = proj.original_orientation 496 orig_orien = proj.original_orientation
497 - 497 +
498 cam = slice_data.renderer.GetActiveCamera() 498 cam = slice_data.renderer.GetActiveCamera()
499 cam.SetFocalPoint(0, 0, 0) 499 cam.SetFocalPoint(0, 0, 0)
500 cam.SetViewUp(const.SLICE_POSITION[orig_orien][0][self.orientation]) 500 cam.SetViewUp(const.SLICE_POSITION[orig_orien][0][self.orientation])
@@ -513,15 +513,15 @@ class Viewer(wx.Panel): @@ -513,15 +513,15 @@ class Viewer(wx.Panel):
513 proj = project.Project() 513 proj = project.Project()
514 514
515 pos = slice_data.number 515 pos = slice_data.number
516 - 516 +
517 x = (pos, pos, e[2], e[3], e[4], e[5]) 517 x = (pos, pos, e[2], e[3], e[4], e[5])
518 y = (e[0], e[1], pos, pos, e[4], e[5]) 518 y = (e[0], e[1], pos, pos, e[4], e[5])
519 z = (e[0], e[1], e[2], e[3], pos, pos) 519 z = (e[0], e[1], e[2], e[3], pos, pos)
520 -  
521 - if (proj.original_orientation == const.AXIAL): 520 +
  521 + if (proj.original_orientation == const.AXIAL):
522 new_extent = {"SAGITAL": x, "CORONAL": y, "AXIAL": z} 522 new_extent = {"SAGITAL": x, "CORONAL": y, "AXIAL": z}
523 elif(proj.original_orientation == const.SAGITAL): 523 elif(proj.original_orientation == const.SAGITAL):
524 - new_extent = {"SAGITAL": z,"CORONAL": x,"AXIAL": y} 524 + new_extent = {"SAGITAL": z,"CORONAL": x,"AXIAL": y}
525 elif(proj.original_orientation == const.CORONAL): 525 elif(proj.original_orientation == const.CORONAL):
526 new_extent = {"SAGITAL": x,"CORONAL": z,"AXIAL": y} 526 new_extent = {"SAGITAL": x,"CORONAL": z,"AXIAL": y}
527 527
@@ -548,11 +548,11 @@ class Viewer(wx.Panel): @@ -548,11 +548,11 @@ class Viewer(wx.Panel):
548 min = 0 548 min = 0
549 max = self.actor.GetSliceNumberMax() 549 max = self.actor.GetSliceNumberMax()
550 550
551 - if (evt.GetKeyCode() == 315 and pos > min): 551 + if (evt.GetKeyCode() == wx.WXK_UP and pos > min):
552 pos = pos - 1 552 pos = pos - 1
553 self.scroll.SetThumbPosition(pos) 553 self.scroll.SetThumbPosition(pos)
554 self.OnScrollBar() 554 self.OnScrollBar()
555 - elif (evt.GetKeyCode() == 317 and pos < max): 555 + elif (evt.GetKeyCode() == wx.WXK_DOWN and pos < max):
556 pos = pos + 1 556 pos = pos + 1
557 self.scroll.SetThumbPosition(pos) 557 self.scroll.SetThumbPosition(pos)
558 self.OnScrollBar() 558 self.OnScrollBar()