summaryrefslogtreecommitdiffstats
path: root/examples2
diff options
context:
space:
mode:
Diffstat (limited to 'examples2')
-rwxr-xr-xexamples2/aclock.py2
-rwxr-xr-xexamples2/addressbook.py2
-rwxr-xr-xexamples2/application.py2
-rwxr-xr-xexamples2/buttongroups.py2
-rwxr-xr-xexamples2/dclock.py2
-rwxr-xr-xexamples2/desktop.py16
-rwxr-xr-xexamples2/dirview.py2
-rw-r--r--examples2/dropsite.py6
-rwxr-xr-xexamples2/gears.py2
-rwxr-xr-xexamples2/menu.py2
-rw-r--r--examples2/secret.py2
-rwxr-xr-xexamples2/semaphore.py8
-rwxr-xr-xexamples2/splitter.py14
-rwxr-xr-xexamples2/table.py22
-rwxr-xr-xexamples2/tut10.py2
-rwxr-xr-xexamples2/tut11.py4
-rwxr-xr-xexamples2/tut12.py4
-rwxr-xr-xexamples2/tut13.py4
-rwxr-xr-xexamples2/tut14.py4
-rwxr-xr-xexamples2/tut8.py2
-rwxr-xr-xexamples2/tut9.py2
-rwxr-xr-xexamples2/widgets.py32
22 files changed, 69 insertions, 69 deletions
diff --git a/examples2/aclock.py b/examples2/aclock.py
index 3c04e20..66283ef 100755
--- a/examples2/aclock.py
+++ b/examples2/aclock.py
@@ -8,7 +8,7 @@ def TQMIN(x, y):
return x
class AnalogClock(TQWidget):
def __init__(self, *args):
- apply(TQWidget.__init__,(self,) + args)
+ TQWidget.__init__(*(self,) + args)
self.time = TQTime.currentTime()
internalTimer = TQTimer(self)
self.connect(internalTimer, SIGNAL("timeout()"), self.timeout)
diff --git a/examples2/addressbook.py b/examples2/addressbook.py
index 96746c0..14b5679 100755
--- a/examples2/addressbook.py
+++ b/examples2/addressbook.py
@@ -78,7 +78,7 @@ fileprint = [
class ABCentralWidget( TQWidget ):
def __init__( self, *args ):
- apply( TQWidget.__init__, (self, ) + args )
+ TQWidget.__init__(*(self, ) + args)
self.mainGrid = TQGridLayout( self, 2, 1, 5, 5 )
self.setupTabWidget()
diff --git a/examples2/application.py b/examples2/application.py
index 291231e..38a6cf5 100755
--- a/examples2/application.py
+++ b/examples2/application.py
@@ -179,7 +179,7 @@ class ApplicationWindow(TQMainWindow):
return
for l in f.readlines():
- self.e.append(string.rstrip(l))
+ self.e.append(l.rstrip())
f.close()
diff --git a/examples2/buttongroups.py b/examples2/buttongroups.py
index 88836c6..d3e0aaf 100755
--- a/examples2/buttongroups.py
+++ b/examples2/buttongroups.py
@@ -21,7 +21,7 @@ FALSE = 0
class ButtonsGroups( TQWidget ):
def __init__( self, *args ):
- apply( TQWidget.__init__, (self,) + args )
+ TQWidget.__init__(*(self,) + args)
# Create Widgets which allow easy layouting
self.vbox = TQVBoxLayout( self )
diff --git a/examples2/dclock.py b/examples2/dclock.py
index eb4e990..302d454 100755
--- a/examples2/dclock.py
+++ b/examples2/dclock.py
@@ -47,7 +47,7 @@ class DigitalClock(TQLCDNumber):
s[2] = ' '
if s[0] == '0':
s[0] = ' '
- s = string.join(s,'')
+ s = ''.join(s)
self.display(s)
a = TQApplication(sys.argv)
diff --git a/examples2/desktop.py b/examples2/desktop.py
index 049f39d..7f48159 100755
--- a/examples2/desktop.py
+++ b/examples2/desktop.py
@@ -26,7 +26,7 @@ maxcurves = 8
def poly():
d = TQApplication.desktop()
- d.setBackgroundColor(white)
+ d.setPaletteBackgroundColor(white)
xvel = [ 0 ] * 8
yvel = [ 0 ] * 8
head = 0
@@ -65,16 +65,16 @@ def poly():
y = y + yvel[i]
if x >= maxx:
x = maxx - (x - maxx + 1)
- xvel[i] = -velocity(i)
+ xvel[i] = -velocity(i)
if x <= minx:
x = minx + (minx - x + 1)
- xvel[i] = velocity(i)
+ xvel[i] = velocity(i)
if y >= maxy:
y = maxy - (y - maxy + 1)
- yvel[i] = -velocity(i)
+ yvel[i] = -velocity(i)
if y <= miny:
y = miny + (miny - y + 1)
- yvel[i] = velocity(i)
+ yvel[i] = velocity(i)
a[head].setPoint(i, x, y)
paint.end()
@@ -98,7 +98,7 @@ def rotate():
m = TQWMatrix()
m.rotate(i)
rpm = pm.xForm(m)
- d.setBackgroundPixmap(rpm)
+ d.setPaletteBackgroundPixmap(rpm)
d.update()
def generateStone(pm, c1, c2, c3):
@@ -142,7 +142,7 @@ class DesktopWidget(TQWidget):
if not self.pm:
self.pm = TQPixmap(64, 64)
generateStone(self.pm, c1, c2, c3)
- self.setBackgroundPixmap(self.pm)
+ self.setPaletteBackgroundPixmap(self.pm)
self.update()
br = self.fontMetrics().boundingRect(self.text)
offscreen = TQPixmap(br.width(), br.height())
@@ -186,7 +186,7 @@ def desktopText(s='Troll Tech'):
drawShadeText(p, -r.x()+border, -r.y()+border, s, c2, c3)
p.end()
- tqApp.desktop().setBackgroundPixmap(pm)
+ tqApp.desktop().setPaletteBackgroundPixmap(pm)
a = TQApplication(sys.argv)
if len(sys.argv) > 1:
diff --git a/examples2/dirview.py b/examples2/dirview.py
index 11e7eed..ef8bcd7 100755
--- a/examples2/dirview.py
+++ b/examples2/dirview.py
@@ -5,7 +5,7 @@ from python_tqt.qt import *
class Directory(TQListViewItem):
def __init__(self, parent, name=None):
- apply(TQListViewItem.__init__,(self,parent))
+ TQListViewItem.__init__(*(self,parent))
if isinstance(parent, TQListView):
self.p = None
self.f = '/'
diff --git a/examples2/dropsite.py b/examples2/dropsite.py
index 94b7e57..461b44e 100644
--- a/examples2/dropsite.py
+++ b/examples2/dropsite.py
@@ -49,15 +49,15 @@ class DropSite(TQLabel):
t += str(e.format( i ))
i += 1
self.emit(PYSIGNAL('message(TQString &)'), (TQString(t),))
- self.setBackgroundColor(TQt.white)
+ self.setPaletteBackgroundColor(TQt.white)
def dragLeaveEvent( self, TQDragLeaveEvent ):
# Give the user some feedback...
self.emit(PYSIGNAL('message(TQString &)'), (TQString(''),))
- self.setBackgroundColor(TQt.lightGray)
+ self.setPaletteBackgroundColor(TQt.lightGray)
def dropEvent( self, e ):
- self.setBackgroundColor(TQt.lightGray)
+ self.setPaletteBackgroundColor(TQt.lightGray)
# Try to decode to the data you understand...
str = TQString()
if ( TQTextDrag.decode( e, str ) ) :
diff --git a/examples2/gears.py b/examples2/gears.py
index 60f313c..54734cc 100755
--- a/examples2/gears.py
+++ b/examples2/gears.py
@@ -227,7 +227,7 @@ if __name__=='__main__':
app=TQApplication(sys.argv)
if not TQGLFormat.hasOpenGL():
- raise 'No TQt OpenGL support.'
+ raise Exception('No TQt OpenGL support.')
widget=GearWidget()
app.setMainWidget(widget)
diff --git a/examples2/menu.py b/examples2/menu.py
index 4b67156..28e5a88 100755
--- a/examples2/menu.py
+++ b/examples2/menu.py
@@ -133,7 +133,7 @@ p4_xpm = [
class MenuExample( TQWidget ):
def __init__( self, parent=None, name=None ):
- apply( TQWidget.__init__,(self, parent, name) )
+ TQWidget.__init__(*(self, parent, name))
self.p1 = TQIconSet( TQPixmap ( p1_xpm ) )
self.p2 = TQIconSet( TQPixmap ( p2_xpm ) )
self.p3 = TQIconSet( TQPixmap ( p3_xpm ) )
diff --git a/examples2/secret.py b/examples2/secret.py
index 8c8de85..d68bd1b 100644
--- a/examples2/secret.py
+++ b/examples2/secret.py
@@ -52,7 +52,7 @@ picture_xpm = [
class SecretSource(TQLabel):
def __init__(self, secret, parent=None, name=None):
TQLabel.__init__(self, "Secret", parent, name)
- self.setBackgroundColor( TQt.blue.light() )
+ self.setPaletteBackgroundColor( TQt.blue.light() )
self.setFrameStyle( TQLabel.Box | TQLabel.Sunken )
self.setMinimumHeight( self.sizeHint().height()*2 )
self.setAlignment( TQLabel.AlignCenter )
diff --git a/examples2/semaphore.py b/examples2/semaphore.py
index 6a16347..f1a2b7a 100755
--- a/examples2/semaphore.py
+++ b/examples2/semaphore.py
@@ -9,7 +9,7 @@ import sys
try:
from python_tqt.qt import TQThread
except:
- print "Thread support not enabled"
+ print("Thread support not enabled")
sys.exit(1)
from python_tqt.qt import *
@@ -176,9 +176,9 @@ class SemaphoreExample(TQWidget):
self.mlineedit.append(s)
if s.latin1() == "Green!":
- self.label.setBackgroundColor(TQt.green)
+ self.label.setPaletteBackgroundColor(TQt.green)
else:
- self.label.setBackgroundColor(TQt.yellow)
+ self.label.setPaletteBackgroundColor(TQt.yellow)
self.label.setText(s)
@@ -192,7 +192,7 @@ class SemaphoreExample(TQWidget):
del s
else:
- print "Unknown custom event type:", event.type()
+ print("Unknown custom event type:", event.type())
app = TQApplication(sys.argv)
diff --git a/examples2/splitter.py b/examples2/splitter.py
index 36a7556..3d7450c 100755
--- a/examples2/splitter.py
+++ b/examples2/splitter.py
@@ -16,13 +16,13 @@ class Test(TQWidget):
y1 = 0
y2 = self.height() - 1
- x = (x1+x2)/2
+ x = int((x1+x2)/2)
p.drawLine(x, y1, x+d, y1+d)
p.drawLine(x, y1, x-d, y1+d)
p.drawLine(x, y2, x+d, y2-d)
p.drawLine(x, y2, x-d, y2-d)
- y = (y1+y2)/2
+ y = int((y1+y2)/2)
p.drawLine(x1, y, x1+d, y+d)
p.drawLine(x1, y, x1+d, y-d)
p.drawLine(x2, y, x2-d, y+d)
@@ -36,25 +36,25 @@ if __name__=="__main__":
s2 = TQSplitter(TQt.Horizontal, s1, "top")
t1 = Test(s2)
- t1.setBackgroundColor(TQt.blue.light(180))
+ t1.setPaletteBackgroundColor(TQt.blue.light(180))
t1.setMinimumSize(50,0)
t2 = Test(s2)
- t2.setBackgroundColor(TQt.green.light(180))
+ t2.setPaletteBackgroundColor(TQt.green.light(180))
s2.setResizeMode(t2, TQSplitter.KeepSize)
s2.moveToFirst(t2)
s3 = TQSplitter(TQt.Horizontal, s1, "bottom")
t3 = Test(s3)
- t3.setBackgroundColor(TQt.red)
+ t3.setPaletteBackgroundColor(TQt.red)
t4 = Test(s3)
- t4.setBackgroundColor(TQt.white)
+ t4.setPaletteBackgroundColor(TQt.white)
t5 = Test(s3)
t5.setMaximumHeight(250)
t5.setMinimumSize(80,50)
- t5.setBackgroundColor(TQt.yellow)
+ t5.setPaletteBackgroundColor(TQt.yellow)
s1.setOpaqueResize(1)
s2.setOpaqueResize(1)
diff --git a/examples2/table.py b/examples2/table.py
index 36e2cf9..f9db886 100755
--- a/examples2/table.py
+++ b/examples2/table.py
@@ -14,8 +14,8 @@ class Table(TQTableView):
self.setCellWidth(100)
self.setCellHeight(30)
self.setTableFlags(Tbl_vScrollBar |
- Tbl_hScrollBar |
- Tbl_clipCellPainting)
+ Tbl_hScrollBar |
+ Tbl_clipCellPainting)
self.resize(400,200)
self.contents = [''] * (numRows * numCols)
@@ -64,27 +64,27 @@ class Table(TQTableView):
if key == Key_Left:
if self.curCol > 0:
self.curCol = self.curCol - 1
- edge = self.leftCell()
+ edge = self.leftCell()
if self.curCol < edge:
- self.setLeftCell(edge-1)
+ self.setLeftCell(edge-1)
elif key == Key_Right:
if self.curCol < self.numCols()-1:
self.curCol = self.curCol + 1
- edge = self.lastColVisible()
+ edge = self.lastColVisible()
if self.curCol >= edge:
- self.setLeftCell(self.leftCell()+1)
+ self.setLeftCell(self.leftCell()+1)
elif key == Key_Up:
if self.curRow > 0:
self.curRow = self.curRow - 1
- edge = self.topCell()
+ edge = self.topCell()
if self.curRow < edge:
- self.setTopCell(edge-1)
+ self.setTopCell(edge-1)
elif key == Key_Down:
if self.curRow < self.numRows()-1:
self.curRow = self.curRow + 1
- edge = self.lastRowVisible()
- if self.curRow >= edge:
- self.setTopCell(self.topCell()+1)
+ edge = self.lastRowVisible()
+ if self.curRow >= edge:
+ self.setTopCell(self.topCell()+1)
else:
ke.ignore()
return
diff --git a/examples2/tut10.py b/examples2/tut10.py
index b6213a5..a19ba9c 100755
--- a/examples2/tut10.py
+++ b/examples2/tut10.py
@@ -27,7 +27,7 @@ class LCDRange(TQVBox):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
diff --git a/examples2/tut11.py b/examples2/tut11.py
index 0f60d72..7979d3d 100755
--- a/examples2/tut11.py
+++ b/examples2/tut11.py
@@ -28,7 +28,7 @@ class LCDRange(TQVBox):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
@@ -149,7 +149,7 @@ class CannonField(TQWidget):
y = y0 + vely * time - 0.5 * gravity * time * time
r = TQRect(0,0,6,6)
- r.moveCenter(TQPoint(x,self.height() - 1 - y))
+ r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y))))
return r
def sizePolicy(self):
diff --git a/examples2/tut12.py b/examples2/tut12.py
index 95f90b1..8b2a700 100755
--- a/examples2/tut12.py
+++ b/examples2/tut12.py
@@ -36,7 +36,7 @@ class LCDRange(TQVBox):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
def text(self):
@@ -183,7 +183,7 @@ class CannonField(TQWidget):
y = y0 + vely * time - 0.5 * gravity * time * time
r = TQRect(0,0,6,6)
- r.moveCenter(TQPoint(x,self.height() - 1 - y))
+ r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y)))
return r
def targetRect(self):
diff --git a/examples2/tut13.py b/examples2/tut13.py
index 1584443..f33c683 100755
--- a/examples2/tut13.py
+++ b/examples2/tut13.py
@@ -41,7 +41,7 @@ class LCDRange(TQWidget):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
def text(self):
@@ -215,7 +215,7 @@ class CannonField(TQWidget):
y = y0 + vely * time - 0.5 * gravity * time * time
r = TQRect(0,0,6,6)
- r.moveCenter(TQPoint(x,self.height() - 1 - y))
+ r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y)))
return r
def targetRect(self):
diff --git a/examples2/tut14.py b/examples2/tut14.py
index 1ee3a5c..998f26f 100755
--- a/examples2/tut14.py
+++ b/examples2/tut14.py
@@ -41,7 +41,7 @@ class LCDRange(TQWidget):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
def text(self):
@@ -245,7 +245,7 @@ class CannonField(TQWidget):
y = y0 + vely * time - 0.5 * gravity * time * time
r = TQRect(0,0,6,6)
- r.moveCenter(TQPoint(x,self.height() - 1 - y))
+ r.moveCenter(TQPoint(int(x),int(self.height() - 1 - y)))
return r
def targetRect(self):
diff --git a/examples2/tut8.py b/examples2/tut8.py
index d252e55..3266a89 100755
--- a/examples2/tut8.py
+++ b/examples2/tut8.py
@@ -27,7 +27,7 @@ class LCDRange(TQVBox):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
diff --git a/examples2/tut9.py b/examples2/tut9.py
index 5bad8d8..c413e00 100755
--- a/examples2/tut9.py
+++ b/examples2/tut9.py
@@ -27,7 +27,7 @@ class LCDRange(TQVBox):
def setRange(self,minVal,maxVal):
if minVal < 0 or maxVal > 99 or minVal > maxVal:
- raise ValueError, 'LCDRange.setRange(): invalid range'
+ raise ValueError('LCDRange.setRange(): invalid range')
self.slider.setRange(minVal,maxVal)
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 + "<no name>"
- # 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
################################################################################################