~ubuntu-branches/ubuntu/saucy/unity-tweak-tool/saucy-proposed

« back to all changes in this revision

Viewing changes to UnityTweakTool/section/sphagetti/gsettings.py

  • Committer: Package Import Robot
  • Author(s): Barneedhar Vigneshwar, J Phani Mahesh, Barneedhar Vigneshwar
  • Date: 2013-09-16 19:34:38 UTC
  • Revision ID: package-import@ubuntu.com-20130916193438-dw14bzxkohvxub2y
Tags: 0.0.5
[ J Phani Mahesh ]
* New upstream release (LP: #1226059)
  - New application icon 
  - Show error dialog when schemas are missing instead of crashing
  - Trigger new build of pot files
* UnityTweakTool/section/unity.py
  - Fix Show recently used and more suggestions in dash search (LP: #1166294)
  - Fix Launcher reveal sensitivity scale update issues (LP: #1168863)
* UnityTweakTool/elements/colorchooser.py
  - Fix TypeError in get_rgba() (LP: #1165627)
  - Fix segmentation fault on selecting custom launcher (LP: #1190398)
* UnityTweakTool/elements/option.py
  - Fix "Restore defaults" button (LP: #1186634)
* UnityTweakTool/__init__.py  
  - Fix unity-tweak-tool crashed with dbus.exceptions.DBusException in
  call_blocking() (LP: #1168738)
  - Fix FileNotFoundError (LP: #1225463)
  - Fix dbus.exceptions.DBusException (LP: #1170571)
* data/unity.ui
  - Remove Panel transparency switch (LP: #1168836)
  - Remove Launcher transparency switch (LP: #1168834)

[ Barneedhar Vigneshwar ]
* UnityTweakTool/section/unity.py
  - Fix 'Can't set background blur to static' (LP: #1167343)
  - Fix non-working Launcher only on primary desktop (LP: #1173977)
* UnityTweakTool/section/sphagetti/compiz.py
  - Fix TypeError in color_to_hash() (LP: #1166884)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python3
2
 
# -*- coding: utf-8 -*-
3
 
#
4
 
# Team:
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>
12
 
#
13
 
# Description:
14
 
#   A One-stop configuration tool for Unity.
15
 
#
16
 
# Legal Stuff:
17
 
#
18
 
# This file is a part of Unity Tweak Tool
19
 
#
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.
23
 
#
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
27
 
# details.
28
 
#
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>
31
 
 
32
 
from gi.repository import Gio,  Gdk
33
 
 
34
 
def test_schema(schema):
35
 
    if schema in Gio.Settings.list_relocatable_schemas():
36
 
        pass
37
 
    elif schema in Gio.Settings.list_schemas():
38
 
        pass
39
 
    else:
40
 
        raise Exception("Schema %s not installed" % schema)
41
 
 
42
 
def test_key(schema, key):
43
 
    if key in schema.list_keys():
44
 
        return True
45
 
    else:
46
 
        return False
47
 
 
48
 
def plugin(plugin):
49
 
    schema = 'org.compiz.'+plugin
50
 
    path = '/org/compiz/profiles/unity/plugins/'+plugin+'/'
51
 
    try:
52
 
        test_schema(schema)
53
 
        return Gio.Settings(schema = schema,  path = path)
54
 
    except Exception:
55
 
        print("schema %s not installed" % schema)
56
 
 
57
 
def unity(child = None):
58
 
    schema = 'com.canonical.Unity'
59
 
    schema = schema+'.'+child if child else schema
60
 
    try:
61
 
        test_schema(schema)
62
 
        return Gio.Settings(schema)
63
 
    except Exception:
64
 
        print("schema %s not installed" % schema)
65
 
 
66
 
def unity_webapps(child = None):
67
 
    schema = 'com.canonical.unity'
68
 
    schema = schema+'.'+child if child else schema
69
 
    try:
70
 
        test_schema(schema)
71
 
        return Gio.Settings(schema)
72
 
    except Exception:
73
 
        print("schema %s not installed" % schema)
74
 
 
75
 
def canonical(child):
76
 
    schema = 'com.canonical.'+child
77
 
    try:
78
 
        test_schema(schema)
79
 
        return Gio.Settings(schema)
80
 
    except Exception:
81
 
        print("schema %s not installed"% schema)
82
 
 
83
 
def compiz(child):
84
 
    schema = 'org.compiz.'+child
85
 
    try:
86
 
        test_schema(schema)
87
 
        return Gio.Settings(schema)
88
 
    except Exception:
89
 
        print("schema %s not installed" % schema)
90
 
 
91
 
def gnome(child):
92
 
    schema = 'org.gnome.'+child
93
 
    try:
94
 
        test_schema(schema)
95
 
        return Gio.Settings(schema)
96
 
    except Exception:
97
 
        print("schema %s not installed" % schema)
98
 
 
99
 
def color_to_hash(c,alpha=1):
100
 
    """Convert a Gdk.Color or Gdk.RGBA object to hex representation, overriding the alpha if asked"""
101
 
    if isinstance(c, Gdk.Color):
102
 
        return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red_float, c.green_float, c.blue_float,alpha]])
103
 
    if isinstance(x, Gdk.RGBA):
104
 
        return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red, c.green, c.blue, alpha]])
105
 
    # If it is neither a Gdk.Color object nor a Gdk.RGBA object,
106
 
    raise NotImplementedError
107
 
 
108
 
# GSettings objects go here
109
 
 
110
 
# Sorted by function type and alphabetical order
111
 
 
112
 
bluetooth = canonical('indicator.bluetooth')
113
 
datetime = canonical('indicator.datetime')
114
 
hud = canonical('indicator.appmenu.hud')
115
 
power = canonical('indicator.power')
116
 
notifyosd = canonical('notify-osd')
117
 
scrollbars= canonical('desktop.interface')
118
 
session = canonical('indicator.session')
119
 
sound = canonical('indicator.sound')
120
 
 
121
 
antialiasing = gnome('settings-daemon.plugins.xsettings')
122
 
background = gnome('desktop.background')
123
 
desktop = gnome('nautilus.desktop')
124
 
interface = gnome('desktop.interface')
125
 
lockdown = gnome('desktop.lockdown')
126
 
wm = gnome('desktop.wm.preferences')
127
 
touch = gnome('settings-daemon.peripherals.touchpad')
128
 
 
129
 
animation = plugin('animation')
130
 
core = plugin('core')
131
 
expo = plugin('expo')
132
 
grid = plugin('grid')
133
 
move = plugin('move')
134
 
opengl = plugin('opengl')
135
 
resize = plugin('resize')
136
 
scale = plugin('scale')
137
 
unityshell = plugin('unityshell')
138
 
zoom = plugin('ezoom')
139
 
 
140
 
launcher = unity('Launcher')
141
 
lenses = unity('Lenses')
142
 
lens_apps = unity('ApplicationsLens')
143
 
lens_files = unity('FilesLens')
144
 
runner = unity('Runner')
145
 
webapps = unity_webapps('webapps')