summaryrefslogtreecommitdiffstats
path: root/examples/example_dcopexport.py
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-01-03 15:29:41 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-01-07 22:14:56 +0900
commit4ce11cc30df1805459a615960fdec204a975548a (patch)
tree084f1e1fa404bdf0d082b1a58acf392b5d177326 /examples/example_dcopexport.py
parent065f41b4908b11278d4334e8c85150ec0fd4a9f6 (diff)
downloadpytde-4ce11cc3.tar.gz
pytde-4ce11cc3.zip
Drop python2 support.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'examples/example_dcopexport.py')
-rw-r--r--examples/example_dcopexport.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/examples/example_dcopexport.py b/examples/example_dcopexport.py
index 7d4ae95..d9436fc 100644
--- a/examples/example_dcopexport.py
+++ b/examples/example_dcopexport.py
@@ -30,13 +30,13 @@ copyright holder.
"""
# This is an example of a DCOP enabled application written in Python, using
-# PyKDE and the dcopexport module. Taken from server.py example in kde-bindings
+# PyTDE and the dcopexport module. Taken from server.py example in kde-bindings
# which was written by Torben Weis and Julian Rockey
import sys
+from PyTQt.qt import TQString, TQStringList
from tdecore import TDEApplication, TDECmdLineArgs, TDEAboutData
from dcopexport import DCOPExObj
-from PyTQt.qt import TQString, TQStringList
"""
DCOPExObj provides all of the necessary machinery to DCOP-enable
@@ -67,8 +67,8 @@ To DCOP-enable an app,
# the class which will expose methods to DCOP - the methods do NOT
# need to be a member of this class.
class DeadParrotObject (DCOPExObj):
- def __init__ (self, id = 'dead parrot'):
- DCOPExObj.__init__ (self, id)
+ def __init__ (self, id = b'dead parrot'):
+ DCOPExObj.__init__(self, id)
# the methods available from this app via DCOP
# addMethod (<signature>, <Python method>)
@@ -100,28 +100,28 @@ class DeadParrotObject (DCOPExObj):
return qadjList
-description = "A basic application template"
-version = "1.0"
-aboutData = TDEAboutData ("testdcopexport", "petshop",\
+
+description = b"DCOP server 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 ()
-appid = dcop.registerAs('petshop')
-print "DCOP Application: %s starting" % appid
+appid = dcop.registerAs(b'petshop')
+print("DCOP Application: %s starting" % appid.data())
parrot = DeadParrotObject()
-another_parrot = DeadParrotObject('polly')
+another_parrot = DeadParrotObject(b'polly')
-print """
+print("""
Run kdcop and look for the 'petshop' application instance.
This program exports the 'deadParrot' and 'polly' objects.
@@ -129,7 +129,7 @@ Double-clicking those object's methods will allow you to get or set data.
To end the application, in kdcop choose the MainApplication-Interface
object and double-click the quit() method.
-"""
+""")
app.exec_loop()