From 327a3704c7c3cfc274c34fe65c9cdce3359fb743 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Mon, 15 Dec 2014 16:19:30 +0200 Subject: [PATCH] Keep single instance of optionsframe --- youtube_dl_gui/mainframe.py | 6 ++++-- youtube_dl_gui/optionsframe.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index 5a44244..7dc3994 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -85,6 +85,9 @@ class MainFrame(wx.Frame): self.app_icon = wx.Icon(self.app_icon, wx.BITMAP_TYPE_PNG) self.SetIcon(self.app_icon) + # Create options frame + self._options_frame = OptionsFrame(self) + # Create components self._panel = wx.Panel(self) @@ -309,8 +312,7 @@ class MainFrame(wx.Frame): def _on_options(self, event): ''' Event handler method for self._options_btn. ''' - options_frame = OptionsFrame(self) - options_frame.Show() + self._options_frame.Show() def _on_close(self, event): ''' Event handler method (wx.EVT_CLOSE). ''' diff --git a/youtube_dl_gui/optionsframe.py b/youtube_dl_gui/optionsframe.py index 1a55b4c..c05d49d 100644 --- a/youtube_dl_gui/optionsframe.py +++ b/youtube_dl_gui/optionsframe.py @@ -172,7 +172,7 @@ class OptionsFrame(wx.Frame): def _on_close(self, event): ''' Event handler for wx.EVT_CLOSE. ''' self.save_all_options() - self.Destroy() + self.Hide() def reset(self): ''' Reset default options. '''