2
# -*- coding: utf-8 -*-
5
# J Phani Mahesh <phanimahesh@gmail.com>
6
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
7
# Amith KK <amithkumaran@gmail.com>
8
# Georgi Karavasilev <motorslav@gmail.com>
9
# Sam Tran <samvtran@gmail.com>
10
# Sam Hewitt <hewittsamuel@gmail.com>
11
# Angel Araya <al.arayaq@gmail.com>
14
# A One-stop configuration tool for Unity.
18
# This file is a part of Unity Tweak Tool
20
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
21
# the terms of the GNU General Public License as published by the Free Software
22
# Foundation; version 3.
24
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
25
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
29
# You should have received a copy of the GNU General Public License along with
30
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
33
from gi.repository import Gio, Gdk,Gtk
34
import UnityTweakTool.config.data as data
36
def test_schema(schema):
37
if schema in Gio.Settings.list_relocatable_schemas():
39
elif schema in Gio.Settings.list_schemas():
42
print("Error: schema %s not installed" % schema)
44
builder.set_translation_domain('unity-tweak-tool')
45
ui = os.path.join(data.get_data_path(),'errordialog.ui')
46
builder.add_from_file(ui)
47
dialog = builder.get_object('errordialog')
48
message = schema + "\n\nIn order to work properly, Unity Tweak Tool recommends you install the necessary packages"
49
dialog.format_secondary_text(message)
53
def test_key(schema, key):
54
if key in schema.list_keys():
60
schema = 'org.compiz.'+plugin
61
path = '/org/compiz/profiles/unity/plugins/'+plugin+'/'
63
return Gio.Settings(schema = schema, path = path)
65
def unity(child = None):
66
schema = 'com.canonical.Unity'
67
schema = schema+'.'+child if child else schema
69
return Gio.Settings(schema)
71
def unity_webapps(child = None):
72
schema = 'com.canonical.unity'
73
schema = schema+'.'+child if child else schema
75
return Gio.Settings(schema)
78
schema = 'com.canonical.'+child
80
return Gio.Settings(schema)
83
schema = 'org.compiz.'+child
85
return Gio.Settings(schema)
88
schema = 'org.gnome.'+child
90
return Gio.Settings(schema)
92
def color_to_hash(c,alpha=1):
93
"""Convert a Gdk.Color or Gdk.RGBA object to hex representation, overriding the alpha if asked"""
94
if isinstance(c, Gdk.Color):
95
return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red_float, c.green_float, c.blue_float,alpha]])
96
if isinstance(x, Gdk.RGBA):
97
return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red, c.green, c.blue, alpha]])
98
# If it is neither a Gdk.Color object nor a Gdk.RGBA object,
99
raise NotImplementedError
101
# GSettings objects go here
103
# Sorted by function type and alphabetical order
105
bluetooth = canonical('indicator.bluetooth')
106
datetime = canonical('indicator.datetime')
107
hud = canonical('indicator.appmenu.hud')
108
power = canonical('indicator.power')
109
notifyosd = canonical('notify-osd')
110
scrollbars= canonical('desktop.interface')
111
session = canonical('indicator.session')
112
sound = canonical('indicator.sound')
114
antialiasing = gnome('settings-daemon.plugins.xsettings')
115
background = gnome('desktop.background')
116
desktop = gnome('nautilus.desktop')
117
interface = gnome('desktop.interface')
118
lockdown = gnome('desktop.lockdown')
119
wm = gnome('desktop.wm.preferences')
120
touch = gnome('settings-daemon.peripherals.touchpad')
122
animation = plugin('animation')
123
core = plugin('core')
124
expo = plugin('expo')
125
grid = plugin('grid')
126
move = plugin('move')
127
opengl = plugin('opengl')
128
resize = plugin('resize')
129
scale = plugin('scale')
130
unityshell = plugin('unityshell')
131
zoom = plugin('ezoom')
133
launcher = unity('Launcher')
134
lenses = unity('Lenses')
135
lens_apps = unity('ApplicationsLens')
136
lens_files = unity('FilesLens')
137
runner = unity('Runner')
138
webapps = unity_webapps('webapps')