Browse Source

Save frequently used paths to settings.json instead of 'spaths'

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
605cc5e609
3 changed files with 6 additions and 7 deletions
  1. 1
      TODO
  2. 9
      youtube_dl_gui/mainframe.py
  3. 3
      youtube_dl_gui/optionsmanager.py

1
TODO

@ -8,7 +8,6 @@ NEW_LAYOUT
* Swap some of the Error messages with Info * Swap some of the Error messages with Info
* Add clear list button ? * Add clear list button ?
* Icons theme selection (vote on github) * Icons theme selection (vote on github)
* Save freq. used paths to 'settings.json' instead of 'spaths'
* Update & re-enable options window * Update & re-enable options window
GUI GUI

9
youtube_dl_gui/mainframe.py

@ -188,9 +188,6 @@ class MainFrame(wx.Frame):
# Get the pixmaps directory # Get the pixmaps directory
self._pixmaps_path = get_pixmaps_dir() self._pixmaps_path = get_pixmaps_dir()
# Get stored save paths file
self._stored_paths = os.path.join(get_config_path(), "spaths")
# Get video formats # Get video formats
self._video_formats = read_formats() self._video_formats = read_formats()
@ -298,7 +295,7 @@ class MainFrame(wx.Frame):
self._status_bar_write(self.WELCOME_MSG) self._status_bar_write(self.WELCOME_MSG)
self._videoformat_combobox.SetValue(self._video_formats[self.opt_manager.options["video_format"]]) self._videoformat_combobox.SetValue(self._video_formats[self.opt_manager.options["video_format"]])
self._path_combobox.LoadMultiple(json_load(self._stored_paths))
self._path_combobox.LoadMultiple(self.opt_manager.options["save_path_dirs"])
self._path_combobox.SetValue(self.opt_manager.options["save_path"]) self._path_combobox.SetValue(self.opt_manager.options["save_path"])
self._set_layout() self._set_layout()
@ -930,11 +927,11 @@ class MainFrame(wx.Frame):
self.opt_manager.options['main_win_size'] = self.GetSize() self.opt_manager.options['main_win_size'] = self.GetSize()
self.opt_manager.options['opts_win_size'] = self._options_frame.GetSize() self.opt_manager.options['opts_win_size'] = self._options_frame.GetSize()
self.opt_manager.options["save_path_dirs"] = self._path_combobox.GetStrings()
#self._options_frame.save_all_options() #self._options_frame.save_all_options()
self.opt_manager.save_to_file() self.opt_manager.save_to_file()
json_store(self._stored_paths, self._path_combobox.GetStrings())
self.Destroy() self.Destroy()

3
youtube_dl_gui/optionsmanager.py

@ -198,9 +198,12 @@ class OptionsManager(object):
If window becomes to small the program will reset its size. If window becomes to small the program will reset its size.
See _settings_are_valid method MIN_FRAME_SIZE. See _settings_are_valid method MIN_FRAME_SIZE.
save_path_dirs (list): List that contains temporary save paths.
""" """
self.options = { self.options = {
'save_path': os_path_expanduser('~'), 'save_path': os_path_expanduser('~'),
'save_path_dirs': [],
'video_format': '0', 'video_format': '0',
'second_video_format': '0', 'second_video_format': '0',
'to_audio': False, 'to_audio': False,

Loading…
Cancel
Save