summaryrefslogtreecommitdiffstats
path: root/examples/example_dcopext.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_dcopext.py')
-rw-r--r--examples/example_dcopext.py115
1 files changed, 56 insertions, 59 deletions
diff --git a/examples/example_dcopext.py b/examples/example_dcopext.py
index 31815c5..d019780 100644
--- a/examples/example_dcopext.py
+++ b/examples/example_dcopext.py
@@ -28,108 +28,105 @@ copyright holder.
"""
import sys, time
+from PyTQt.qt import TQString, TQCString
import dcop
import dcopext
from tdecore import TDEApplication, TDECmdLineArgs, TDEAboutData
-from PyTQt.qt import TQString, TQCString
-
def getAnyApplication (client, appName):
for qcstring_app in client.registeredApplications ():
app = str (qcstring_app)
if app == appName or app.startswith (appName + "-"):
- print app
- print
+ print(app)
+ print()
objList, ok = client.remoteObjects (app)
for obj in objList:
- print " ", obj
+ print(" ", obj)
funcs, ok = client.remoteFunctions (app, obj)
for f in funcs:
- print " ", " ", f
+ print(" ", " ", f)
break
#-------------------- main ------------------------------------------------
-description = "A basic application template"
-version = "1.0"
-aboutData = TDEAboutData ("testdcopext", "testdcopext",\
+description = b"DCOP client template"
+version = b"1.0"
+aboutData = TDEAboutData (b"MyApp", b"MyApp",\
version, description, TDEAboutData.License_GPL,\
- "(C) 2003 whoever the author is")
+ b"(C) 2003 whoever the author is")
-aboutData.addAuthor ("author1", "whatever they did", "email@somedomain")
-aboutData.addAuthor ("author2", "they did something else", "another@email.address")
+aboutData.addAuthor (b"author1", b"whatever they did", b"email@somedomain")
+aboutData.addAuthor (b"author2", b"they did something else", b"another@email.address")
TDECmdLineArgs.init (sys.argv, aboutData)
-TDECmdLineArgs.addCmdLineOptions ([("+files", "File to open")])
+TDECmdLineArgs.addCmdLineOptions ([(b"+files", b"File to open")])
app = TDEApplication ()
dcop = app.dcopClient ()
#getAnyApplication (dcop, "konqueror")
-print "--------------------------"
-print "The DCOPObjects for kicker:"
+print("--------------------------")
+print("The DCOPObjects for kicker:")
d = dcopext.DCOPApp ("kicker", dcop)
objs = d.objects
if objs:
for obj in objs:
- print obj
+ print(obj.data())
+print("--------------------------")
+print("The methods for the panel:")
o = d.object ("Panel")
methods = o.methods
for method in methods:
- print method
+ print(method.data())
m = o.method ("addNonKDEAppButton")
-
-print "--------------------------"
-print "The method"
-print o.method
-print "--------------------------"
-print "Find the method:"
-print m.findMethod ()
-print "--------------------------"
-print "The return type:"
-print m.rtype
-print "--------------------------"
-print "The argument types:"
-print m.argtypes
-print "--------------------------"
-print "The argument names:"
-print m.argnames
-print "--------------------------"
-
-print
-print "get kicker panel size via DCOP"
+print(m)
+print("--------------------------")
+print("The method")
+print(o.method)
+print("--------------------------")
+print("Find the method:")
+print(m.findMethod ())
+print("--------------------------")
+print("The return type:")
+print(m.rtype)
+print("--------------------------")
+print("The argument types:")
+print(m.argtypes)
+print("--------------------------")
+print("The argument names:")
+print(m.argnames)
+print("--------------------------")
+
+print("get kicker panel size via DCOP")
res = d.Panel.panelSize()
-print res, d.Panel.panelSize.valid
-print "--------------------------"
+print(res, d.Panel.panelSize.valid)
+print("--------------------------")
-print "Call a method that doesn't exist"
+print("Call a method that doesn't exist")
res = d.Panel.junk ()
-print res
-print "--------------------------"
+print(res)
+print("--------------------------")
-print "See if a non-existent method is valid"
-print d.Panel.junk.valid
-print
-print "--------------------------"
+print("See if a non-existent method is valid")
+print(d.Panel.junk.valid)
+print("--------------------------")
-print
-print
-print "Start a kwrite instance"
+print("Start a kwrite instance")
errcode, error, dcopService, pid = TDEApplication.startServiceByDesktopName ("kwrite", "")
dcopService = "kwrite-" + str (pid)
-print "errcode: %i error: %s dcopService: %s pid: %i" % (errcode, error, dcopService, pid)
-print "--------------------------"
+print("errcode: %i error: %s dcopService: %s pid: %i" % (errcode, error, dcopService, pid))
+print("--------------------------")
time.sleep (2)
o1 = dcopext.DCOPObj (dcopService, dcop, "EditInterface#1")
-print "Check if insertLine is a valid function"
-print "valid", o1.insertLine.valid
-print "--------------------------"
-print "insertLine's arg types and names"
-print o1.insertLine.argtypes, o1.insertLine.argnames
-print "--------------------------"
-print "Insert a line into the kwrite instance we launched"
-print "call returns:", o1.insertLine (0, "Now is the time for all good men to come to the aid of their party")
+print("Check if insertLine is a valid function")
+print("valid", o1.insertLine.valid)
+print("--------------------------")
+print("insertLine's arg types and names")
+print(o1.insertLine.argtypes, o1.insertLine.argnames)
+print("--------------------------")
+print("Insert a line into the kwrite instance we launched")
+print("call returns:", o1.insertLine (0, "Now is the time for all good men to come to the aid of their party"))