Using dcop in Superkaramba python scripts.
Creating dcop client directly causes problems. It tries to create
kapplication and superkaramba has already created one.
Getting dcop client from already existing superkaramba
kapplication works.
Here's an example of theme
py file that opens another theme and when it's clicked closes it
using dcop.
import dcop
import dcopext
import karamba
from qt import QString, QCString
from kdecore import *
def closeTheme(theme):
# Get superkaramba application object
kapp = KApplication.kApplication()
# Get dcop client
dc = kapp.dcopClient()
# Get applications
apps = dc.registeredApplications()
# Reduce list to only superkaramba instances
apps = [ str(app) for app in apps if str(app)[:12] == 'superkaramba']
# Call closeTheme to all superkarambas
for app in apps:
d = dcopext.DCOPApp(app, dc)
d.KarambaIface.closeTheme(theme)
def initWidget(widget):
karamba.openTheme('2.theme')
def widgetClicked(widget, x, y, button):
closeTheme('2')
|