forked from bilelmoussaoui/Icon-Requests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icon-requests.in
64 lines (56 loc) · 1.83 KB
/
icon-requests.in
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import signal
import locale
import gettext
import argparse
import faulthandler
import sys
from os import path
from gi import require_version
require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio
sys.path.insert(1, '@pyexecdir@')
sys.path.insert(1, '@pythondir@')
# Load the gresource file first.
resource = Gio.resource_load(path.join('@DATADIR@',
'icon-requests.gresource'))
Gio.Resource._register(resource)
from IconRequests.application import Application
_ = gettext.gettext
locale.bindtextdomain('icon-requests', "@localedir@")
locale.textdomain('icon-requests')
gettext.bindtextdomain('icon-requests', "@localedir@")
gettext.textdomain('icon-requests')
parser = argparse.ArgumentParser(prog="Icon Requests")
parser.add_argument("--debug", "-d", action="store_true",
help=_("Start in debug mode"))
parser.add_argument("--version", "-v", action="store_true",
help=_("Icon Requests version number"))
parser.add_argument("--about", action="store_true",
help=_("Show about dialog"))
args = parser.parse_args()
level = logging.ERROR
if args.debug:
level = logging.DEBUG
faulthandler.enable()
logging.basicConfig(level=level,
format='[%(levelname)s] - %(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
if args.version:
sys.exit("Version : @VERSION@")
elif args.about:
about_dialog = Application.about_dialog()
about_dialog.run()
about_dialog.destroy()
sys.exit()
else:
app = Application()
try:
exit_status = app.run(None)
signal.signal(signal.SIGTERM, app.on_quit)
signal.signal(signal.SIGINT, app.on_quit)
sys.exit(exit_status)
except KeyboardInterrupt:
app.on_quit()