Commit 5ceb238cf2e3d5a3c2aa2f6f3d5cc1d546a03052
1 parent
f2330bfe
Exists in
master
and in
6 other branches
EHD: Enabled the layout window option
Showing
1 changed file
with
27 additions
and
9 deletions
Show diff stats
invesalius/gui/frame.py
@@ -78,7 +78,8 @@ class Frame(wx.Frame): | @@ -78,7 +78,8 @@ class Frame(wx.Frame): | ||
78 | ps.Publisher().subscribe(self.ShowContentPanel, 'Show content panel') | 78 | ps.Publisher().subscribe(self.ShowContentPanel, 'Show content panel') |
79 | ps.Publisher().subscribe(self.ShowImportPanel, "Show import panel") | 79 | ps.Publisher().subscribe(self.ShowImportPanel, "Show import panel") |
80 | ps.Publisher().subscribe(self.UpdateAui, "Update AUI") | 80 | ps.Publisher().subscribe(self.UpdateAui, "Update AUI") |
81 | - | 81 | + ps.Publisher().subscribe(self.ShowTask, 'Show task panel') |
82 | + ps.Publisher().subscribe(self.HideTask, 'Hide task panel') | ||
82 | 83 | ||
83 | def UpdateAui(self, pubsub_evt): | 84 | def UpdateAui(self, pubsub_evt): |
84 | self.aui_manager.Update() | 85 | self.aui_manager.Update() |
@@ -89,7 +90,7 @@ class Frame(wx.Frame): | @@ -89,7 +90,7 @@ class Frame(wx.Frame): | ||
89 | def __init_aui(self): | 90 | def __init_aui(self): |
90 | 91 | ||
91 | # Tell aui_manager to manage this frame | 92 | # Tell aui_manager to manage this frame |
92 | - aui_manager = wx.aui.AuiManager() | 93 | + aui_manager = self.aui_manager = wx.aui.AuiManager() |
93 | aui_manager.SetManagedWindow(self) | 94 | aui_manager.SetManagedWindow(self) |
94 | 95 | ||
95 | # Add panels to manager | 96 | # Add panels to manager |
@@ -101,6 +102,7 @@ class Frame(wx.Frame): | @@ -101,6 +102,7 @@ class Frame(wx.Frame): | ||
101 | #CloseButton(False).Floatable(False). | 102 | #CloseButton(False).Floatable(False). |
102 | #Layer(1).Left().MaximizeButton(False).Name("Task"). | 103 | #Layer(1).Left().MaximizeButton(False).Name("Task"). |
103 | #Position(0)) | 104 | #Position(0)) |
105 | + | ||
104 | 106 | ||
105 | aui_manager.AddPane(viewers.Panel(self), wx.aui.AuiPaneInfo(). | 107 | aui_manager.AddPane(viewers.Panel(self), wx.aui.AuiPaneInfo(). |
106 | Caption("Data panel").CaptionVisible(False). | 108 | Caption("Data panel").CaptionVisible(False). |
@@ -173,7 +175,15 @@ class Frame(wx.Frame): | @@ -173,7 +175,15 @@ class Frame(wx.Frame): | ||
173 | def OnSize(self, evt): | 175 | def OnSize(self, evt): |
174 | ps.Publisher().sendMessage(('ProgressBar Reposition')) | 176 | ps.Publisher().sendMessage(('ProgressBar Reposition')) |
175 | evt.Skip() | 177 | evt.Skip() |
176 | - | 178 | + |
179 | + def ShowTask(self, pubsub_evt): | ||
180 | + self.aui_manager.GetPane("Tasks").Show() | ||
181 | + self.aui_manager.Update() | ||
182 | + | ||
183 | + def HideTask(self, pubsub_evt): | ||
184 | + self.aui_manager.GetPane("Tasks").Hide() | ||
185 | + self.aui_manager.Update() | ||
186 | + | ||
177 | 187 | ||
178 | #def OnClose(self): | 188 | #def OnClose(self): |
179 | # # TODO: implement this, based on wx.Demo | 189 | # # TODO: implement this, based on wx.Demo |
@@ -568,7 +578,7 @@ class LayoutToolBar(wx.ToolBar): | @@ -568,7 +578,7 @@ class LayoutToolBar(wx.ToolBar): | ||
568 | 578 | ||
569 | self.parent = parent | 579 | self.parent = parent |
570 | self.__init_items() | 580 | self.__init_items() |
571 | - self.__bind_events() | 581 | + self.__bind_events_wx() |
572 | 582 | ||
573 | def __init_items(self): | 583 | def __init_items(self): |
574 | 584 | ||
@@ -585,10 +595,18 @@ class LayoutToolBar(wx.ToolBar): | @@ -585,10 +595,18 @@ class LayoutToolBar(wx.ToolBar): | ||
585 | BMP_WITH_MENU = wx.Bitmap("../icons/layout_full.gif", | 595 | BMP_WITH_MENU = wx.Bitmap("../icons/layout_full.gif", |
586 | wx.BITMAP_TYPE_GIF) | 596 | wx.BITMAP_TYPE_GIF) |
587 | 597 | ||
588 | - self.AddLabelTool(101, "Rotate image", BMP_WITHOUT_MENU) | ||
589 | - self.AddLabelTool(101, "Translate image", BMP_WITH_MENU) | ||
590 | - | 598 | + self.AddLabelTool(101, "Full layout", BMP_WITHOUT_MENU, kind = wx.ITEM_RADIO) |
599 | + self.AddLabelTool(102, "Original layout", BMP_WITH_MENU, kind = wx.ITEM_RADIO) | ||
600 | + self.ToggleTool(102, True) | ||
601 | + | ||
591 | self.Realize() | 602 | self.Realize() |
592 | 603 | ||
593 | - def __bind_events(self): | ||
594 | - pass | 604 | + def __bind_events_wx(self): |
605 | + self.Bind(wx.EVT_TOOL, self.OnClick) | ||
606 | + | ||
607 | + def OnClick(self, evt): | ||
608 | + | ||
609 | + if (evt.GetId() == 101): | ||
610 | + ps.Publisher().sendMessage('Hide task panel') | ||
611 | + else: | ||
612 | + ps.Publisher().sendMessage('Show task panel') |