blob: 41494c7bfc68fc6165ab7ec34cf6bf7f5b0be66d (
plain)
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
65
66
67
68
69
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018 Martin Owens <doctormo@gmail.com>
#
# 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. If not, see <http://www.gnu.org/licenses/>
#
"""
Inkscape Extensions Manager, Graphical User Interface (Gtk3)
"""
import os
import sys
import logging
import warnings
warnings.filterwarnings("ignore")
from inkex import gui
from argparse import ArgumentParser
def run(args):
# Late imports to catch import errors.
from inkman.targets import TARGETS
from inkman.gui import ManagerApp
from inkman.utils import get_inkscape_version
arg_parser = ArgumentParser(description=__doc__)
arg_parser.add_argument("input_file", nargs="?")
arg_parser.add_argument(
"--target", default=TARGETS[0].category, choices=[t.category for t in TARGETS]
)
arg_parser.add_argument("--for-version", default=None)
options = arg_parser.parse_args(args)
version = options.for_version or get_inkscape_version()
try:
ManagerApp(
start_loop=True,
version=version,
target=[t for t in TARGETS if t.category == options.target][0],
)
except KeyboardInterrupt:
logging.error("User Interputed")
logging.debug("Exiting Application")
def recovery_run(args):
try:
run(args)
except Exception:
from inkman.backfoot import attempt_to_recover
attempt_to_recover()
if __name__ == "__main__":
recovery_run(sys.argv[1:])
|