Maemo 5: Settings dialog (no close button, has parent)
[panucci.git] / bin / panucci
bloba060af05b9091575ddda4cc47272ba6ed8d655df
1 #!/usr/bin/env python
3 # This file is part of Panucci.
4 # Copyright (c) 2008-2011 The Panucci Project
6 # Panucci is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Panucci is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Panucci. If not, see <http://www.gnu.org/licenses/>.
19 from __future__ import absolute_import
21 import os.path
22 import sys
23 from optparse import OptionParser
25 # Set up gettext support
26 import locale
27 import gettext
29 prefix = os.path.join( os.path.dirname(sys.argv[0]), '..' )
31 for basedir in 'share', 'data':
32 locale_dir = os.path.abspath(os.path.join( prefix, basedir, 'locale' ))
33 if os.path.exists( locale_dir ):
34 break
36 locale_dir = os.environ.get('LOCALE_DIR', locale_dir)
37 gettext.install( 'panucci', locale_dir )
39 # Set up the command line option parser
40 usage = 'usage: %prog [options] FILE'
41 parser = OptionParser(usage=usage)
42 parser.add_option('-q', '--queue', action='store', type='string',
43 dest='queue_filename', help='Add FILE to the queue', metavar='FILE')
44 parser.add_option('-d', '--debug', action='store_true', default=False,
45 dest='debug', help='Enable verbose logging')
46 parser.add_option("--gtk", action="store_true")
47 parser.add_option("--qt", action="store_true")
48 opts, args = parser.parse_args()
50 if len(args) > 1 or ( opts.queue_filename and len(args) ):
51 parser.print_help()
52 sys.exit(1)
54 # add src/ to the PYTHONPATH
55 local_module_dir = os.path.join(os.path.dirname(sys.argv[0]), '..', 'src')
56 if os.path.isdir(local_module_dir):
57 sys.path.insert(0, local_module_dir)
59 optified_install_path = '/opt/panucci/lib/'
60 if os.path.isdir(optified_install_path):
61 sys.path.append(optified_install_path)
63 from panucci import main
64 main.run(opts, args)