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 | 44 | |
45 | 45 | # Slice toolbar |
46 | 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 | 50 | # Layout toolbar |
51 | 51 | VIEW_TOOLS = [ID_LAYOUT, ID_TEXT] = [wx.NewId() for number in range(2)] |
... | ... | @@ -641,11 +641,10 @@ class ObjectToolBar(wx.ToolBar): |
641 | 641 | id = evt.GetId() |
642 | 642 | state = self.GetToolState(id) |
643 | 643 | if state: |
644 | - print "Vai enviar..................." | |
645 | 644 | ps.Publisher().sendMessage('Enable mode', |
646 | 645 | MODE_BY_ID[id]) |
647 | 646 | |
648 | - #ps.Publisher().sendMessage('Untoggle slice toolbar items') | |
647 | + ps.Publisher().sendMessage('Untoggle slice toolbar items') | |
649 | 648 | else: |
650 | 649 | ps.Publisher().sendMessage('Disable mode', |
651 | 650 | MODE_BY_ID[id]) |
... | ... | @@ -712,14 +711,14 @@ class SliceToolBar(wx.ToolBar): |
712 | 711 | def OnClick(self, evt): |
713 | 712 | id = evt.GetId() |
714 | 713 | state = self.GetToolState(id) |
715 | - | |
714 | + | |
716 | 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 | 718 | ps.Publisher().sendMessage('Untoggle object toolbar items') |
720 | 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 | 722 | if id == ID_CROSS: |
724 | 723 | if state: |
725 | 724 | ps.Publisher().sendMessage('Set cross visibility', 1) |
... | ... | @@ -729,10 +728,8 @@ class SliceToolBar(wx.ToolBar): |
729 | 728 | ps.Publisher().sendMessage('Set cross visibility', 0) |
730 | 729 | |
731 | 730 | for item in SLICE_TOOLS: |
732 | - print "SLICE_TOOLS" | |
733 | 731 | state = self.GetToolState(item) |
734 | 732 | if state and (item != id): |
735 | - print "sim" | |
736 | 733 | self.ToggleTool(item, False) |
737 | 734 | |
738 | 735 | evt.Skip() | ... | ... |
invesalius/mode.py
... | ... | @@ -94,16 +94,17 @@ class SliceMode(object): |
94 | 94 | self.RemoveState(state) |
95 | 95 | |
96 | 96 | def AddState(self, state): |
97 | + | |
97 | 98 | level = const.LEVEL[state] |
98 | 99 | max_level = max(self.stack.keys()) |
99 | 100 | |
100 | 101 | |
101 | 102 | # Insert new state into stack |
102 | 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 | 108 | # Only will affect InVesalius behaviour if it is the highest |
108 | 109 | # level in stack |
109 | 110 | #if level == max_level: | ... | ... |