From 6be046642290c28c17949022fb66ae02ac21d544 Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Tue, 19 Apr 2022 13:21:52 +0000 Subject: Updates to support Python version 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amendments to the sip source and configuration/build scripts to allow for support under Python version 3. The examples have been updated using "2to3" along with some manual changes to sort out intentation and casting to integer from float. Signed-off-by: aneejit1 Signed-off-by: Slávek Banko --- examples2/widgets.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'examples2/widgets.py') diff --git a/examples2/widgets.py b/examples2/widgets.py index fc36e7a..cf235a8 100755 --- a/examples2/widgets.py +++ b/examples2/widgets.py @@ -18,7 +18,7 @@ def TQMIN( x, y ): class AnalogClock( TQWidget ): def __init__( self, *args ): - apply( TQWidget.__init__, (self,) + args ) + TQWidget.__init__(*(self,) + args) self.time = TQTime.currentTime() # get current time internalTimer = TQTimer( self ) # create internal timer self.connect( internalTimer, SIGNAL("timeout()"), self.timeout ) @@ -74,7 +74,7 @@ class AnalogClock( TQWidget ): class DigitalClock( TQLCDNumber ): def __init__( self, *args ): - apply( TQLCDNumber.__init__,(self,) + args ) + TQLCDNumber.__init__(*(self,) + args) self.showingColon = 0 self.setFrameStyle(TQFrame.Panel | TQFrame.Raised) self.setLineWidth( 2 ) @@ -112,7 +112,7 @@ class DigitalClock( TQLCDNumber ): s[2] = ' ' if s[0] == '0': s[0] = ' ' - s = string.join(s,'') + s = ''.join(s) self.display( s ) def TQMIN( x, y ): @@ -130,7 +130,7 @@ MOVIEFILENAME = "trolltech.gif" class WidgetView ( TQWidget ): def __init__( self, *args ): - apply( TQWidget.__init__, (self,) + args ) + TQWidget.__init__(*(self,) + args) # Set the window caption/title self.setCaption( "TQt Widgets Demo Application" ) @@ -186,14 +186,14 @@ class WidgetView ( TQWidget ): TQToolTip.add( self.dclock, "custom widget: digital clock" ) # Create a push button. - self.pb = TQPushButton( self, "button1" ) # create button 1 + self.pb = TQPushButton( self, "button1" ) # create button 1 self.pb.setText( "Push button 1" ) self.pb.setFixedHeight( self.pb.sizeHint().height() ) self.grid.addWidget( self.pb, 0, 0, TQt.AlignVCenter ) self.connect( self.pb, SIGNAL("clicked()"), self.button1Clicked ) TQToolTip.add( self.pb, "push button 1" ) self.pm = TQPixmap() - self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2 + self.pix = self.pm.load( "qt.png" ) # load pixmap for button 2 if not self.pix: TQMessageBox.information( None, "TQt Widgets Example", "Could not load the file \"qt.png\", which\n" @@ -224,7 +224,7 @@ class WidgetView ( TQWidget ): self.vbox.addSpacing( self.bg.fontMetrics().height() ) - self.cb = range(3) + self.cb = list(range(3)) self.cb[0] = TQCheckBox( self.bg ) self.cb[0].setText( "Read" ) self.vbox.addWidget( self.cb[0] ) @@ -466,20 +466,20 @@ class WidgetView ( TQWidget ): self.msg.setText( txt ) if index == 0: TQApplication.setWinStyleHighlightColor( TQt.darkBlue ) - elif index == 1: + elif index == 1: TQApplication.setWinStyleHighlightColor( TQt.darkRed ) - elif index == 2: + elif index == 2: TQApplication.setWinStyleHighlightColor( TQt.darkGreen ) - elif index == 3: + elif index == 3: TQApplication.setWinStyleHighlightColor( TQt.blue ) - elif index == 4: + elif index == 4: TQApplication.setWinStyleHighlightColor( TQt.red ) def lineEditTextChanged( self, newText ): - self.msg.setText("Line edit text: " + unicode(newText)) + self.msg.setText("Line edit text: " + str(newText)) def spinBoxValueChanged( self, valueText ): - self.msg.setText("Spin box value: " + unicode(valueText)) + self.msg.setText("Spin box value: " + str(valueText)) # All application events are passed throught this event filter. # We're using it to display some information about a clicked @@ -496,10 +496,10 @@ class WidgetView ( TQWidget ): # txt = txt + TQObject.name() # else: # txt = txt + "" - # identify_now = FALSE # don't do it in message box + # identify_now = FALSE # don't do it in message box # TQMessageBox.message( "Identify Widget", txt, 0, TQObject ) - # identify_now = TRUE; # allow it again - # return FALSE # don't eat event + # identify_now = TRUE; # allow it again + # return FALSE # don't eat event ################################################################################################ -- cgit v1.2.1