forked from nzjrs/gnome-tweak-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnome-tweak-tool
executable file
·82 lines (70 loc) · 2.97 KB
/
gnome-tweak-tool
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
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# 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/>.
import os.path
import optparse
import logging
import locale
import gettext
import sys
import gi
gi.require_version("Gtk", "3.0")
import gtweak
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option("-t", "--test", action="store_true",
help="Enable test and debug code")
parser.add_option("-l", "--load", action="store_true",
help="Load all tweaks")
parser.add_option("-p", "--prefix",
help="Installation prefix (for gsettings schema, themes, etc)", metavar="[/, /usr]")
parser.add_option("-v", "--verbose", action="store_true",
help="Print the names of settings modified")
parser.add_option("-d", "--debug", action="store_true",
help="Enable debug output")
options, args = parser.parse_args()
try:
from gtweak.defs import GSETTINGS_SCHEMA_DIR, TWEAK_DIR, DATA_DIR, PKG_DATA_DIR, LOCALE_DIR
_defs_present = True
except ImportError:
GSETTINGS_SCHEMA_DIR = TWEAK_DIR = DATA_DIR = PKG_DATA_DIR = LOCALE_DIR = ""
_defs_present = False
#the supplied prefix always beats the contents of defs
if options.prefix or not _defs_present:
_prefix = options.prefix or "/usr"
DATA_DIR = os.path.join(_prefix, "share")
LOCALE_DIR = os.path.join(_prefix, "share", "locale")
GSETTINGS_SCHEMA_DIR = os.path.join(_prefix, "share", "glib-2.0", "schemas")
_me = os.path.abspath(os.path.dirname(__file__))
TWEAK_DIR = os.path.join(_me, "gtweak", "tweaks")
PKG_DATA_DIR = os.path.join(_me, "data")
gtweak.GSETTINGS_SCHEMA_DIR = GSETTINGS_SCHEMA_DIR
gtweak.TWEAK_DIR = TWEAK_DIR
gtweak.DATA_DIR = DATA_DIR
gtweak.PKG_DATA_DIR = PKG_DATA_DIR
gtweak.LOCALE_DIR = LOCALE_DIR
gtweak.ENABLE_TEST = options.test
gtweak.ALL_TWEAKS = options.load
gtweak.APP_NAME = "gnome-tweak-tool"
gtweak.VERBOSE = options.verbose
if options.debug:
level=logging.DEBUG
else:
level=logging.INFO
logging.basicConfig(format="%(levelname)-8s: %(message)s", level=level)
locale.setlocale(locale.LC_ALL, None)
gettext.install(gtweak.APP_NAME, LOCALE_DIR, names=('gettext', 'ngettext'))
from gtweak.app import GnomeTweakTool
app = GnomeTweakTool()
exit_status = app.run(None)
sys.exit(exit_status)