~lidaobing/ubuntu-tweak/ubuntu-ubuntu-tweak

« back to all changes in this revision

Viewing changes to ubuntutweak/modules/compiz.py

  • Committer: LI Daobing
  • Date: 2010-07-31 10:10:26 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: lidaobing@gmail.com-20100731101026-9o3m59258q5perbo
Tags: upstream-0.5.5
ImportĀ upstreamĀ versionĀ 0.5.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
 
# Ubuntu Tweak - PyGTK based desktop configure tool
 
3
# Ubuntu Tweak - PyGTK based desktop configuration tool
4
4
#
5
5
# Copyright (C) 2007-2008 TualatriX <tualatrix@gmail.com>
6
6
#
31
31
from ubuntutweak.widgets.dialogs import InfoDialog
32
32
from ubuntutweak.common.systeminfo import module_check
33
33
try:
34
 
    from ubuntutweak.common.package import package_worker, AptCheckButton
 
34
    from ubuntutweak.common.package import PACKAGE_WORKER, AptCheckButton
35
35
except:
36
36
    pass
37
37
 
46
46
 
47
47
plugins = \
48
48
{
49
 
    'expo': _('Expo'),
 
49
    'expo': _('Show Workspaces'),
50
50
    'scale': _('Show Windows'),
51
51
    'core': _('Show Desktop'),
52
 
    'widget': _('Widget'),
 
52
    'widget': _('Show Widgets'),
53
53
}
54
54
 
55
55
plugins_settings = \
105
105
    def __init__(self, label):
106
106
        gtk.CheckButton.__init__(self, label)
107
107
 
108
 
        if ccm.Version > '0.7.6':
109
 
            self.plugin = self.get_plugin('obs')
110
 
        else:
111
 
            self.plugin = self.get_plugin('core')
 
108
        self.plugin = self.get_plugin('obs')
 
109
 
112
110
        if not self.plugin.Enabled:
113
111
            self.plugin.Enabled = 1
114
112
            self.context.Write()
220
218
 
221
219
class Compiz(TweakModule, CompizSetting):
222
220
    __title__ = _('Compiz Settings')
223
 
    __desc__ = _('Setting with your amazing eye-candy desktop')
 
221
    __desc__ = _('Settings for some amazing desktop eye-candy')
224
222
    __icon__ = ['compiz', 'wmtweaks']
225
223
    __category__ = 'desktop'
 
224
    __desktop__ = 'gnome'
226
225
 
227
226
    def __init__(self):
228
227
        TweakModule.__init__(self)
230
229
        self.create_interface()
231
230
 
232
231
    def create_interface(self):
233
 
        if module_check.has_apt() and package_worker.get_cache():
234
 
            self.package_worker = package_worker
 
232
        if module_check.has_apt() and PACKAGE_WORKER.get_cache():
 
233
            self.PACKAGE_WORKER = PACKAGE_WORKER
235
234
 
236
235
            self.advanced_settings = AptCheckButton(_("Install Advanced Desktop Effects Settings Manager"),
237
236
                    'compizconfig-settings-manager')
238
237
            self.advanced_settings.connect('toggled', self.colleague_changed)
239
 
            self.simple_settings = AptCheckButton(_("Install Simple Desktop Effects Settings manager"),
 
238
            self.simple_settings = AptCheckButton(_("Install Simple Desktop Effects Settings Manager"),
240
239
                    'simple-ccsm')
241
240
            self.simple_settings.connect('toggled', self.colleague_changed)
242
241
            self.screenlets = AptCheckButton(_("Install Screenlets Widget Application"),
246
245
        if self.context:
247
246
            hbox = gtk.HBox(False, 0)
248
247
            hbox.pack_start(self.create_edge_setting(), True, False, 0)
249
 
            edge_setting = SinglePack(_('Edge Settings'), hbox)
 
248
            edge_setting = SinglePack(_(' Workspace Edge Settings'), hbox)
250
249
            self.add_start(edge_setting, False, False, 0)
251
250
 
252
251
            self.snap = SnapWindow(_("Enable snapping windows"), self)
261
260
            box = ListPack(_("Menu Effects"), (button1, self.wobbly_m))
262
261
            self.add_start(box, False, False, 0)
263
262
 
264
 
            if module_check.has_apt() and package_worker.get_cache():
 
263
            if module_check.has_apt() and PACKAGE_WORKER.get_cache():
265
264
                box = ListPack(_("Useful Extensions"), (
266
265
                    self.simple_settings,
267
266
                    self.screenlets,
318
317
            widget.previous = None
319
318
        else:
320
319
            plugin = self.context.Plugins[text]
 
320
            if not plugin.Enabled:
 
321
                plugin.Enabled = True
 
322
                self.context.Write()
321
323
            setting = plugin.Display[plugins_settings[text]]
322
324
            setting.Value = edge
323
325
            self.context.Write()
334
336
            if self.context.Plugins.has_key(k):
335
337
                plugin = self.context.Plugins[k]
336
338
                combobox.append_text(plugins[k])
337
 
                if not plugin.Enabled:
338
 
                    plugin.Enabled = True
339
 
                    self.context.Write()
340
339
                setting = plugin.Display[v]
341
340
                if setting.Value == edge:
342
341
                    combobox.previous = k
369
368
        client = gconf.client_get_default()
370
369
        wallpaper = client.get_string("/desktop/gnome/background/picture_filename")
371
370
 
372
 
        system_wallpaper = os.path.join(DATA_DIR, "pixmaps/ubuntu-tweak.png")
 
371
        system_wallpaper = os.path.join(DATA_DIR, "pixmaps/splash.png")
373
372
        if wallpaper:
374
373
            try:
375
374
                pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(wallpaper, 160, 100)
401
400
            else:
402
401
                to_rm.append(widget.pkgname)
403
402
 
404
 
        self.package_worker.perform_action(widget.get_toplevel(), to_add, to_rm)
405
 
        self.package_worker.update_apt_cache(True)
 
403
        self.PACKAGE_WORKER.perform_action(widget.get_toplevel(), to_add, to_rm)
 
404
        self.PACKAGE_WORKER.update_apt_cache(True)
406
405
 
407
 
        done = package_worker.get_install_status(to_add, to_rm)
 
406
        done = PACKAGE_WORKER.get_install_status(to_add, to_rm)
408
407
 
409
408
        if done:
410
409
            self.button.set_sensitive(False)