Commit bf5bc6ac046f2b7a62ef5b9cab506e04780296ab

Authored by Thiago Franco de Moraes
1 parent 6b54118d
Exists in master

UnInit auimanagers when exiting app

invesalius/gui/default_viewers.py
@@ -43,6 +43,7 @@ class Panel(wx.Panel): @@ -43,6 +43,7 @@ class Panel(wx.Panel):
43 43
44 self.__init_aui_manager() 44 self.__init_aui_manager()
45 self.__bind_events_wx() 45 self.__bind_events_wx()
  46 + self.__bind_events()
46 #self.__init_four_way_splitter() 47 #self.__init_four_way_splitter()
47 #self.__init_mix() 48 #self.__init_mix()
48 49
@@ -124,6 +125,9 @@ class Panel(wx.Panel): @@ -124,6 +125,9 @@ class Panel(wx.Panel):
124 self.aui_manager.Bind(wx.aui.EVT_AUI_PANE_MAXIMIZE, self.OnMaximize) 125 self.aui_manager.Bind(wx.aui.EVT_AUI_PANE_MAXIMIZE, self.OnMaximize)
125 self.aui_manager.Bind(wx.aui.EVT_AUI_PANE_RESTORE, self.OnRestore) 126 self.aui_manager.Bind(wx.aui.EVT_AUI_PANE_RESTORE, self.OnRestore)
126 127
  128 + def __bind_events(self):
  129 + Publisher.subscribe(self._Exit, 'Exit')
  130 +
127 def OnMaximize(self, evt): 131 def OnMaximize(self, evt):
128 if evt.GetPane().name == self.s4.name: 132 if evt.GetPane().name == self.s4.name:
129 Publisher.sendMessage('Show raycasting widget', None) 133 Publisher.sendMessage('Show raycasting widget', None)
@@ -152,6 +156,8 @@ class Panel(wx.Panel): @@ -152,6 +156,8 @@ class Panel(wx.Panel):
152 p4 = volume_viewer.Viewer(self) 156 p4 = volume_viewer.Viewer(self)
153 splitter.AppendWindow(p4) 157 splitter.AppendWindow(p4)
154 158
  159 + def _Exit(self, pubsub_evt):
  160 + self.aui_manager.UnInit()
155 161
156 def __init_mix(self): 162 def __init_mix(self):
157 aui_manager = wx.aui.AuiManager() 163 aui_manager = wx.aui.AuiManager()
@@ -246,6 +252,7 @@ class VolumeInteraction(wx.Panel): @@ -246,6 +252,7 @@ class VolumeInteraction(wx.Panel):
246 'Refresh raycasting widget points') 252 'Refresh raycasting widget points')
247 Publisher.subscribe(self.LoadHistogram, 253 Publisher.subscribe(self.LoadHistogram,
248 'Load histogram') 254 'Load histogram')
  255 + Publisher.subscribe(self._Exit, 'Exit')
249 256
250 def __update_curve_wwwl_text(self, curve): 257 def __update_curve_wwwl_text(self, curve):
251 ww, wl = self.clut_raycasting.GetCurveWWWl(curve) 258 ww, wl = self.clut_raycasting.GetCurveWWWl(curve)
@@ -299,6 +306,10 @@ class VolumeInteraction(wx.Panel): @@ -299,6 +306,10 @@ class VolumeInteraction(wx.Panel):
299 self.clut_raycasting.CalculatePixelPoints() 306 self.clut_raycasting.CalculatePixelPoints()
300 self.clut_raycasting.Refresh() 307 self.clut_raycasting.Refresh()
301 308
  309 + def _Exit(self, pubsub_evt):
  310 + self.aui_manager.UnInit()
  311 +
  312 +
302 import wx.lib.platebtn as pbtn 313 import wx.lib.platebtn as pbtn
303 import wx.lib.buttons as btn 314 import wx.lib.buttons as btn
304 import wx.lib.pubsub as ps 315 import wx.lib.pubsub as ps
invesalius/gui/frame.py
@@ -270,6 +270,7 @@ class Frame(wx.Frame): @@ -270,6 +270,7 @@ class Frame(wx.Frame):
270 """ 270 """
271 Exit InVesalius. 271 Exit InVesalius.
272 """ 272 """
  273 + self.aui_manager.UnInit()
273 self.Destroy() 274 self.Destroy()
274 if hasattr(sys,"frozen") and sys.platform == 'darwin': 275 if hasattr(sys,"frozen") and sys.platform == 'darwin':
275 sys.exit(0) 276 sys.exit(0)
@@ -392,7 +393,6 @@ class Frame(wx.Frame): @@ -392,7 +393,6 @@ class Frame(wx.Frame):
392 s = ses.Session() 393 s = ses.Session()
393 if not s.IsOpen() or not s.project_path: 394 if not s.IsOpen() or not s.project_path:
394 Publisher.sendMessage('Exit') 395 Publisher.sendMessage('Exit')
395 - self.aui_manager.UnInit()  
396 396
397 def OnMenuClick(self, evt): 397 def OnMenuClick(self, evt):
398 """ 398 """