Util: Improve Windows support in find_command()
[gpodder.git] / src / gpodder / gtkui / win32.py
blob80a15199b3edeec4984bc2d64e62f3b33e8ed29f
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
5 # gPodder - A media aggregator and podcast client
6 # Copyright (c) 2005-2011 Thomas Perl and the gPodder Team
8 # gPodder is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # gPodder is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 """Win32 Launcher script for gPodder
24 This is only used for the Win32 version of gPodder
25 and will set up the environment to find all files
26 and then start up the gPodder GUI.
28 Thomas Perl <thp@gpodder.org>; 2009-05-09
29 """
31 import sys
32 import os
33 import os.path
35 import gettext
37 if __name__ == '__main__':
38 prefix = os.path.abspath(os.path.normpath('.'))
39 data_dir = os.path.join(prefix, 'data')
41 locale_dir = os.path.join(data_dir, 'locale')
42 ui_folder = os.path.join(data_dir, 'ui')
43 credits_file = os.path.join(data_dir, 'credits.txt')
44 images_folder = os.path.join(data_dir, 'images')
45 icon_file = os.path.join(data_dir, 'gpodder.png')
47 # Set up the path to translation files
48 gettext.bindtextdomain('gpodder', locale_dir)
50 import gpodder
52 if not gpodder.win32:
53 print >>sys.stderr, 'This launcher is only for Win32.'
54 sys.exit(1)
56 # Enable i18n for gPodder translations
57 _ = gpodder.gettext
59 # Set up paths to folder with GtkBuilder files and gpodder.svg
60 gpodder.ui_folders.append(ui_folder)
61 gpodder.ui_folders.append(os.path.join(ui_folder, 'desktop'))
62 gpodder.icon_file = icon_file
63 gpodder.credits_file = credits_file
64 gpodder.images_folder = images_folder
65 gpodder.ui.desktop = True
67 home = os.path.join(os.getcwd())
68 if not os.path.exists(home):
69 os.mkdir(home)
70 gpodder.set_home(home)
72 from gpodder import gui
74 class options(object):
75 subscribe = None
77 gui.main(options)