# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Authors: Quinn Storm (quinn@beryl-project.org)
# Patrick Niklaus (marex@opencompositing.org)
# Copyright (C) 2007 Quinn Storm
def try_register_dbus ():
'''Return instance of dbus control object on success, None on failure'''
try:
import dbus, dbus.service
from dbus.mainloop.glib import DBusGMainLoop
except ImportError:
return
# rely on a reasonably new dbus-python
if dbus.version < (0, 80, 0):
return
class CCSMObject(dbus.service.Object):
main_window = None
李肇宁 于 2009-12-02 21:37:41发表:
我用的是新得利软件包,我装的是ubantu9.10
alick 于 2009-11-30 22:05:34发表:
你的是什么发行版,包管理机制是rpm还是deb。
rpm的话看来你需要安装compizconfig等软件包了
李肇宁 于 2009-11-30 19:02:12发表:
这个指令运行后就是leise@leise-laptop:~$ rpm -qa | grep compizconfig
leise@leise-laptop:~$
alick 于 2009-11-29 22:13:10发表:
这是我已经安装的有关compizconfig的软件包[code]$ rpm -qa | grep compizconfig
compizconfig-backend-gconf-0.7.8-1.fc10.x86_64
compizconfig-python-0.7.8-1.fc10.x86_64
libcompizconfig-0.7.8-1.fc10.x86_64
[/code]
李肇宁 于 2009-11-29 16:57:43发表:
没人理我阿。咳。。。。
李肇宁 于 2009-11-29 11:54:51发表:
这是ccsm的全部代码
李肇宁 于 2009-11-29 11:54:04发表:
[i=s] 本帖最后由 李肇宁 于 2009-11-29 11:56 编辑 [/i]
[code]#!/usr/bin/python
# -*- coding: UTF-8 -*-
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Authors: Quinn Storm (quinn@beryl-project.org)
# Patrick Niklaus (marex@opencompositing.org)
# Copyright (C) 2007 Quinn Storm
DBUS_CCSM_SERVICE = 'org.compiz_fusion.ccsm'
DBUS_CCSM_PATH = '/org/compiz_fusion/ccsm'
DBUS_CCSM_INTERFACE = 'org.compiz_fusion.ccsm'
# from the D-Bus specification
DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1
from optparse import OptionParser
import pygtk
pygtk.require('2.0')
import gtk
import sys
def try_register_dbus ():
'''Return instance of dbus control object on success, None on failure'''
try:
import dbus, dbus.service
from dbus.mainloop.glib import DBusGMainLoop
except ImportError:
return
# rely on a reasonably new dbus-python
if dbus.version < (0, 80, 0):
return
class CCSMObject(dbus.service.Object):
main_window = None
@dbus.service.method(DBUS_CCSM_INTERFACE, in_signature='s', out_signature='')
def present (self, startup_id):
if startup_id:
self.main_window.set_startup_id(startup_id)
else:
self.main_window.present()
DBusGMainLoop(set_as_default=True)
try:
bus = dbus.SessionBus()
except dbus.DBusException:
return
try:
obj = bus.get_object(DBUS_CCSM_SERVICE, DBUS_CCSM_PATH)
obj = dbus.Interface(obj, DBUS_CCSM_INTERFACE)
except dbus.DBusException:
# no ccsm instance running
if (bus.request_name(DBUS_CCSM_SERVICE)
== DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER):
return CCSMObject(bus, DBUS_CCSM_PATH)
else:
return
else:
try:
display = gtk.gdk.display_get_default()
startup_id = gtk.gdk.x11_display_get_startup_notification_id(display)
obj.present(startup_id or "")
print 'Another CCSM instance already running'
sys.exit(0)
except dbus.DBusException:
# error on present call so pretend it doesn't exist and start up normally
return
dbusObj = try_register_dbus()
try:
import sexy
has_sexy = True
except ImportError:
print "Info: No sexy-python package found, don't worry it's optional."
has_sexy = False
if gtk.pygtk_version < (2,12,0):
raise SystemExit("PyGtk 2.12.0 or later required")
import compizconfig
import ccm
from ccm.Utils import GlobalUpdater
from ccm.Constants import Version
plugin = None
category = None
parser = OptionParser()
parser.add_option("-p", "--plugin", dest = "plugin",
help = "Directly jump to the page of PLUGIN",
metavar = "PLUGIN")
parser.add_option("-c", "--category", dest = "category",
help = "Directly jump to CATEGORY",
metavar = "CATEGORY")
parser.add_option("-v", "--version", dest = "version",
action = "store_true",
help = "Version")
(options, args) = parser.parse_args()
if options.version:
print "CCSM %s" % Version
sys.exit(0)
if options.plugin:
plugin = options.plugin
if options.category:
category = options.category
screens = ccm.getScreens()
context = compizconfig.Context(screens)
GlobalUpdater.SetContext (context)
mainWin = ccm.MainWin(context, plugin, category)
if dbusObj is not None:
dbusObj.main_window = mainWin
idle = ccm.IdleSettingsParser(context, mainWin)
mainWin.show_all()
import os
os.close(0)
gtk.main()[/code]
李肇宁 于 2009-11-29 11:52:50发表:
装了
alick 于 2009-11-29 11:51:15发表:
lz安装compizconfig相关的软件包了么?