#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE

import sys
import os
import gtk
import logging

# Check if we are working in the source tree or from the installed 
# package and mangle the python path accordingly
if os.path.dirname(sys.argv[0]) != ".":
    if sys.argv[0][0] == "/":
        fullPath = os.path.dirname(sys.argv[0])
    else:
        fullPath = os.getcwd() + "/" + os.path.dirname(sys.argv[0])
else:
    fullPath = os.getcwd()
sys.path.insert(0, os.path.dirname(fullPath))

from earcandy.earcandyconfig import getdatapath
from earcandy.EarCandy import EarCandy

if __name__ == "__main__":

    #run the application
    logging.basicConfig(level=logging.INFO)
    
    gtk.window_set_default_icon_from_file(os.path.join(getdatapath(), 'media', 'icon.png'))

    # Turn on gtk threading
    gtk.gdk.threads_init()

    ec = EarCandy()
    ec.run()

    gtk.main()
