Browse Source

Add error message on open_dir fail

doc-issue-template
MrS0m30n3 10 years ago
parent
commit
6ad25b96ee
2 changed files with 13 additions and 2 deletions
  1. 8
      youtube_dl_gui/mainframe.py
  2. 7
      youtube_dl_gui/utils.py

8
youtube_dl_gui/mainframe.py

@ -98,6 +98,9 @@ class MainFrame(wx.Frame):
UPDATE_ERR_MSG = _("Youtube-dl download failed [{0}]")
UPDATE_SUCC_MSG = _("Youtube-dl downloaded correctly")
OPEN_DIR_ERR = _("Unable to open directory: '{dir}'. "
"The specified path does not exist")
VIDEO_LABEL = _("Title")
SIZE_LABEL = _("Size")
PERCENT_LABEL = _("Percent")
@ -269,7 +272,10 @@ class MainFrame(wx.Frame):
else:
self._create_popup(self.DL_COMPLETED_MSG, self.INFO_LABEL, wx.OK | wx.ICON_INFORMATION)
if self.opt_manager.options['open_dl_dir']:
open_dir(self.opt_manager.options['save_path'])
success = open_dir(self.opt_manager.options['save_path'])
if not success:
self._status_bar_write(self.OPEN_DIR_ERR.format(dir=self.opt_manager.options['save_path']))
def _status_list_handler(self, msg):
"""downloadmanager.Worker thread handler.

7
youtube_dl_gui/utils.py

@ -46,14 +46,19 @@ def get_lib_path():
def open_dir(path):
"""Open path using default file navigator. """
"""Open path using default file navigator.
Return True if path exists else False. """
path = remove_shortcuts(path)
if not os.path.exists(path):
return False
if os.name == 'nt':
os.startfile(path)
else:
subprocess.call(('xdg-open', path))
return True
def check_path(path):
"""Create path if not exist. """

Loading…
Cancel
Save