timetrack.in 1.26 KB
Newer Older
Daniel Garcia Moreno's avatar
Daniel Garcia Moreno committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#!@PYTHON@

import sys
import os
import locale
import gettext

sys.path.insert(1, '@PYTHON_EXEC_DIR@')
sys.path.insert(1, '@PYTHON_DIR@')

from gi.repository import Gio

localedir = '@LOCALE_DIR@'
pkgdatadir = '@DATA_DIR@'
extensiondir = '@EXTENSION_DIR@'

from timetrack.application import Application

def install_excepthook():
    """ Make sure we exit when an unhandled exception occurs. """
    from gi.repository import Gtk
    old_hook = sys.excepthook

    def new_hook(etype, evalue, etb):
        old_hook(etype, evalue, etb)
        while Gtk.main_level():
            Gtk.main_quit()
        sys.exit()
    sys.excepthook = new_hook

if __name__ == "__main__":
    install_excepthook()

    locale.bindtextdomain('timetrack', localedir)
    locale.textdomain('timetrack')
    gettext.bindtextdomain('timetrack', localedir)
    gettext.textdomain('timetrack')

    resource = Gio.resource_load(os.path.join(pkgdatadir, 'timetrack.gresource'))
    Gio.Resource._register(resource)

    if @PROFILE@ == 'Devel':
        Application.development_mode = True
44
        Application.application_id = 'net.danigm.timetrackDevel'
Daniel Garcia Moreno's avatar
Daniel Garcia Moreno committed
45 46 47
    else:
        Application.development_mode = False

48
    app = Application(localedir=localedir)
Daniel Garcia Moreno's avatar
Daniel Garcia Moreno committed
49 50 51

    exit_status = app.run(sys.argv)
    sys.exit(exit_status)