passwordsafe.in 1.25 KB
Newer Older
1 2 3 4 5
#!@PYTHON@

import sys
import os
import locale
6
import gettext
7 8 9 10 11 12 13 14 15 16

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@'

17
from passwordsafe.application import Application
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

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()

34 35 36 37 38
    locale.bindtextdomain('passwordsafe', localedir)
    locale.textdomain('passwordsafe')
    gettext.bindtextdomain('passwordsafe', localedir)
    gettext.textdomain('passwordsafe')

39
    resource = Gio.resource_load(os.path.join(pkgdatadir, 'passwordsafe.gresource'))
40 41
    Gio.Resource._register(resource)

42 43 44 45 46
    if @PROFILE@ == 'Devel':
    	Application.development_mode = True
    	Application.application_id = 'org.gnome.PasswordSafeDevel'
    else:
    	Application.development_mode = False
47

48 49
    app = Application()

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