diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py index b34e286..68ce16d 100644 --- a/invesalius/gui/frame.py +++ b/invesalius/gui/frame.py @@ -128,7 +128,6 @@ class Frame(wx.Frame): # Create aui manager and insert content in it self.__init_aui() - self.preferences = preferences.Preferences(self) # Initialize bind to pubsub events self.__bind_events() self.__bind_events_wx() @@ -580,12 +579,13 @@ class Frame(wx.Frame): self.mw.SetPosition(pos) def ShowPreferences(self): + preferences_dialog = preferences.Preferences(None) + preferences_dialog.LoadPreferences() + preferences_dialog.Center() - self.preferences.Center() - - if self.preferences.ShowModal() == wx.ID_OK: - values = self.preferences.GetPreferences() - self.preferences.Close() + if preferences_dialog.ShowModal() == wx.ID_OK: + values = preferences_dialog.GetPreferences() + preferences_dialog.Destroy() ses.Session().rendering = values[const.RENDERING] ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] diff --git a/invesalius/gui/preferences.py b/invesalius/gui/preferences.py index 1dc0564..5443752 100644 --- a/invesalius/gui/preferences.py +++ b/invesalius/gui/preferences.py @@ -17,8 +17,7 @@ class Preferences(wx.Dialog): def __init__( self, parent, id = ID, title = _("Preferences"), size=wx.DefaultSize,\ pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): - wx.Dialog.__init__(self, parent, ID, title, pos, size, style) - self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) + wx.Dialog.__init__(self, parent, id, title, pos, size, style) sizer = wx.BoxSizer(wx.VERTICAL) @@ -44,16 +43,7 @@ class Preferences(wx.Dialog): line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) - btnsizer = wx.StdDialogButtonSizer() - - btn = wx.Button(self, wx.ID_OK) - btnsizer.AddButton(btn) - - btn = wx.Button(self, wx.ID_CANCEL) - btnsizer.AddButton(btn) - - btnsizer.Realize() - + btnsizer = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL) sizer.Add(btnsizer, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP|wx.BOTTOM, 5) self.SetSizer(sizer) @@ -64,7 +54,6 @@ class Preferences(wx.Dialog): def __bind_events(self): Publisher.subscribe(self.LoadPreferences, 'Load Preferences') - def GetPreferences(self): values = {} lang = self.pnl_language.GetSelection() diff --git a/invesalius/gui/task_exporter.py b/invesalius/gui/task_exporter.py index 0fe48b9..d1c204f 100644 --- a/invesalius/gui/task_exporter.py +++ b/invesalius/gui/task_exporter.py @@ -18,6 +18,7 @@ #-------------------------------------------------------------------------- import os +import pathlib import sys import wx @@ -317,9 +318,9 @@ class InnerTaskPanel(wx.Panel): if n_surface: if sys.platform == 'win32': - project_name = project.name + project_name = pathlib.Path(project.name).stem else: - project_name = project.name+".stl" + project_name = pathlib.Path(project.name).stem + ".stl" session = ses.Session() last_directory = session.get('paths', 'last_directory_3d_surface', '') -- libgit2 0.21.2