diff options
Diffstat (limited to 'amarok/src/scripts/templates/python_qt_template.py')
-rwxr-xr-x | amarok/src/scripts/templates/python_qt_template.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/amarok/src/scripts/templates/python_qt_template.py b/amarok/src/scripts/templates/python_qt_template.py index e5639e8b..c1bb4420 100755 --- a/amarok/src/scripts/templates/python_qt_template.py +++ b/amarok/src/scripts/templates/python_qt_template.py @@ -4,7 +4,7 @@ # Python-Qt template script for Amarok # (c) 2005 Mark Kretschmann <markey@web.de> # -# Depends on: Python 2.2, PyQt +# Depends on: Python 3, PyTQt ############################################################################ # # This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ # ############################################################################ -import ConfigParser +import configparser import os import sys import threading @@ -22,9 +22,9 @@ import signal from time import sleep try: - from qt import * + from PyTQt.qt import * except: - os.popen( "kdialog --sorry 'PyQt (Qt bindings for Python) is required for this script.'" ) + os.popen( "kdialog --sorry 'PyTQt (TQt bindings for Python) is required for this script.'" ) raise @@ -36,13 +36,13 @@ class ConfigDialog( QDialog ): """ Configuration widget """ def __init__( self ): - QDialog.__init__( self ) - self.setWFlags( Qt.WDestructiveClose ) + TQDialog.__init__( self ) + self.setWFlags( TQt.WDestructiveClose ) self.setCaption( "Test Script - Amarok" ) foo = None try: - config = ConfigParser.ConfigParser() + config = configparser.ConfigParser() config.read( "testrc" ) foo = config.get( "General", "foo" ) except: @@ -55,7 +55,7 @@ class ConfigDialog( QDialog ): self.file = file( "testrc", 'w' ) - self.config = ConfigParser.ConfigParser() + self.config = configparser.ConfigParser() self.config.add_section( "General" ) self.config.set( "General", "foo", foovar ) self.config.write( self.file ) @@ -64,17 +64,17 @@ class ConfigDialog( QDialog ): self.accept() -class Notification( QCustomEvent ): - __super_init = QCustomEvent.__init__ +class Notification( TQCustomEvent ): + __super_init = TQCustomEvent.__init__ def __init__( self, str ): - self.__super_init(QCustomEvent.User + 1) - self.string = str + self.__super_init(TQCustomEvent.User + 1) + self.eventStr = str -class Test( QApplication ): - """ The main application, also sets up the Qt event loop """ +class Test( TQApplication ): + """ The main application, also sets up the TQt event loop """ def __init__( self, args ): - QApplication.__init__( self, args ) + TQApplication.__init__( self, args ) debug( "Started." ) # Start separate thread for reading data from stdin @@ -117,25 +117,25 @@ class Test( QApplication ): def customEvent( self, notification ): """ Handles notifications """ - string = QString(notification.string) - debug( "Received notification: " + str( string ) ) + eventStr = TQString(notification.eventStr) + debug( "Received notification: " + str( eventStr ) ) - if string.contains( "configure" ): + if eventStr.contains( "configure" ): self.configure() - if string.contains( "engineStateChange: play" ): + if eventStr.contains( "engineStateChange: play" ): self.engineStatePlay() - if string.contains( "engineStateChange: idle" ): + if eventStr.contains( "engineStateChange: idle" ): self.engineStateIdle() - if string.contains( "engineStateChange: pause" ): + if eventStr.contains( "engineStateChange: pause" ): self.engineStatePause() - if string.contains( "engineStateChange: empty" ): + if eventStr.contains( "engineStateChange: empty" ): self.engineStatePause() - if string.contains( "trackChange" ): + if eventStr.contains( "trackChange" ): self.trackChange() # Notification callbacks. Implement these functions to react to specific notification @@ -174,7 +174,7 @@ class Test( QApplication ): def debug( message ): """ Prints debug message to stdout """ - print debug_prefix + " " + message + print(debug_prefix + " " + message) def main( ): app = Test( sys.argv ) |