From 27399e53213919279d904053fa3e60620e817ba2 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Wed, 30 Apr 2014 16:17:30 +0300 Subject: [PATCH] Fix icon path --- youtube_dl_gui/Utils.py | 20 +++++++++++--------- youtube_dl_gui/YoutubeDLGUI.py | 23 +++-------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index d617884..6b12cc6 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -48,21 +48,23 @@ def get_path_seperator(): def fix_path(path): if path != '' and path[-1:] != get_path_seperator(): path += get_path_seperator() - return path - -def get_HOME(): - return os.path.expanduser("~") - -def add_PATH(path): - os.environ["PATH"] += os.pathsep + path - -def abs_path(path): path_list = path.split(get_path_seperator()) for i in range(len(path_list)): if path_list[i] == '~': path_list[i] = get_HOME() return get_path_seperator().join(path_list) +def get_HOME(): + return os.path.expanduser("~") + +def add_PATH(path): + os.environ["PATH"] += os.pathsep + path + +def abs_path(filename): + path = os.path.abspath(filename).split(get_path_seperator()) + path.pop() + return get_path_seperator().join(path) + def file_exist(filename): return os.path.exists(filename) diff --git a/youtube_dl_gui/YoutubeDLGUI.py b/youtube_dl_gui/YoutubeDLGUI.py index 5895300..6b4461c 100644 --- a/youtube_dl_gui/YoutubeDLGUI.py +++ b/youtube_dl_gui/YoutubeDLGUI.py @@ -1,22 +1,5 @@ #! /usr/bin/env python -''' -This file contains all gui classes -MainFrame -Custom wx.ListCtrl class -OptionsFrame - GeneralPanel - AudioPanel - ConnectionPanel - VideoPanel - FilesystemPanel - SubtitlesPanel - OtherPanel - UpdatePanel - AuthenticationPanel - PlaylistPanel -''' - import wx from wx.lib.pubsub import setuparg1 from wx.lib.pubsub import pub as Publisher @@ -79,7 +62,7 @@ LANGUAGES = ["English", "Spanish", "German"] -ICON = 'icons/youtube-dl-gui.png' +ICON = fix_path(abs_path(__file__))+'icons/youtube-dl-gui.png' class MainFrame(wx.Frame): @@ -479,7 +462,7 @@ class UpdatePanel(wx.Panel): self.autoUpdateChk.SetValue(self.optList.autoUpdate) def save_options(self): - self.optList.updatePath = abs_path(self.updatePathBox.GetValue()) + self.optList.updatePath = fix_path(self.updatePathBox.GetValue()) self.optList.autoUpdate = self.autoUpdateChk.GetValue() class PlaylistPanel(wx.Panel): @@ -1145,7 +1128,7 @@ class GeneralPanel(wx.Panel): self.savePathBox.SetValue(self.optList.savePath) def save_options(self): - self.optList.savePath = abs_path(self.savePathBox.GetValue()) + self.optList.savePath = fix_path(self.savePathBox.GetValue()) class OtherPanel(wx.Panel):