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