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 | 128 | # Create aui manager and insert content in it |
129 | 129 | self.__init_aui() |
130 | 130 | |
131 | - self.preferences = preferences.Preferences(self) | |
132 | 131 | # Initialize bind to pubsub events |
133 | 132 | self.__bind_events() |
134 | 133 | self.__bind_events_wx() |
... | ... | @@ -580,12 +579,13 @@ class Frame(wx.Frame): |
580 | 579 | self.mw.SetPosition(pos) |
581 | 580 | |
582 | 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 | 590 | ses.Session().rendering = values[const.RENDERING] |
591 | 591 | ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] | ... | ... |
invesalius/gui/preferences.py
... | ... | @@ -17,8 +17,7 @@ class Preferences(wx.Dialog): |
17 | 17 | def __init__( self, parent, id = ID, title = _("Preferences"), size=wx.DefaultSize,\ |
18 | 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 | 22 | sizer = wx.BoxSizer(wx.VERTICAL) |
24 | 23 | |
... | ... | @@ -44,16 +43,7 @@ class Preferences(wx.Dialog): |
44 | 43 | line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) |
45 | 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 | 47 | sizer.Add(btnsizer, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP|wx.BOTTOM, 5) |
58 | 48 | |
59 | 49 | self.SetSizer(sizer) |
... | ... | @@ -64,7 +54,6 @@ class Preferences(wx.Dialog): |
64 | 54 | def __bind_events(self): |
65 | 55 | Publisher.subscribe(self.LoadPreferences, 'Load Preferences') |
66 | 56 | |
67 | - | |
68 | 57 | def GetPreferences(self): |
69 | 58 | values = {} |
70 | 59 | lang = self.pnl_language.GetSelection() | ... | ... |
invesalius/gui/task_exporter.py
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | |
20 | 20 | import os |
21 | +import pathlib | |
21 | 22 | import sys |
22 | 23 | |
23 | 24 | import wx |
... | ... | @@ -317,9 +318,9 @@ class InnerTaskPanel(wx.Panel): |
317 | 318 | |
318 | 319 | if n_surface: |
319 | 320 | if sys.platform == 'win32': |
320 | - project_name = project.name | |
321 | + project_name = pathlib.Path(project.name).stem | |
321 | 322 | else: |
322 | - project_name = project.name+".stl" | |
323 | + project_name = pathlib.Path(project.name).stem + ".stl" | |
323 | 324 | |
324 | 325 | session = ses.Session() |
325 | 326 | last_directory = session.get('paths', 'last_directory_3d_surface', '') | ... | ... |