From e726538d982f8b927350d44fdc40839b398fb3e4 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Mon, 31 Mar 2014 15:15:49 +0300 Subject: [PATCH] Fixed icon path problem --- youtube_dl_gui/Utils.py | 9 +++++++++ youtube_dl_gui/YoutubeDLGUI.py | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index 58aa488..56d31f1 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -70,3 +70,12 @@ def get_filesize(path): def makedir(path): os.makedirs(path) +def get_icon_path(icon_path, file_path): + path = os.path.abspath(file_path) + path = path.split(get_path_seperator()) + for i in range(len(icon_path)): + path[(i+1)*-1] = icon_path[i] + path = get_path_seperator().join(path) + return path + + \ No newline at end of file diff --git a/youtube_dl_gui/YoutubeDLGUI.py b/youtube_dl_gui/YoutubeDLGUI.py index 6d7ebe5..6a267cc 100644 --- a/youtube_dl_gui/YoutubeDLGUI.py +++ b/youtube_dl_gui/YoutubeDLGUI.py @@ -34,7 +34,8 @@ from .Utils import ( get_os_type, file_exist, fix_path, - get_abs_path + get_abs_path, + get_icon_path ) if get_os_type() == 'nt': @@ -69,7 +70,9 @@ LANGUAGES = ["English", "Russian", "Spanish", "German"] - + +ICON = get_icon_path(['ytube.png', 'icons'], __file__) + class MainFrame(wx.Frame): def __init__(self, parent=None, id=-1): @@ -98,7 +101,7 @@ class MainFrame(wx.Frame): self.Bind(wx.EVT_CLOSE, self.OnClose) # set app icon - icon = wx.Icon('../icons/ytube.png', wx.BITMAP_TYPE_ICO) + icon = wx.Icon(ICON, wx.BITMAP_TYPE_ICO) self.SetIcon(icon) # set publisher for update thread @@ -734,7 +737,7 @@ For more information, please refer to ''' info = wx.AboutDialogInfo() - info.SetIcon(wx.Icon('../icons/ytube.png', wx.BITMAP_TYPE_ICO)) + info.SetIcon(wx.Icon(ICON, wx.BITMAP_TYPE_ICO)) info.SetName(TITLE) info.SetVersion(__version__) info.SetDescription(description)