Browse Source

optionsframe.py: Remove unused code and update tags

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
6db536653f
2 changed files with 13 additions and 21 deletions
  1. 2
      TODO
  2. 32
      youtube_dl_gui/optionsframe.py

2
TODO

@ -1,6 +1,6 @@
NEW_LAYOUT NEW_LAYOUT
========== ==========
* Remove old code mainframe.py, optionsframe.py
* Remove old code mainframe.py
* Labels back to gettext * Labels back to gettext
GUI GUI

32
youtube_dl_gui/optionsframe.py

@ -10,29 +10,17 @@ import gettext
import wx import wx
from .version import __version__
from .info import (
__descriptionfull__,
__licensefull__,
__projecturl__,
__appname__,
__author__
)
from .utils import ( from .utils import (
TwoWayOrderedDict as twodict, TwoWayOrderedDict as twodict,
os_path_exists, os_path_exists,
get_icon_file, get_icon_file,
read_formats,
os_sep os_sep
) )
from .formats import ( from .formats import (
OUTPUT_FORMATS, OUTPUT_FORMATS,
VIDEO_FORMATS, VIDEO_FORMATS,
AUDIO_FORMATS,
FORMATS
AUDIO_FORMATS
) )
#REFACTOR Move all formats, etc to formats.py #REFACTOR Move all formats, etc to formats.py
@ -57,6 +45,7 @@ class OptionsFrame(wx.Frame):
self.app_icon = None self.app_icon = None
# Set the app icon # Set the app icon
#REFACTOR Get icon from parent
app_icon_path = get_icon_file() app_icon_path = get_icon_file()
if app_icon_path is not None: if app_icon_path is not None:
self.app_icon = wx.Icon(app_icon_path, wx.BITMAP_TYPE_PNG) self.app_icon = wx.Icon(app_icon_path, wx.BITMAP_TYPE_PNG)
@ -117,6 +106,7 @@ class OptionsFrame(wx.Frame):
def _on_close(self, event): def _on_close(self, event):
"""Event handler for wx.EVT_CLOSE event.""" """Event handler for wx.EVT_CLOSE event."""
self.save_all_options() self.save_all_options()
#REFACTOR Parent create specific callback
self.GetParent()._update_videoformat_combobox() self.GetParent()._update_videoformat_combobox()
self.Hide() self.Hide()
@ -176,7 +166,10 @@ class TabPanel(wx.Panel):
LISTBOX_SIZE = (-1, 80) LISTBOX_SIZE = (-1, 80)
def __init__(self, parent, notebook): def __init__(self, parent, notebook):
wx.Panel.__init__(self, notebook)
super(TabPanel, self).__init__(notebook)
#REFACTOR Maybe add methods to access those
#save_options(key, value)
#load_options(key)
self.opt_manager = parent.opt_manager self.opt_manager = parent.opt_manager
self.log_manager = parent.log_manager self.log_manager = parent.log_manager
self.app_icon = parent.app_icon self.app_icon = parent.app_icon
@ -267,14 +260,11 @@ class GeneralTab(TabPanel):
OUTPUT_TEMPLATES = [ OUTPUT_TEMPLATES = [
"Id", "Id",
"Title", "Title",
#"Url",
"Ext", "Ext",
"Uploader", "Uploader",
"Resolution", "Resolution",
"Autonumber", "Autonumber",
"", "",
#"License",
#"Duration",
"View Count", "View Count",
"Like Count", "Like Count",
"Dislike Count", "Dislike Count",
@ -283,13 +273,10 @@ class GeneralTab(TabPanel):
"Age Limit", "Age Limit",
"Width", "Width",
"Height", "Height",
#"Protocol",
"Extractor", "Extractor",
"", "",
"Playlist", "Playlist",
"Playlist Index", "Playlist Index",
#"Playlist Id",
#"Playlist Title"
] ]
BUTTONS_SIZE = (30, -1) BUTTONS_SIZE = (30, -1)
@ -424,6 +411,10 @@ class GeneralTab(TabPanel):
self.shutdown_checkbox.SetValue(self.opt_manager.options["shutdown"]) self.shutdown_checkbox.SetValue(self.opt_manager.options["shutdown"])
self.sudo_textctrl.SetValue(self.opt_manager.options["sudo_password"]) self.sudo_textctrl.SetValue(self.opt_manager.options["sudo_password"])
#REFACTOR Automatically call on the new methods
#save_options
#load_options
#NOTE Maybe on init add callback?
self._on_filename(None) self._on_filename(None)
self._on_shutdown(None) self._on_shutdown(None)
@ -628,6 +619,7 @@ class DownloadsTab(TabPanel):
self.subtitles_lang_listbox.Enable(self.subtitles_combobox.GetValue() == self.SUBS_CHOICES[-1]) self.subtitles_lang_listbox.Enable(self.subtitles_combobox.GetValue() == self.SUBS_CHOICES[-1])
def load_options(self): def load_options(self):
#NOTE Find a better way to do this
if self.opt_manager.options["write_subs"]: if self.opt_manager.options["write_subs"]:
self.subtitles_combobox.SetValue(self.SUBS_CHOICES[3]) self.subtitles_combobox.SetValue(self.SUBS_CHOICES[3])
elif self.opt_manager.options["write_all_subs"]: elif self.opt_manager.options["write_all_subs"]:

Loading…
Cancel
Save