diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-03 15:29:41 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-07 22:14:56 +0900 |
commit | 4ce11cc30df1805459a615960fdec204a975548a (patch) | |
tree | 084f1e1fa404bdf0d082b1a58acf392b5d177326 /examples | |
parent | 065f41b4908b11278d4334e8c85150ec0fd4a9f6 (diff) | |
download | pytde-4ce11cc30df1805459a615960fdec204a975548a.tar.gz pytde-4ce11cc30df1805459a615960fdec204a975548a.zip |
Drop python2 support.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'examples')
47 files changed, 300 insertions, 330 deletions
diff --git a/examples/README b/examples/README index a316a6a..8251cb6 100644 --- a/examples/README +++ b/examples/README @@ -1,6 +1,6 @@ This subdirectory contains a few executable Python programs that demonstrate or test some features of -PyKDE: +PyTDE: uisampler.py - demos of most of the tdeui widgets, including dialogs, menus (TDEAction, KStdAction, etc) 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() 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")) diff --git a/examples/kurldemo.py b/examples/kurldemo.py index badec04..cddb9a4 100644 --- a/examples/kurldemo.py +++ b/examples/kurldemo.py @@ -36,7 +36,7 @@ from tdeui import TDEMainWindow, KEdit class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(self, *args) self.setGeometry (0, 0, 400, 600) @@ -79,18 +79,18 @@ class MainWin (TDEMainWindow): #-------------------- main ------------------------------------------------ -description = "A basic application template" -version = "1.0" -aboutData = TDEAboutData ("", "",\ +description = b"A basic application 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 () mainWindow = MainWin (None, "main window") diff --git a/examples/menudemo.py b/examples/menudemo.py index 460be70..33960a2 100644 --- a/examples/menudemo.py +++ b/examples/menudemo.py @@ -1,6 +1,6 @@ """ This template constructs an application with menus, toolbar and statusbar. -It uses KDE classes and methods that simplify the task of building and +It uses TDE classes and methods that simplify the task of building and operating a GUI. It is recommended that this approach be used, rather than the primitive approach in menuapp1.py """ @@ -35,10 +35,6 @@ copyright holder. """ -False = 0 -True = not False - - import sys from PyTQt.qt import TQPopupMenu, SIGNAL, TQLabel, TQIconSet @@ -53,7 +49,7 @@ STATUSBAR_RIGHT = 3 class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(self, *args) self.initActions () self.initMenus () @@ -106,14 +102,6 @@ class MainWin (TDEMainWindow): self.actionMenu.insert (KStdAction.zoomIn (self.slotZoomIn, self.actionCollection ())) self.actionMenu.insert (KStdAction.zoomOut (self.slotZoomOut, self.actionCollection ())) - # Doesn't work in KDE 2.1.1 -# self.radio1Action = TDERadioAction ("Radio 1") -# self.radio1Action.setExclusiveGroup ("Radio") -# self.radio2Action = TDERadioAction ("Radio 2") -# self.radio2Action.setExclusiveGroup ("Radio") -# self.radio3Action = TDERadioAction ("Radio 3") -# self.radio3Action.setExclusiveGroup ("Radio") - def initMenus (self): fileMenu = TQPopupMenu (self) self.newAction.plug (fileMenu) @@ -272,20 +260,21 @@ class MainWin (TDEMainWindow): #-------------------- main ------------------------------------------------ -description = "A basic application template" -version = "1.0" -aboutData = TDEAboutData ("", "",\ +description = b"A basic application 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 () -mainWindow = MainWin (None, "main window") +mainWindow = MainWin (None, b"main window") +mainWindow.setGeometry(100, 100, 600, 400) mainWindow.show() app.exec_loop() diff --git a/examples/mimetype.py b/examples/mimetype.py index 044bc7a..26fbe7f 100644 --- a/examples/mimetype.py +++ b/examples/mimetype.py @@ -4,8 +4,6 @@ methods (KMimeType, KService, etc). It generally tests the *::List methods for these classes (eg KService::List) since that also tests the *::Ptr mapped type code (eg KService::Ptr) at the same time. -This version is suitable for KDE >= 3.0.0 (some methods not available -in earlier versions) """ """ @@ -47,7 +45,7 @@ from tdeio import KMimeType, KService, KServiceGroup, KServiceType, TDETrader, K class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(*(self,) + args) tabctl = KTabCtl (self) self.setGeometry (0, 0, 600, 400) @@ -88,7 +86,7 @@ class OfferListTab (TQWidget): trader = TDETrader.self () slist = trader.query ("image/jpeg", "Type == 'Application'") - print "TDETrader returned:", slist + print("TDETrader returned:", slist) for s in slist: lvi = TQListViewItem (lv, s.type_ (), s.name (), s.exec_ (), s.library ()) @@ -253,16 +251,16 @@ class KMimeTypeTab (TQWidget): #-------------------- main ------------------------------------------------ -description = "Test/demo TDESharedPtr related methods/classes" -version = "1.0" -aboutData = TDEAboutData ("", "",\ + +description = b"Test/demo TDESharedPtr related methods/classes" +version = b"1.0" +aboutData = TDEAboutData (b"MyApp", b"MyApp",\ version, description, TDEAboutData.License_GPL,\ - "(C) 2003 Jim Bublitz") + b"(C) 2003 Jim Bublitz") TDECmdLineArgs.init (sys.argv, aboutData) -TDECmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) - +TDECmdLineArgs.addCmdLineOptions ([(b"+files", b"File to open")]) app = TDEApplication () mainWindow = MainWin (None, "main window") mainWindow.show() diff --git a/examples/pyTDEHTMLPart.py b/examples/pyTDEHTMLPart.py index fc3f934..333247d 100644 --- a/examples/pyTDEHTMLPart.py +++ b/examples/pyTDEHTMLPart.py @@ -8,7 +8,7 @@ This is an extemely simple and crude example of using a TDEHTMLPart - I put it together mostly to make sure the openURL method worked correctly after some modifications done in KParts::ReadOnlyPart. It took exactly four lines -added to a basic PyKDE app framework to display a URL +added to a basic PyTDE app framework to display a URL via the 'net: self.w = TDEHTMLPart (self, "HTMLPart", self); @@ -26,31 +26,27 @@ probably need to connect some signals to slots. I haven't tried it, but this should work with a plain TDEMainWindow or other widget too. -The KDE website also incorporates gifs, jpegs, and +The TDE website also incorporates gifs, jpegs, and I believe CSS too. Playing around with some other sites, it appears the font defaults could use some improvement. NOTE!!! For this to work, you (obviously) need to have a route to the internet established or specify a local -URL - PyKDE/KDE will take care of everything else. +URL - PyTDE/TDE will take care of everything else. Perceptive users will notice the TDEHTMLPart code is -lifted from the KDE classref. +lifted from the TDE classref. """ # If you import more classes, don't forget to add them here (some of these # are extras/not used) +from PyTQt.qt import TQString, TQStringList from tdecore import TDECmdLineArgs, KURL, TDEApplication, i18n, TDEAboutData, BarIcon, KLibLoader - from tdeui import TDEMainWindow, KMessageBox, TDEAction, KStdAction, KKeyDialog, KEditToolbar - -from PyTQt.qt import TQString, TQStringList - from tdeio import TDETrader - from tdehtml import TDEHTMLPart, TDEHTMLView # Importing the KParts namespace gets us all of the KParts:: classes @@ -58,20 +54,14 @@ from tdeparts import KParts, createReadOnlyPart, createReadWritePart import sys, os -FALSE = 0 -TRUE = not FALSE - TOOLBAR_EXIT = 0 TOOLBAR_OPEN = 1 # Note that we use KParts.MainWindow, not TDEMainWindow as the superclass -# (KParts.MainWindow subclasses TDEMainWindow). Also, be sure the 'apply' -# clause references KParts.MainWindow - it's a hard bug to track down -# if it doesn't. - +# (KParts.MainWindow subclasses TDEMainWindow). class pyPartsMW (KParts.MainWindow): def __init__ (self, *args): - apply (KParts.MainWindow.__init__, (self,) + args) + KParts.MainWindow.__init__(self, *args) # Create the actions for our menu/toolbar to use # Keep in mind that the part loaded will provide its @@ -90,19 +80,19 @@ class pyPartsMW (KParts.MainWindow): KStdAction.configureToolbars(self.optionsConfigureToolbars, self.actionCollection()); self.path = os.getcwd () + '/' - self.setGeometry (0, 0, 600, 500) + self.setGeometry (0, 0, 1024, 768) # point to our XML file - self.setXMLFile (self.path + "pyParts.rc", FALSE) + self.setXMLFile (self.path + "pyParts.rc", False) # The next few lines are all that's necessary to # create a web browser (of course you have to edit # this file to change url's) self.w = TDEHTMLPart (self, "HTMLPart", self); - self.w.openURL (KURL ("http://www.kde.org")); + self.w.openURL (KURL ("http://www.trinitydesktop.org")); - self.w.view ().setGeometry (30, 55, 500, 400); + self.w.view ().setGeometry (30, 30, 1024-60, 768-60); # self.v = TDEHTMLView (self.w, self) @@ -143,21 +133,21 @@ class pyPartsMW (KParts.MainWindow): # some boilerplate left over from pyKLess/KLess def queryClose(self): res = KMessageBox.warningYesNoCancel(self,\ - i18n("Save changes to Document?<br>(Does not make sense, we know, but it is just a programming example :-)")) + i18n("<qt>Save changes to Document?<br/>(Does not make sense, we know, but it is just a programming example :-)</qt>")) if res == KMessageBox.Yes: - #// save document here. If saving fails, return FALSE - return TRUE + #// save document here. If saving fails, return False + return True elif res == KMessageBox.No: - return TRUE + return True else: #// cancel - return FALSE + return False def queryExit(self): #// this slot is invoked in addition when the *last* window is going #// to be closed. We could do some final cleanup here. - return TRUE #// accept + return True #// accept # I'm not sure the session mgmt stuff here works @@ -181,16 +171,16 @@ class pyPartsMW (KParts.MainWindow): #------------- main ---------------------------- # A Human readable description of your program -description = "TDEHTMLPart - simple example" +description = b"TDEHTMLPart - simple example" # The version -version = "0.1" +version = b"0.1" # stuff for the "About" menu -aboutData = TDEAboutData ("pyTDEHTMLPart", "pyHTMLPart",\ +aboutData = TDEAboutData (b"pyTDEHTMLPart", b"pyHTMLPart",\ version, description, TDEAboutData.License_GPL,\ - "(c) 2002, Jim Bublitz") + b"(c) 2002, Jim Bublitz") -aboutData.addAuthor ("Jim Bublitz", "Example for PyKDE", "jbublitz@nwinternet.com") +aboutData.addAuthor (b"Jim Bublitz", b"Example for PyTDE", b"jbublitz@nwinternet.com") # This MUST go here (before TDEApplication () is called) TDECmdLineArgs.init (sys.argv, aboutData) diff --git a/examples/pytde-sampler/HOWTO.samples b/examples/pytde-sampler/HOWTO.samples index 8006eb4..18b3f4b 100644 --- a/examples/pytde-sampler/HOWTO.samples +++ b/examples/pytde-sampler/HOWTO.samples @@ -1,4 +1,4 @@ -How to Write Samples for the PyKDE Sampler +How to Write Samples for the PyTDE Sampler ========================================== @@ -12,11 +12,11 @@ In side the module, add the following: default: 'filenew' example: 'colorize' - When supplied, this should be the short name of a KDE icon, such as + When supplied, this should be the short name of a TDE icon, such as 'stop', 'editclear', etc. If available, This icon will be used as the list item's icon in the sampler. Not all icons are available in all themes, so try to use the icons that are available in the - default KDE installation. + default TDE installation. - labelText - string (optional) diff --git a/examples/pytde-sampler/about.py b/examples/pytde-sampler/about.py index f675b1c..c58de92 100644 --- a/examples/pytde-sampler/about.py +++ b/examples/pytde-sampler/about.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -""" About the PyKDE Sampler +""" About the PyTDE Sampler Defines the 'about' function to create a TDEAboutData instance for the sampler application. @@ -8,16 +8,16 @@ from os.path import dirname, join from tdecore import TDEAboutData -appName = 'pytdesampler' -progName = 'PyKDE Sampler' -authorName = 'Troy Melhase' -authorEmail = bugsEmailAddress = 'troy@gci.net' -version = '0.1' -shortDescription = 'The PyKDE Sampler' +appName = b'pytdesampler' +progName = b'PyTDE Sampler' +authorName = b'Troy Melhase' +authorEmail = bugsEmailAddress = b'troy@gci.net' +version = b'0.1' +shortDescription = b'The PyTDE Sampler' licenseType = TDEAboutData.License_GPL_V2 -copyrightStatement = '(c) 2006, %s' % (authorName, ) -homePageAddress = 'http://www.riverbankcomputing.co.uk/pytde/' -aboutText = ("The application sampler for PyKDE.") +copyrightStatement = '(c) 2006, Troy Melhase' +homePageAddress = b'http://www.riverbankcomputing.co.uk/pytde/' +aboutText = (b"The application sampler for PyTDE.") contributors = [] # module-level global for keeping the strings around; intentional diff --git a/examples/pytde-sampler/basic_widgets/__init__.py b/examples/pytde-sampler/basic_widgets/__init__.py index 35e708d..014db50 100644 --- a/examples/pytde-sampler/basic_widgets/__init__.py +++ b/examples/pytde-sampler/basic_widgets/__init__.py @@ -1,7 +1,7 @@ labelText = 'Widgets' iconName = 'about_kde' -helpText = """KDE provides a large set of basic widgets for application use. +helpText = """TDE provides a large set of basic widgets for application use. Select the children of this item to see for yourself.""" from PyTQt.qt import TQFrame, TQVBoxLayout diff --git a/examples/pytde-sampler/basic_widgets/historycombo.py b/examples/pytde-sampler/basic_widgets/historycombo.py index f0bb8b8..bfca05e 100644 --- a/examples/pytde-sampler/basic_widgets/historycombo.py +++ b/examples/pytde-sampler/basic_widgets/historycombo.py @@ -49,5 +49,5 @@ class MainFrame(TQFrame): self.historySelection.setText) def historyCleared(self): - print 'History combo cleared.' + print('History combo cleared.') diff --git a/examples/pytde-sampler/contributors.txt b/examples/pytde-sampler/contributors.txt index 5063545..0f0e286 100644 --- a/examples/pytde-sampler/contributors.txt +++ b/examples/pytde-sampler/contributors.txt @@ -1,4 +1,4 @@ # author, contributions, email Phil Thompson, For PyTQt and SIP, phil@riverbankcomputing.co.uk -Jim Bublitz, For PyKDE, jbublitz@nwinternet.com +Jim Bublitz, For PyTDE, jbublitz@nwinternet.com diff --git a/examples/pytde-sampler/dialogs/__init__.py b/examples/pytde-sampler/dialogs/__init__.py index c9c105a..caab63d 100644 --- a/examples/pytde-sampler/dialogs/__init__.py +++ b/examples/pytde-sampler/dialogs/__init__.py @@ -2,7 +2,7 @@ labelText = 'Dialog Boxes' iconName = 'launch' -helpText = ("KDE provides a convenient set of dialog boxes for application use. " +helpText = ("TDE provides a convenient set of dialog boxes for application use. " "Select the children of this item to see for yourself.") diff --git a/examples/pytde-sampler/dialogs/about/__init__.py b/examples/pytde-sampler/dialogs/about/__init__.py index 9fd612d..9d0092f 100644 --- a/examples/pytde-sampler/dialogs/about/__init__.py +++ b/examples/pytde-sampler/dialogs/about/__init__.py @@ -1,7 +1,7 @@ labelText = 'About Dialogs' iconName = 'info' -helpText = ("KDE has multiple dialog types to display information about your " +helpText = ("TDE has multiple dialog types to display information about your " "applicaiton and environment. They provide a tremendous amount of functionality " "and consistency. They're easy to use, and they're good for the environment!") diff --git a/examples/pytde-sampler/dialogs/about/aboutkde.py b/examples/pytde-sampler/dialogs/about/abouttde.py index e50c88d..43e354f 100644 --- a/examples/pytde-sampler/dialogs/about/aboutkde.py +++ b/examples/pytde-sampler/dialogs/about/abouttde.py @@ -1,5 +1,5 @@ iconName = 'about_kde' -labelText = 'TDEAboutKDE' +labelText = 'TDEAboutTDE' from PyTQt.qt import TQFrame, TQHBoxLayout, TQVBoxLayout, SIGNAL from tdecore import i18n @@ -7,13 +7,13 @@ from tdeui import TDEAboutKDE, KPushButton, KTextEdit helpText = ("Typically available via the applications 'Help' menu, this " - "dialog presents the user with the standard KDE About dialog.") + "dialog presents the user with the standard TDE About dialog.") class MainFrame(TQFrame): def __init__(self, parent=None): TQFrame.__init__(self, parent) - self.button = KPushButton(i18n('About KDE'), self) + self.button = KPushButton(i18n('About TDE'), self) self.help = KTextEdit(helpText, '', self) layout = TQVBoxLayout(self, 4) layout.addWidget(self.help) diff --git a/examples/pytde-sampler/dialogs/bugreport.py b/examples/pytde-sampler/dialogs/bugreport.py index b06717c..74fce7e 100644 --- a/examples/pytde-sampler/dialogs/bugreport.py +++ b/examples/pytde-sampler/dialogs/bugreport.py @@ -1,7 +1,7 @@ iconName = 'core' labelText = 'KBugReport' -##~ if we wanted to, we could define the name of a KDE class used for lookup of +##~ if we wanted to, we could define the name of a TDE class used for lookup of ##~ the documentation url. The 'labelText' string above already ##~ specifies what we want. ##~ docItemName = 'KBugReport' @@ -11,7 +11,7 @@ from tdecore import i18n from tdeui import TDEAboutDialog, KPushButton, KBugReport, KTextEdit -helpText = ("KDE provides a way to report bugs from applications. This dialog" +helpText = ("TDE provides a way to report bugs from applications. This dialog" "is typically available from the application 'Help' menu.") diff --git a/examples/pytde-sampler/dialogs/color.py b/examples/pytde-sampler/dialogs/color.py index f9aeb0c..ea567e2 100644 --- a/examples/pytde-sampler/dialogs/color.py +++ b/examples/pytde-sampler/dialogs/color.py @@ -7,7 +7,7 @@ from tdecore import i18n from tdeui import KPushButton, KColorDialog, KColorPatch, KTextEdit -helpText = ("KDE provides a nifty common color selection dialog." +helpText = ("TDE provides a nifty common color selection dialog." "The color selection in the dialog is tracked via a SIGNAL " "connected to the KColorPatch area below.") diff --git a/examples/pytde-sampler/dialogs/edfind.py b/examples/pytde-sampler/dialogs/edfind.py index 46258f5..aff61cb 100644 --- a/examples/pytde-sampler/dialogs/edfind.py +++ b/examples/pytde-sampler/dialogs/edfind.py @@ -34,18 +34,18 @@ class MainFrame(TQFrame): def doneClicked(self): - print 'done searching' + print('done searching') def searchClicked(self): - print 'searching: ', self.dlg.getText(), + print('searching: ', self.dlg.getText(), end=' ') if self.dlg.get_direction(): - print '(backwards) ', + print('(backwards) ', end=' ') else: - print '(forwards) ', + print('(forwards) ', end=' ') if self.dlg.case_sensitive(): - print '(case-sensitive)' + print('(case-sensitive)') else: - print '(case-insensitive)' + print('(case-insensitive)') diff --git a/examples/pytde-sampler/dialogs/edreplace.py b/examples/pytde-sampler/dialogs/edreplace.py index 1c4950b..31b03b9 100644 --- a/examples/pytde-sampler/dialogs/edreplace.py +++ b/examples/pytde-sampler/dialogs/edreplace.py @@ -33,19 +33,19 @@ class MainFrame(TQFrame): def doneClicked(self): - print 'done replacing' + print('done replacing') def replaceClicked(self): - print 'replacing: ', self.dlg.getText() + print('replacing: ', self.dlg.getText()) return if self.dlg.get_direction(): - print '(backwards) ', + print('(backwards) ', end=' ') else: - print '(forwards) ', + print('(forwards) ', end=' ') if self.dlg.case_sensitive(): - print '(case-sensitive)' + print('(case-sensitive)') else: - print '(case-insensitive)' + print('(case-insensitive)') diff --git a/examples/pytde-sampler/dialogs/font.py b/examples/pytde-sampler/dialogs/font.py index 175817a..298f44f 100644 --- a/examples/pytde-sampler/dialogs/font.py +++ b/examples/pytde-sampler/dialogs/font.py @@ -6,7 +6,7 @@ from tdeui import KPushButton, TDEFontDialog, KTextEdit iconName = 'fonts' labelText = 'TDEFontDialog' docParts = ('tdeui', 'TDEFontDialog') -helpText = ("KDE provides a font dialog box for users to select (can you " +helpText = ("TDE provides a font dialog box for users to select (can you " "guess??) fonts. The button below displays a font dialog box. " "The font of this widget (the text widget you're reading) is used " "as the default. If the dialog is accepted, the font of this " diff --git a/examples/pytde-sampler/dialogs/msgbox.py b/examples/pytde-sampler/dialogs/msgbox.py index 93f0d24..1ccfe3a 100644 --- a/examples/pytde-sampler/dialogs/msgbox.py +++ b/examples/pytde-sampler/dialogs/msgbox.py @@ -3,7 +3,7 @@ labelText = 'KMessageBox' from random import random from traceback import print_exc -from StringIO import StringIO +from io import StringIO from PyTQt.qt import TQFrame, TQGridLayout, TQLabel, TQStringList, SIGNAL from tdecore import i18n @@ -87,11 +87,11 @@ class MainFrame(TQFrame): def questionYesNo(self): dlg = KMessageBox.questionYesNo(self, self.msg, self.caption) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def warningYesNoCancel(self): dlg = KMessageBox.warningYesNoCancel(self, self.msg, self.caption) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def warningContinueCancelList(self): uiitem = KGuiItem('Time to Eat', 'favorites') @@ -99,43 +99,43 @@ class MainFrame(TQFrame): dlgid = '%s' % random() args = self, self.msg, self.items, self.caption, uiitem, dlgid dlg = ctor(*args) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def error(self): dlg = KMessageBox.error(self, self.err) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def detailedError(self): try: x = self.thisAttributeDoesNotExist - except (AttributeError, ), ex: + except (AttributeError, ) as ex: handle = StringIO() print_exc(0, handle) details = handle.getvalue() dlg = KMessageBox.detailedError(self, self.err, details) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def sorry(self): dlg = KMessageBox.sorry(self, self.err) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def detailedSorry(self): try: x = self.thisAttributeDoesNotExist - except (AttributeError, ), ex: + except (AttributeError, ) as ex: handle = StringIO() print_exc(0, handle) details = handle.getvalue() dlg = KMessageBox.detailedSorry(self, self.err, details) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def information(self): dlgid = '%s' % random() dlg = KMessageBox.information(self, self.info, '', dlgid) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) def informationList(self): dlgid = '%s' % random() ctor = KMessageBox.informationList dlg = ctor(self, self.info, self.items, '', dlgid) - print 'You pressed "%s"' % (self.responses.get(dlg, dlg), ) + print('You pressed "%s"' % (self.responses.get(dlg, dlg), )) diff --git a/examples/pytde-sampler/dialogs/passwd.py b/examples/pytde-sampler/dialogs/passwd.py index 3a7fd29..93d66f9 100644 --- a/examples/pytde-sampler/dialogs/passwd.py +++ b/examples/pytde-sampler/dialogs/passwd.py @@ -5,7 +5,7 @@ from tdeui import KPushButton, KPasswordDialog, KTextEdit iconName = 'password' labelText = 'KPasswordDialog' docParts = ('tdeui', 'KPasswordDialog') -helpText = ("KDE provides two variations on the password dialog. The simple " +helpText = ("TDE provides two variations on the password dialog. The simple " "one shown here prompts for a password. The other type allows the " "user to enter a new password, and provides a second field to " "confirm the first entry.") diff --git a/examples/pytde-sampler/dialogs/progress.py b/examples/pytde-sampler/dialogs/progress.py index f7d69f8..b2ead9a 100644 --- a/examples/pytde-sampler/dialogs/progress.py +++ b/examples/pytde-sampler/dialogs/progress.py @@ -7,7 +7,7 @@ from tdecore import i18n from tdeui import KPushButton, KProgressDialog, KTextEdit -helpText = """KDE provides a ready-built dialog to display a bit of text and a +helpText = """TDE provides a ready-built dialog to display a bit of text and a progress bar.""" diff --git a/examples/pytde-sampler/dialogs/tip.py b/examples/pytde-sampler/dialogs/tip.py index 15ec50d..2e4fc02 100644 --- a/examples/pytde-sampler/dialogs/tip.py +++ b/examples/pytde-sampler/dialogs/tip.py @@ -8,7 +8,7 @@ from tdecore import i18n from tdeui import KPushButton, KTipDatabase, KTipDialog, KTextEdit -helpText = ("The KDE standard Tip-of-the-Day dialog.") +helpText = ("The TDE standard Tip-of-the-Day dialog.") class MainFrame(TQFrame): diff --git a/examples/pytde-sampler/dialogs/tips b/examples/pytde-sampler/dialogs/tips index 9f24457..e0439dc 100644 --- a/examples/pytde-sampler/dialogs/tips +++ b/examples/pytde-sampler/dialogs/tips @@ -1,23 +1,23 @@ -<tip category="PyKDE Sampler|General"> +<tip category="PyTDE Sampler|General"> <html> <p>Don't tug on Superman's cape.</p> </html> </tip> -<tip category="PyKDE Sampler|General"> +<tip category="PyTDE Sampler|General"> <html> <p>Don't spit into the wind.</p> </html> </tip> -<tip category="PyKDE Sampler|General"> +<tip category="PyTDE Sampler|General"> <html> <p>Don't pull the mask off the Lone Ranger.</p> </html> </tip> -<tip category="PyKDE Sampler|General"> +<tip category="PyTDE Sampler|General"> <html> <p>And don't mess around with <em>Jim</em>!</p> </html> diff --git a/examples/pytde-sampler/gen_todo.py b/examples/pytde-sampler/gen_todo.py index 0fc60c4..fa48137 100644 --- a/examples/pytde-sampler/gen_todo.py +++ b/examples/pytde-sampler/gen_todo.py @@ -2,7 +2,7 @@ mods = ['dcop', 'tdecore', 'tdefx', 'tdeprint', 'tdesu', 'tdeui', 'tdefile', 'td all = [] -print 'Module,Item,Path,Contributor' +print('Module,Item,Path,Contributor') for mod in mods: module = __import__(mod) items = dir(module) @@ -12,7 +12,7 @@ for mod in mods: for item in items: all.append(item) - print '%s,%s,,,' % (mod, item, ) + print('%s,%s,,,' % (mod, item, )) diff --git a/examples/pytde-sampler/icon_handling/__init__.py b/examples/pytde-sampler/icon_handling/__init__.py index 0b82073..87ee0c7 100644 --- a/examples/pytde-sampler/icon_handling/__init__.py +++ b/examples/pytde-sampler/icon_handling/__init__.py @@ -2,7 +2,7 @@ labelText = 'Icons' iconName = 'icons' -helpText = ("KDE icons are nice. " +helpText = ("TDE icons are nice. " "Select the children of this item to see for yourself.") diff --git a/examples/pytde-sampler/icon_handling/misc.py b/examples/pytde-sampler/icon_handling/misc.py index d3ea6a1..db7b624 100644 --- a/examples/pytde-sampler/icon_handling/misc.py +++ b/examples/pytde-sampler/icon_handling/misc.py @@ -26,6 +26,6 @@ class MainFrame(TQFrame): import os fn = os.path.abspath('.') - print fn + print(fn) self.write = KWritePermsIcon(fn) self.write.reparent(self, 0, TQPoint(0,0), True) diff --git a/examples/pytde-sampler/lib.py b/examples/pytde-sampler/lib.py index 875ae1a..d81f2c3 100644 --- a/examples/pytde-sampler/lib.py +++ b/examples/pytde-sampler/lib.py @@ -68,8 +68,8 @@ def listmodules(): path = path.replace(samplerpath, '').replace(os.path.sep, '.') try: module = namedimport(path) - except (ValueError, ImportError, ), exc: - print 'Exception %s importing %s' % (exc, path, ) + except (ValueError, ImportError, ) as exc: + print(('Exception %s importing %s' % (exc, path, ))) else: modules.append((path, module)) modules.sort() diff --git a/examples/pytde-sampler/misc/window_info.py b/examples/pytde-sampler/misc/window_info.py index 12a9d66..df9a21c 100644 --- a/examples/pytde-sampler/misc/window_info.py +++ b/examples/pytde-sampler/misc/window_info.py @@ -25,11 +25,9 @@ class MainFrame(TQFrame): def showWindowInfo(self): - main = TDEApplication.kApplication() - print main - print main.mainWidget() + app = TDEApplication.kApplication() - info = KWindowInfo(main) - info.message('Updated Window Info', 3) + info = KWindowInfo(app.activeWindow()) + info.message('Updated Window Info', 3000) diff --git a/examples/pytde-sampler/qt_widgets/CONTRIB b/examples/pytde-sampler/qt_widgets/CONTRIB index 65adb0f..e0425fd 100644 --- a/examples/pytde-sampler/qt_widgets/CONTRIB +++ b/examples/pytde-sampler/qt_widgets/CONTRIB @@ -44,7 +44,7 @@ tdecore,TDEConfigSkeleton,,, tdecore,TDEConfigSkeletonItem,,, tdecore,TDECrash,,, tdecore,KDCOPPropertyProxy,,, -tdecore,KDE,,, +tdecore,TDE,,, tdecore,KDesktopFile,,, tdecore,KEntry,,, tdecore,KEntryKey,,, diff --git a/examples/pytde-sampler/qt_widgets/table.py b/examples/pytde-sampler/qt_widgets/table.py index f3b9e54..b75d596 100644 --- a/examples/pytde-sampler/qt_widgets/table.py +++ b/examples/pytde-sampler/qt_widgets/table.py @@ -22,7 +22,7 @@ class MainFrame(TQFrame): self.help = KTextEdit(helpText, '', self) data = csv.reader(open(contrib)) - header = data.next() + header = next(data) items = [item for item in data] self.table = table = TQTable(len(items), len(header), self) diff --git a/examples/pytde-sampler/runner.py b/examples/pytde-sampler/runner.py index 8c6e8de..66056d7 100755 --- a/examples/pytde-sampler/runner.py +++ b/examples/pytde-sampler/runner.py @@ -3,13 +3,9 @@ """ import sys -from tdecore import TDEApplication, TDECmdLineArgs -from tdeui import TDEMainWindow from PyTQt.qt import TQVBoxLayout - -## relative import -- cry me a river! -import about - +from tdecore import TDEApplication, TDECmdLineArgs, TDEAboutData +from tdeui import TDEMainWindow class SamplerRunnerWindow(TDEMainWindow): def __init__(self, ctor): @@ -35,14 +31,21 @@ def importItem(name): names = name.split('.') modname, itemname = names[0:-1], names[-1] + print(str.join('.', modname)) mod = importName(str.join('.', modname)) return getattr(mod, itemname) if __name__ == '__main__': - options = [('+item', 'An item in the sys.path')] - TDECmdLineArgs.init(sys.argv, about.about) + description = b"A runner application" + version = b"1.0" + aboutData = TDEAboutData (b"", b"",\ + version, description, TDEAboutData.License_GPL,\ + b"(C) 2003 whoever the author is") + + options = [(b'+item', b'An item in the sys.path')] + TDECmdLineArgs.init(sys.argv, aboutData) TDECmdLineArgs.addCmdLineOptions(options) args = TDECmdLineArgs.parsedArgs() diff --git a/examples/pytde-sampler/sampler.py b/examples/pytde-sampler/sampler.py index fec8ab7..6534829 100755 --- a/examples/pytde-sampler/sampler.py +++ b/examples/pytde-sampler/sampler.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -""" The PyKDE application sampler +""" The PyTDE application sampler This module defines the top-level widgets for displaying the sampler application. @@ -25,7 +25,6 @@ from tdeio import TDETrader from tdeparts import createReadOnlyPart, createReadWritePart from tdehtml import TDEHTMLPart -import about import lib @@ -114,7 +113,7 @@ class SamplerFrame(CommonFrame): try: frameType = module.builder() except (AttributeError, ): - print 'No sample callable defined in %s' % (module.name(), ) + print('No sample callable defined in %s' % (module.name(), )) else: frame = frameType(self) self.setWidget(frame) @@ -132,7 +131,7 @@ class SourceFrame(CommonFrame): def showModuleSource(self, item, module): if not self.part: - print 'No part available for displaying python source.' + print('No part available for displaying python source.') return try: modulefile = inspect.getabsfile(module.module) @@ -147,7 +146,7 @@ class WebFrame(CommonFrame): """ frame with part for viewing web pages """ - docBase = 'http://www.riverbankcomputing.com/Docs/PyKDE3/classref/' + docBase = 'http://www.riverbankcomputing.com/Docs/PyTDE3/classref/' def __init__(self, parent): CommonFrame.__init__(self, parent) @@ -155,7 +154,7 @@ class WebFrame(CommonFrame): #part.connect(part, SIGNAL('tdehtmlMousePressEvent(a)'), self.onURL) def onURL(self, a): - print '****', a + print('****', a) def showDocs(self, item, module): try: @@ -207,7 +206,7 @@ class SamplerListView(TDEListView): self.setRootIsDecorated(True) modules = lib.listmodules() - modules.sort(lambda a, b: cmp(a[0], b[0])) + modules.sort(key=lambda a: a[0]) modmap = dict(modules) modules = [(name.split('.'), name, mod) for name, mod in modules] @@ -233,7 +232,7 @@ class SamplerListView(TDEListView): subitem.setPixmap(0, getIcon(module.icon())) subitem = item - for root in roots.values(): + for root in list(roots.values()): self.setOpen(root, True) @@ -272,8 +271,8 @@ class SamplerMainWindow(TDEMainWindow): self.resize(640, 480) height, width = self.height(), self.width() - hSplit.setSizes([width * 0.35, width * 0.65]) - vSplit.setSizes([height * 0.80, height * 0.20]) + hSplit.setSizes([int(width * 0.35), int(width * 0.65)]) + vSplit.setSizes([int(height * 0.80), int(height * 0.20)]) self.xmlRcFileName = os.path.abspath(os.path.join(os.path.dirname(__file__), 'sampler.rc')) self.setXMLFile(self.xmlRcFileName) @@ -357,7 +356,7 @@ class SamplerMainWindow(TDEMainWindow): """ ret = KKeyDialog.configure(self.actionCollection(), self) - print ret + print(ret) if ret == TQDialog.Accepted: actions = self.actionCollection() actions.writeShortcutSettings(None, appConfig()) @@ -404,12 +403,18 @@ class SamplerMainWindow(TDEMainWindow): def reloadModule(self, item, module): - print >> sys.__stdout__, 'reload: ', reload(module.module) + print('reload: ', importlib.reload(module.module), file=sys.__stdout__) if __name__ == '__main__': - aboutdata = about.about() - TDECmdLineArgs.init(sys.argv, aboutdata) + description = b"A sampler application" + version = b"1.0" + aboutData = TDEAboutData (b"", b"",\ + version, description, TDEAboutData.License_GPL,\ + b"(C) 2003 whoever the author is") + + options = [(b'+item', b'An item in the sys.path')] + TDECmdLineArgs.init(sys.argv, aboutData) app = TDEApplication() splashpix = TQPixmap(os.path.join(lib.samplerpath, 'aboutkde.png')) diff --git a/examples/pytde-sampler/wizards/__init__.py b/examples/pytde-sampler/wizards/__init__.py deleted file mode 100644 index 63472b4..0000000 --- a/examples/pytde-sampler/wizards/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -iconName = 'wizard' -labelText = 'Wizards' diff --git a/examples/pytde-sampler/wizards/wiz.py b/examples/pytde-sampler/wizards/wiz.py deleted file mode 100644 index 1cb5544..0000000 --- a/examples/pytde-sampler/wizards/wiz.py +++ /dev/null @@ -1,2 +0,0 @@ -iconName = 'wizard' -labelText = 'Wizard' diff --git a/examples/pytde-sampler/xwin/__init__.py b/examples/pytde-sampler/xwin/__init__.py index 40b452a..41563ee 100644 --- a/examples/pytde-sampler/xwin/__init__.py +++ b/examples/pytde-sampler/xwin/__init__.py @@ -1,7 +1,7 @@ labelText = 'X Windows Features' iconName = 'kcmx' -helpText = """KDE and PyKDE allow interaction with the X Window system. Check +helpText = """TDE and PyTDE allow interaction with the X Window system. Check out the nifty samples below.""" from PyTQt.qt import TQFrame, TQLabel, TQVBoxLayout diff --git a/examples/qxembedexample.py b/examples/qxembedexample.py index ac8d30d..eb42a26 100644 --- a/examples/qxembedexample.py +++ b/examples/qxembedexample.py @@ -73,7 +73,7 @@ class QXEmbedExample(TQWidget): def launchApp(self): - print "QXEmbedExample.launchApp(): Not implemented yet" + print("QXEmbedExample.launchApp(): Not implemented yet") def __tr(self,s,c = None): - return tqApp.translate("QXEmbedExample",s,c) + return tqApp.translate(b"QXEmbedExample",s.encode(),c) diff --git a/examples/systray.py b/examples/systray.py index fa305b0..a4c3ff3 100644 --- a/examples/systray.py +++ b/examples/systray.py @@ -30,25 +30,36 @@ copyright holder. import sys from PyTQt.qt import TQLabel -from tdecore import TDEApplication, TDEIcon, TDEIconLoader +from tdecore import TDEAboutData, TDEApplication, TDECmdLineArgs, TDEIcon, TDEIconLoader from tdeui import TDEMainWindow, KSystemTray class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(self, *args) #-------------------- main ------------------------------------------------ -appName = "template" -app = TDEApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") +description = b"A basic application template" +version = b"1.0" +aboutData = TDEAboutData (b"MyApp", b"MyApp",\ + version, description, TDEAboutData.License_GPL,\ + b"(C) 2003 whoever the author is") + +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 ([(b"+files", b"File to open")]) + +app = TDEApplication () +mainWindow = MainWin(None, "main window") icons = TDEIconLoader () systray = KSystemTray (mainWindow) systray.setPixmap (icons.loadIcon("process-stop", TDEIcon.Desktop)) systray.show () -#mainWindow.show() app.exec_loop() diff --git a/examples/uimodules/uidialogs.py b/examples/uimodules/uidialogs.py index 12ad10f..697deb8 100644 --- a/examples/uimodules/uidialogs.py +++ b/examples/uimodules/uidialogs.py @@ -16,11 +16,6 @@ Information = 4 Sorry = 5 Error = 6 -# Python 2.2.2 supplies these, but they're duplicated here -# for backward compatibility -False = 0 -True = 1 - class CustomDlg (KDialog): def __init__ (self, parent, name = "custom dlg", modal = False): KDialog.__init__ (self, parent, name, modal) @@ -127,10 +122,10 @@ class MessageDlg (KDialog): def dlgTDEAboutDialog (parent): dlg = TDEAboutDialog (parent, 'about dialog', False) dlg.setLogo (TQPixmap ("pytestimage.png")) - dlg.setTitle ("UISampler for PyKDE") + dlg.setTitle ("UISampler for PyTDE") dlg.setAuthor ("Jim Bublitz", "jbublitz@nwinternet.com", "http://www.riverbankcomputing.co.uk",\ - "\n\nPyKDE -- Python bindings\n\tfor KDE") - dlg.addContributor ("PyKDE list", "pytde@mats.gmd.de", TQString.null, TQString.null) + "\n\nPyTDE -- Python bindings\n\tfor TDE") + dlg.addContributor ("PyTDE list", "pytde@mats.gmd.de", TQString.null, TQString.null) dlg.show () @@ -189,8 +184,8 @@ def dlgKKeyDialog (parent): def dlgKLineEditDlg (parent): result, ok = KLineEditDlg.getText ("Enter text", "<Your input here>", parent) - print "result", result - print "ok", ok + print("result", result) + print("ok", ok) # pop up another dlg to show what happened in the KLineEditDlg if ok: @@ -227,6 +222,6 @@ def dlgKWizard (parent): wiz.show () if __name__ == "__main__": - print - print "Please run uisampler.py" - print
\ No newline at end of file + print() + print("Please run uisampler.py") + print() diff --git a/examples/uimodules/uimenus.py b/examples/uimodules/uimenus.py index bec0c0f..025663a 100644 --- a/examples/uimodules/uimenus.py +++ b/examples/uimodules/uimenus.py @@ -103,6 +103,6 @@ def menuKWindowListMenu (parent): if __name__ == "__main__": - print - print "Please run uisampler.py" - print
\ No newline at end of file + print() + print("Please run uisampler.py") + print() diff --git a/examples/uimodules/uimisc.py b/examples/uimodules/uimisc.py index c922fb1..4536092 100644 --- a/examples/uimodules/uimisc.py +++ b/examples/uimodules/uimisc.py @@ -234,6 +234,6 @@ def miscQXEmbed (parent): parent.currentPageObj = PageNotImpl (parent) if __name__ == "__main__": - print - print "Please run uisampler.py" - print
\ No newline at end of file + print() + print("Please run uisampler.py") + print() diff --git a/examples/uimodules/uiwidgets.py b/examples/uimodules/uiwidgets.py index 790f855..106a559 100644 --- a/examples/uimodules/uiwidgets.py +++ b/examples/uimodules/uiwidgets.py @@ -1,7 +1,7 @@ import time, sys -from PyTQt.qt import TQLabel, TQFrame, TQColor, TQPushButton, SIGNAL, TQButtonGroup, TQRadioButton, TQt, TQString, TQChar,\ - TQWidget, TQTimer +from PyTQt.qt import TQLabel, TQFrame, TQColor, TQPushButton, SIGNAL, TQButtonGroup, TQRadioButton, \ + TQt, TQString, TQChar, TQWidget, TQTimer from tdecore import TDEApplication from tdeui import KEdit, KComboBox, KColorCombo, KEditListBox, TDEListBox, KLineEdit, KRestrictedLine,\ @@ -12,10 +12,6 @@ from tdeui import KEdit, KComboBox, KColorCombo, KEditListBox, TDEListBox, KLine KIntNumInput, KDoubleNumInput, KPasswordEdit, KURLLabel, KPaletteTable,\ KSeparator -if sys.version [:6] < "2.2.2": - False = 0 - True = 1 - class Page1: def __init__ (self, parent): self.page = parent.addPage () @@ -350,7 +346,7 @@ class Page5: urlLbl.setGeometry (x, y, 100, 20) urlLbl.show () - url = KURLLabel ("http://riverbankcomputing.co.uk", "PyKDE", self.page) + url = KURLLabel ("http://riverbankcomputing.co.uk", "PyTDE", self.page) url.setGeometry (x, y + 20, 100, 20) url.setUseTips (True) url.setTipText ("http://riverbankcomputing.co.uk") @@ -749,6 +745,6 @@ def widKURLLabel (parent): if __name__ == "__main__": - print - print "Please run uisampler.py" - print
\ No newline at end of file + print() + print("Please run uisampler.py") + print() diff --git a/examples/uiqxembed.py b/examples/uiqxembed.py index 341cc3a..21e31da 100644 --- a/examples/uiqxembed.py +++ b/examples/uiqxembed.py @@ -69,7 +69,7 @@ class ExampleForm(QXEmbedExample): self.launchPid = pid ## cheap TQTimer.singleShot(2000, self.embedLaunchedWindow) else: - print 'failed to start %s' % name + print('failed to start %s' % name) return def embedLaunchedWindow(self): @@ -101,16 +101,16 @@ class ExampleMain(TDEMainWindow): if __name__ == '__main__': - aname = 'PyKDE QXEmbed Sample' - desc = 'A Simple PyKDE QXEmbed Sample' - ver = '1.0' + aname = b'PyTDE QXEmbed Sample' + desc = b'A Simple PyTDE QXEmbed Sample' + ver = b'1.0' lic = TDEAboutData.License_GPL - author = 'Troy Melhase' - authormail = 'troy@gci.net' + author = b'Troy Melhase' + authormail = b'troy@gci.net' - about = TDEAboutData(aname, aname, ver, desc, lic, '%s (c) 2004' % authormail) - about.addAuthor(author, 'hi, mom!', authormail) - about.addAuthor ('Jim Bublitz', 'For PyKDE', 'jbublitz@nwinternet.com') + about = TDEAboutData(aname, aname, ver, desc, lic, b'troy@gci.net (c) 2004') + about.addAuthor(author, b'hi, mom!', authormail) + about.addAuthor (b'Jim Bublitz', b'For PyTDE', b'jbublitz@nwinternet.com') TDECmdLineArgs.init(sys.argv, about) app = TDEApplication() mainWindow = ExampleMain() diff --git a/examples/uisampler.py b/examples/uisampler.py index 3465f02..76bff2a 100644 --- a/examples/uisampler.py +++ b/examples/uisampler.py @@ -12,9 +12,6 @@ from uimenus import * from uixml import * from uimisc import * -False = 0 -True = not False - listItems = {"Dialogs": {"TDEAboutDialog": ["TDEAboutApplication", "TDEAboutContainer", "KImageTrackLabel",\ "TDEAboutContainerBase", "TDEAboutContributor", "TDEAboutWidget"],\ @@ -125,7 +122,7 @@ prefix = {"Dialogs": "dlg", "Widgets": "wid", "XML": "xml", "Menus/Toolbars": "m mainGeom = TQRect (0, 0, 640, 500) treeWidth = 220 -blankMsg = """ UISampler - provides examples of PyKDE widgets +blankMsg = """ UISampler - provides examples of PyTDE widgets Select a dialog/widget/menu/etc example from the tree at left """ @@ -133,9 +130,9 @@ Select a dialog/widget/menu/etc example from the tree at left class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(*(self,) + args) - self.setCaption ("Samples of PyKDE widget usage") + self.setCaption ("Samples of PyTDE widget usage") self.setGeometry (mainGeom) # create the main view - list view on the left and an @@ -174,10 +171,10 @@ class MainWin (TDEMainWindow): self.mainView.setSizes ([treeWidth, 375]) self.tree.setRootIsDecorated (True) self.tree.setVScrollBarMode (TQScrollView.AlwaysOn) - topLevel = listItems.keys () + topLevel = list(listItems.keys ()) for item_1 in topLevel: parent = TQListViewItem (self.tree, item_1) - secondLevel = listItems [item_1].keys () + secondLevel = list(listItems [item_1].keys ()) for item_2 in secondLevel: child = TQListViewItem (parent, item_2) for item_3 in listItems [item_1][item_2]: @@ -187,11 +184,11 @@ class MainWin (TDEMainWindow): if not lvItem: return - if lvItem.text (0).latin1 () in listItems.keys (): + if lvItem.text (0).latin1 () in list(listItems.keys ()): return p = lvItem.parent () - if p.text (0).latin1 () in listItems.keys (): + if p.text (0).latin1 () in list(listItems.keys ()): pfx = prefix [p.text (0).latin1 ()] funcCall = pfx + lvItem.text (0).latin1 () + "(self)" else: @@ -219,9 +216,9 @@ class MainWin (TDEMainWindow): #-------------------- main ------------------------------------------------ -appName = "UISampler" +appName = b"UISampler" app = TDEApplication (sys.argv, appName) -mainWindow = MainWin (None, "main window") +mainWindow = MainWin (None, b"main window") mainWindow.show() app.exec_loop() diff --git a/examples/uitdemdi.py b/examples/uitdemdi.py index 144d7f0..5e3509a 100644 --- a/examples/uitdemdi.py +++ b/examples/uitdemdi.py @@ -35,7 +35,7 @@ from tdeui import KDockWidget, TDEListBox, KStdAction try: from tdemdi import KMdi, KMdiMainFrm, KMdiChildView except (ImportError, ): - print 'Exception importing KMDI; check your PyKDE installation' + print('Exception importing KMDI; check your PyTDE installation') sys.exit(1) @@ -186,16 +186,16 @@ class KmdiExample(KMdiMainFrm): if __name__ == '__main__': - aname = 'PyKDE KMDI Sample' - desc = 'A Simple PyKDE KMDI Sample' - ver = '1.0' + aname = b'PyTDE KMDI Sample' + desc = b'A Simple PyTDE KMDI Sample' + ver = b'1.0' lic = TDEAboutData.License_GPL - author = 'Troy Melhase' - authormail = 'troy@gci.net' + author = b'Troy Melhase' + authormail = b'troy@gci.net' - about = TDEAboutData(aname, aname, ver, desc, lic, '%s (c) 2004' % authormail) - about.addAuthor(author, 'hi, mom!', authormail) - about.addAuthor ('Jim Bublitz', 'For PyKDE', 'jbublitz@nwinternet.com') + about = TDEAboutData(aname, aname, ver, desc, lic, b'troy@gci.net (c) 2004') + about.addAuthor(author, b'hi, mom!', authormail) + about.addAuthor (b'Jim Bublitz', b'For PyTDE', b'jbublitz@nwinternet.com') TDECmdLineArgs.init(sys.argv, about) app = TDEApplication() mainWindow = KmdiExample() diff --git a/examples/xmlmenudemo.py b/examples/xmlmenudemo.py index 9eacb37..ce92bd3 100644 --- a/examples/xmlmenudemo.py +++ b/examples/xmlmenudemo.py @@ -1,6 +1,6 @@ """ This template constructs an application with menus, toolbar and statusbar. -It uses KDE classes and methods that simplify the task of building and +It uses TDE classes and methods that simplify the task of building and operating a GUI. It is recommended that this approach be used, rather than the primitive approach in menuapp1.py """ @@ -35,10 +35,6 @@ copyright holder. """ -False = 0 -True = not False - - import sys, os from PyTQt.qt import TQPopupMenu, SIGNAL, TQLabel, TQIconSet @@ -53,7 +49,7 @@ STATUSBAR_RIGHT = 3 class MainWin (TDEMainWindow): def __init__ (self, *args): - apply (TDEMainWindow.__init__, (self,) + args) + TDEMainWindow.__init__(self, *args) self.initActions () self.setGeometry (0, 0, 350, 200) @@ -143,8 +139,8 @@ class MainWin (TDEMainWindow): # By using KStdAction here, the XMLGUI mechanism will automatically # create a 'View' menu and insert "Zoom In" and "Zoom Out" objects # in it. This happens because before parsing our *ui.rc file, - # the standard KDE file config/ui/ui_standards.rc is parsed, and - # then our *ui.rc file is merged with the result - this gives KDE + # the standard TDE file config/ui/ui_standards.rc is parsed, and + # then our *ui.rc file is merged with the result - this gives TDE # menus and toolBars a standard "look" and item placement (including # separators). Creating the KStdActions alone is sufficient - you # could delete their references from the *ui.rc file and the menu @@ -268,24 +264,23 @@ class MainWin (TDEMainWindow): #-------------------- main ------------------------------------------------ -description = "A basic application template" -version = "1.0" - +description = b"A basic application template" +version = b"1.0" # The appName (xmlmenudemo - first argument) is required # if the program is to automatically locate it *ui.rc file -aboutData = TDEAboutData ("xmlmenudemo", "xmlmenudemo",\ +aboutData = TDEAboutData (b"xmlmenudemo", b"xmlmenudemo",\ 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") mainpath = os.path.dirname (os.path.abspath (sys.argv[0])) -TDECmdLineArgs.init (sys.argv, aboutData) -TDECmdLineArgs.addCmdLineOptions ([("+files", "File to open")]) +TDECmdLineArgs.init (sys.argv, aboutData) +TDECmdLineArgs.addCmdLineOptions ([(b"+files", b"File to open")]) app = TDEApplication () -mainWindow = MainWin (None, "main window") +mainWindow = MainWin (None, b"main window") mainWindow.show() app.exec_loop() |