Browse Source

[optionsframe] Center on parent on first show only

doc-issue-template
Sergey M․ 9 years ago
parent
commit
0212a42bf5
1 changed files with 10 additions and 0 deletions
  1. 10
      youtube_dl_gui/optionsframe.py

10
youtube_dl_gui/optionsframe.py

@ -62,6 +62,8 @@ class OptionsFrame(wx.Frame):
if self.app_icon is not None:
self.SetIcon(self.app_icon)
self._was_shown = False
# Create GUI
panel = wx.Panel(self)
notebook = wx.Notebook(panel)
@ -123,6 +125,14 @@ class OptionsFrame(wx.Frame):
for tab, _ in self.tabs:
tab.save_options()
def Show(self, *args, **kwargs):
# CenterOnParent can't go to main frame's __init__ as main frame may change
# own position and options frame won't be centered on main frame anymore.
if not self._was_shown:
self._was_shown = True
self.CenterOnParent()
return wx.Frame.Show(self, *args, **kwargs)
class TabPanel(wx.Panel):

Loading…
Cancel
Save