Commit 267cdf7727c6192d8b39ed490cc39fb22fba01b3
1 parent
157fb2f7
Exists in
master
and in
6 other branches
ENH: Restructuring state of the tools
Showing
2 changed files
with
13 additions
and
15 deletions
Show diff stats
invesalius/gui/frame.py
@@ -44,8 +44,8 @@ MODE_BY_ID = {ID_ZOOM: const.STATE_ZOOM, | @@ -44,8 +44,8 @@ MODE_BY_ID = {ID_ZOOM: const.STATE_ZOOM, | ||
44 | 44 | ||
45 | # Slice toolbar | 45 | # Slice toolbar |
46 | SLICE_TOOLS = [ID_SLICE_SCROLL, ID_CROSS] = [wx.NewId() for number in range(2)] | 46 | SLICE_TOOLS = [ID_SLICE_SCROLL, ID_CROSS] = [wx.NewId() for number in range(2)] |
47 | -SLICE_MODE_BY_ID = {ID_SLICE_SCROLL: const.MODE_SLICE_SCROLL, | ||
48 | - ID_CROSS: const.MODE_SLICE_CROSS} | 47 | +SLICE_MODE_BY_ID = {ID_SLICE_SCROLL: const.SLICE_STATE_SCROLL, |
48 | + ID_CROSS: const.SLICE_STATE_CROSS} | ||
49 | 49 | ||
50 | # Layout toolbar | 50 | # Layout toolbar |
51 | VIEW_TOOLS = [ID_LAYOUT, ID_TEXT] = [wx.NewId() for number in range(2)] | 51 | VIEW_TOOLS = [ID_LAYOUT, ID_TEXT] = [wx.NewId() for number in range(2)] |
@@ -641,11 +641,10 @@ class ObjectToolBar(wx.ToolBar): | @@ -641,11 +641,10 @@ class ObjectToolBar(wx.ToolBar): | ||
641 | id = evt.GetId() | 641 | id = evt.GetId() |
642 | state = self.GetToolState(id) | 642 | state = self.GetToolState(id) |
643 | if state: | 643 | if state: |
644 | - print "Vai enviar..................." | ||
645 | ps.Publisher().sendMessage('Enable mode', | 644 | ps.Publisher().sendMessage('Enable mode', |
646 | MODE_BY_ID[id]) | 645 | MODE_BY_ID[id]) |
647 | 646 | ||
648 | - #ps.Publisher().sendMessage('Untoggle slice toolbar items') | 647 | + ps.Publisher().sendMessage('Untoggle slice toolbar items') |
649 | else: | 648 | else: |
650 | ps.Publisher().sendMessage('Disable mode', | 649 | ps.Publisher().sendMessage('Disable mode', |
651 | MODE_BY_ID[id]) | 650 | MODE_BY_ID[id]) |
@@ -712,14 +711,14 @@ class SliceToolBar(wx.ToolBar): | @@ -712,14 +711,14 @@ class SliceToolBar(wx.ToolBar): | ||
712 | def OnClick(self, evt): | 711 | def OnClick(self, evt): |
713 | id = evt.GetId() | 712 | id = evt.GetId() |
714 | state = self.GetToolState(id) | 713 | state = self.GetToolState(id) |
715 | - | 714 | + |
716 | if state: | 715 | if state: |
717 | - ps.Publisher().sendMessage(('Set interaction mode', | ||
718 | - SLICE_MODE_BY_ID[id])) | 716 | + ps.Publisher().sendMessage('Enable mode', |
717 | + SLICE_MODE_BY_ID[id]) | ||
719 | ps.Publisher().sendMessage('Untoggle object toolbar items') | 718 | ps.Publisher().sendMessage('Untoggle object toolbar items') |
720 | else: | 719 | else: |
721 | - ps.Publisher().sendMessage(('Set interaction mode', | ||
722 | - const.MODE_SLICE_EDITOR)) | 720 | + ps.Publisher().sendMessage('Disable mode', |
721 | + SLICE_MODE_BY_ID[id]) | ||
723 | if id == ID_CROSS: | 722 | if id == ID_CROSS: |
724 | if state: | 723 | if state: |
725 | ps.Publisher().sendMessage('Set cross visibility', 1) | 724 | ps.Publisher().sendMessage('Set cross visibility', 1) |
@@ -729,10 +728,8 @@ class SliceToolBar(wx.ToolBar): | @@ -729,10 +728,8 @@ class SliceToolBar(wx.ToolBar): | ||
729 | ps.Publisher().sendMessage('Set cross visibility', 0) | 728 | ps.Publisher().sendMessage('Set cross visibility', 0) |
730 | 729 | ||
731 | for item in SLICE_TOOLS: | 730 | for item in SLICE_TOOLS: |
732 | - print "SLICE_TOOLS" | ||
733 | state = self.GetToolState(item) | 731 | state = self.GetToolState(item) |
734 | if state and (item != id): | 732 | if state and (item != id): |
735 | - print "sim" | ||
736 | self.ToggleTool(item, False) | 733 | self.ToggleTool(item, False) |
737 | 734 | ||
738 | evt.Skip() | 735 | evt.Skip() |
invesalius/mode.py
@@ -94,16 +94,17 @@ class SliceMode(object): | @@ -94,16 +94,17 @@ class SliceMode(object): | ||
94 | self.RemoveState(state) | 94 | self.RemoveState(state) |
95 | 95 | ||
96 | def AddState(self, state): | 96 | def AddState(self, state): |
97 | + | ||
97 | level = const.LEVEL[state] | 98 | level = const.LEVEL[state] |
98 | max_level = max(self.stack.keys()) | 99 | max_level = max(self.stack.keys()) |
99 | 100 | ||
100 | 101 | ||
101 | # Insert new state into stack | 102 | # Insert new state into stack |
102 | self.stack[level] = state | 103 | self.stack[level] = state |
103 | - print "ADD---->" | ||
104 | - print self.stack | ||
105 | - print level | ||
106 | - print state | 104 | + #print "ADD---->" |
105 | + #print self.stack | ||
106 | + #print level | ||
107 | + #print state | ||
107 | # Only will affect InVesalius behaviour if it is the highest | 108 | # Only will affect InVesalius behaviour if it is the highest |
108 | # level in stack | 109 | # level in stack |
109 | #if level == max_level: | 110 | #if level == max_level: |