~jibel/update-manager/AutoUpgradeTester-desktoptests

« back to all changes in this revision

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

  • Committer: Michael Vogt
  • Date: 2012-01-10 10:13:39 UTC
  • Revision ID: michael.vogt@ubuntu.com-20120110101339-tjsuah03oxmzrh32
* pyflake fixes, remove some dead code
* DistUpgrade/DistUpgradeController.py
  - call apport-cli directly for bug reporting of errors

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