Commit 327cd317c365d6e707302845f147a5c8cfbc6960
1 parent
9e1e5326
Exists in
master
Preferences close button working
Showing
3 changed files
with
11 additions
and
21 deletions
Show diff stats
invesalius/gui/frame.py
| @@ -128,7 +128,6 @@ class Frame(wx.Frame): | @@ -128,7 +128,6 @@ class Frame(wx.Frame): | ||
| 128 | # Create aui manager and insert content in it | 128 | # Create aui manager and insert content in it |
| 129 | self.__init_aui() | 129 | self.__init_aui() |
| 130 | 130 | ||
| 131 | - self.preferences = preferences.Preferences(self) | ||
| 132 | # Initialize bind to pubsub events | 131 | # Initialize bind to pubsub events |
| 133 | self.__bind_events() | 132 | self.__bind_events() |
| 134 | self.__bind_events_wx() | 133 | self.__bind_events_wx() |
| @@ -580,12 +579,13 @@ class Frame(wx.Frame): | @@ -580,12 +579,13 @@ class Frame(wx.Frame): | ||
| 580 | self.mw.SetPosition(pos) | 579 | self.mw.SetPosition(pos) |
| 581 | 580 | ||
| 582 | def ShowPreferences(self): | 581 | def ShowPreferences(self): |
| 582 | + preferences_dialog = preferences.Preferences(None) | ||
| 583 | + preferences_dialog.LoadPreferences() | ||
| 584 | + preferences_dialog.Center() | ||
| 583 | 585 | ||
| 584 | - self.preferences.Center() | ||
| 585 | - | ||
| 586 | - if self.preferences.ShowModal() == wx.ID_OK: | ||
| 587 | - values = self.preferences.GetPreferences() | ||
| 588 | - self.preferences.Close() | 586 | + if preferences_dialog.ShowModal() == wx.ID_OK: |
| 587 | + values = preferences_dialog.GetPreferences() | ||
| 588 | + preferences_dialog.Destroy() | ||
| 589 | 589 | ||
| 590 | ses.Session().rendering = values[const.RENDERING] | 590 | ses.Session().rendering = values[const.RENDERING] |
| 591 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] | 591 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] |
invesalius/gui/preferences.py
| @@ -17,8 +17,7 @@ class Preferences(wx.Dialog): | @@ -17,8 +17,7 @@ class Preferences(wx.Dialog): | ||
| 17 | def __init__( self, parent, id = ID, title = _("Preferences"), size=wx.DefaultSize,\ | 17 | def __init__( self, parent, id = ID, title = _("Preferences"), size=wx.DefaultSize,\ |
| 18 | pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): | 18 | pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): |
| 19 | 19 | ||
| 20 | - wx.Dialog.__init__(self, parent, ID, title, pos, size, style) | ||
| 21 | - self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) | 20 | + wx.Dialog.__init__(self, parent, id, title, pos, size, style) |
| 22 | 21 | ||
| 23 | sizer = wx.BoxSizer(wx.VERTICAL) | 22 | sizer = wx.BoxSizer(wx.VERTICAL) |
| 24 | 23 | ||
| @@ -44,16 +43,7 @@ class Preferences(wx.Dialog): | @@ -44,16 +43,7 @@ class Preferences(wx.Dialog): | ||
| 44 | line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) | 43 | line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) |
| 45 | sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) | 44 | sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) |
| 46 | 45 | ||
| 47 | - btnsizer = wx.StdDialogButtonSizer() | ||
| 48 | - | ||
| 49 | - btn = wx.Button(self, wx.ID_OK) | ||
| 50 | - btnsizer.AddButton(btn) | ||
| 51 | - | ||
| 52 | - btn = wx.Button(self, wx.ID_CANCEL) | ||
| 53 | - btnsizer.AddButton(btn) | ||
| 54 | - | ||
| 55 | - btnsizer.Realize() | ||
| 56 | - | 46 | + btnsizer = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL) |
| 57 | sizer.Add(btnsizer, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP|wx.BOTTOM, 5) | 47 | sizer.Add(btnsizer, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP|wx.BOTTOM, 5) |
| 58 | 48 | ||
| 59 | self.SetSizer(sizer) | 49 | self.SetSizer(sizer) |
| @@ -64,7 +54,6 @@ class Preferences(wx.Dialog): | @@ -64,7 +54,6 @@ class Preferences(wx.Dialog): | ||
| 64 | def __bind_events(self): | 54 | def __bind_events(self): |
| 65 | Publisher.subscribe(self.LoadPreferences, 'Load Preferences') | 55 | Publisher.subscribe(self.LoadPreferences, 'Load Preferences') |
| 66 | 56 | ||
| 67 | - | ||
| 68 | def GetPreferences(self): | 57 | def GetPreferences(self): |
| 69 | values = {} | 58 | values = {} |
| 70 | lang = self.pnl_language.GetSelection() | 59 | lang = self.pnl_language.GetSelection() |
invesalius/gui/task_exporter.py
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | #-------------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------------- |
| 19 | 19 | ||
| 20 | import os | 20 | import os |
| 21 | +import pathlib | ||
| 21 | import sys | 22 | import sys |
| 22 | 23 | ||
| 23 | import wx | 24 | import wx |
| @@ -317,9 +318,9 @@ class InnerTaskPanel(wx.Panel): | @@ -317,9 +318,9 @@ class InnerTaskPanel(wx.Panel): | ||
| 317 | 318 | ||
| 318 | if n_surface: | 319 | if n_surface: |
| 319 | if sys.platform == 'win32': | 320 | if sys.platform == 'win32': |
| 320 | - project_name = project.name | 321 | + project_name = pathlib.Path(project.name).stem |
| 321 | else: | 322 | else: |
| 322 | - project_name = project.name+".stl" | 323 | + project_name = pathlib.Path(project.name).stem + ".stl" |
| 323 | 324 | ||
| 324 | session = ses.Session() | 325 | session = ses.Session() |
| 325 | last_directory = session.get('paths', 'last_directory_3d_surface', '') | 326 | last_directory = session.get('paths', 'last_directory_3d_surface', '') |