l10n: Updated Greek (el) translation to 20%
[gpodder.git] / src / gpodder / launcher.py
blob012649a57712dd69ffec901eb4d8e1334fe26a38
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
5 # gPodder - A media aggregator and podcast client
6 # Copyright (c) 2005-2010 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 <thpinfo.com>; 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.svg')
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 # Portable version support
68 if (os.path.exists('downloads') and os.path.exists('config')) or \
69 not os.path.exists(os.path.expanduser('~/.config/gpodder')):
70 home = os.path.join(os.getcwd(), 'config')
71 if not os.path.exists(home):
72 os.mkdir(home)
73 gpodder.home = home
74 gpodder.subscription_file = os.path.join(home, 'channels.opml')
75 gpodder.config_file = os.path.join(home, 'gpodder.conf')
76 gpodder.database_file = os.path.join(home, 'database.sqlite')
77 download_dir = os.path.join(os.getcwd(), 'downloads')
78 os.environ['GPODDER_DOWNLOAD_DIR'] = download_dir
80 from gpodder import gui
82 class options(object):
83 subscribe = None
85 gui.main(options)