~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to DistUpgrade/theme-switch-helper.py

  • Committer: Michael Vogt
  • Date: 2008-11-14 19:03:53 UTC
  • Revision ID: michael.vogt@ubuntu.com-20081114190353-tnrwn4pvarb9gxyb
* debian/rules 
  - remove the arch-build target
* DistUpgrade/DistUpgradeController.py:
  - improvements to the sources.list rewriting, better tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
#
 
3
# This is a helper for the ReleaseUpgrader. it will need to be called
 
4
# like this:
 
5
# os.system("sudo -u %s theme-switch-helper.py", os.environ["SUDO_USER"])
 
6
# to make sure that it is run in the users session
 
7
 
8
 
 
9
import gconf
 
10
import subprocess
 
11
from optparse import OptionParser
 
12
 
 
13
 
 
14
parser = OptionParser()
 
15
parser.add_option("-g", "--get", action="store_true", dest="get",
 
16
                  help="get the current gnome/gtk theme settings")
 
17
parser.add_option("-s", "--set", dest="set", 
 
18
                  help="set the current gnome/gtk theme settings")
 
19
parser.add_option("-d", "--defaults", dest="defaults", action="store_true",
 
20
                  help="set gtk/gnome settings to save defaults")
 
21
(options, args) = parser.parse_args()
 
22
 
 
23
client = gconf.client_get_default()
 
24
 
 
25
if options.get:
 
26
    # get current settings
 
27
    gtk_theme = client.get_string("/desktop/gnome/interface/gtk_theme")
 
28
    icon_theme = client.get_string("/desktop/gnome/interface/icon_theme")
 
29
    metacity_theme = client.get_string("/apps/metacity/general/theme")
 
30
    print gtk_theme
 
31
    print icon_theme
 
32
    print metacity_theme
 
33
 
 
34
if options.defaults:
 
35
    # set to save defaults
 
36
    client.set_string("/desktop/gnome/interface/gtk_theme","Human")
 
37
    client.set_string("/desktop/gnome/interface/icon_theme","Human")
 
38
    client.set_string("/apps/metacity/general/theme","Human")
 
39
 
 
40
if options.set:
 
41
    (gtk_theme, icon_theme, metacity_theme) = open(options.set).read().strip().split("\n")
 
42
    print gtk_theme
 
43
    print icon_theme
 
44
    print metacity_theme
 
45
    client.set_string("/desktop/gnome/interface/gtk_theme", gtk_theme)
 
46
    client.set_string("/desktop/gnome/interface/icon_theme", icon_theme)
 
47
    client.set_string("/apps/metacity/general/theme", metacity_theme)
 
48
    
 
49