summaryrefslogtreecommitdiffstats
path: root/examples/pytde-sampler/sampler.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pytde-sampler/sampler.py')
-rwxr-xr-xexamples/pytde-sampler/sampler.py33
1 files changed, 19 insertions, 14 deletions
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'))