#!/usr/bin/env python
# -*- coding: UTF8 -*-

# This file is part of PySms.
#
# PySms - A text messenger for various swiss providers
# Copyright (C) 2007 Andreas Maechler <amaechler@gmx.ch>
#
# PySms is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# PySms is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


"""pySms text messenger"""

# PLEASE DO NOT CHANGE FORMAT OF __version__ LINE (setup.py reads this)

__author__    = "Andreas Maechler <amaechler@gmx.ch>"
__version__   = "0.9.4"
__date__      = "2007-08-08"
__copyright__ = "Copyright (c) 2005-2007 %s. All rights reserved." % __author__
__licence__   = "GPL 2"

import sys,os
from optparse import OptionParser

import locale
import gettext

# gettext variables
APP = 'pySms'
DIR = '/usr/share/locale/'

def main(argv=None):
    # gettext.bindtextdomain( APP, DIR )
    gettext.textdomain( APP )
    gettext.install( APP )
    
    if argv is None:
        argv = sys.argv

    parser = OptionParser(usage="usage: %%prog [options] arg1 arg2\n\n%s" %__doc__,
                          version = "%%prog %s %s" %(__version__, __date__))

    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False,
                      help=_("Be more verbose"))

    parser.add_option("--debug",
                      action="store_true", dest="debug", default=False,
                      help=_("Run local version in current directory"))
    

    (options, args) = parser.parse_args(argv)

    if options.verbose:
        print "Options: " + str(options)
        print "Args: " + str(args)

    if options.debug:
        sys.path = ['./src/','../src/'] + sys.path

    # Default run GUI
    from pysms import pysms
    import gtk.glade
        
    if options.debug:
    	pysms.glade_dir = './data'
        pysms.icon_dir  = './data/pysms_icon.png'
            
    pysms.main( __version__ )


if __name__ == "__main__":
    sys.exit(main())

