#!/usr/bin/python
#-*- coding: utf-8 -*-
# memaker.py - A gtk based avatar creation program.
# Copyright 2008 The MeMaker Project
#
# This program 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.
#
# This program 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. See the file LICENSE.
# If not, see <http://www.gnu.org/licenses/>.


import pygtk
pygtk.require ("2.0")

import gettext
import logging
import sys
import os

from MeMaker.version import *
from optparse import OptionParser

if __name__ == "__main__":

    parser = OptionParser("usage: %prog [options] theme-to-open", 
                          version="%prog "+VERSION)
    parser.add_option("--debug", dest="debug", action="store_true",
                      help="enable debug mode", default=False)
    (options, args) = parser.parse_args()

    theme_name = None
    if args:
        theme_name = args[0]

    if options.debug:
        logging.basicConfig(level=logging.DEBUG)
    else:
        logging.basicConfig(level=logging.INFO)

    if os.path.exists("./data/ui/memaker.ui"):
        logging.info("Using data from current dir")
        datadir = "./data"
    else:
        datadir = "/usr/share/memaker/"
    
    from MeMaker.app import MeMakerApp
    
    app = MeMakerApp(datadir, theme_name)
    app.run()
