diff options
Diffstat (limited to 'examples')
69 files changed, 501 insertions, 501 deletions
diff --git a/examples/SQL/README b/examples/SQL/README index 862e608..823937f 100644 --- a/examples/SQL/README +++ b/examples/SQL/README @@ -2,11 +2,11 @@ This directory contains some translated sql examples from TQt 3.x. runform1.py, form1.ui: - A simple designer generated TQDataTable. Run "pyuic form1.ui -o form1.py". + A simple designer generated TQDataTable. Run "pytquic form1.ui -o form1.py". runform2.py, form2.ui: - A simple designer generated TQDataBrowser. Run "pyuic form2.ui -o form2.py". + A simple designer generated TQDataBrowser. Run "pytquic form2.ui -o form2.py". sqlcustom1.py: diff --git a/examples/SQL/connect.ui.h b/examples/SQL/connect.ui.h index 1e9f544..fd37494 100644 --- a/examples/SQL/connect.ui.h +++ b/examples/SQL/connect.ui.h @@ -9,7 +9,7 @@ void ConnectDialog::init() { -from PyTQt.qtsql import TQSqlDatabase +from PyTQt.tqtsql import TQSqlDatabase #qDebug("ConnectDialog init") self.comboDriver.clear() self.comboDriver.insertStringList(TQSqlDatabase.drivers()) diff --git a/examples/SQL/dbconnect.py b/examples/SQL/dbconnect.py index 2fb2b08..75887e6 100755 --- a/examples/SQL/dbconnect.py +++ b/examples/SQL/dbconnect.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * -from PyTQt.qtsql import * +from PyTQt.tqt import * +from PyTQt.tqtsql import * from frmconnect import frmConnect from dbpar import * @@ -12,7 +12,7 @@ FALSE = 0 def createConnection(): driver = DB_DRIVER - # all qt examples use TQSqlDatabase::addDatabase, but + # all tqt examples use TQSqlDatabase::addDatabase, but # this never returns NULL in my experience drivers = list(map(str, TQSqlDatabase.drivers())) if driver in drivers: diff --git a/examples/SQL/frmconnect.py b/examples/SQL/frmconnect.py index 0fec45f..430f5b2 100644 --- a/examples/SQL/frmconnect.py +++ b/examples/SQL/frmconnect.py @@ -1,12 +1,12 @@ # Form implementation generated from reading ui file 'frmconnect.ui' # # Created: Sam Jul 6 12:47:10 2002 -# by: The PyTQt User Interface Compiler (pyuic) +# by: The PyTQt User Interface Compiler (pytquic) # # WARNING! All changes made in this file will be lost! -from PyTQt.qt import * +from PyTQt.tqt import * class frmConnect(TQDialog): diff --git a/examples/SQL/runform1.py b/examples/SQL/runform1.py index 0724547..8ef4908 100755 --- a/examples/SQL/runform1.py +++ b/examples/SQL/runform1.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * +from PyTQt.tqt import * from form1 import Form1 from dbconnect import createConnection diff --git a/examples/SQL/runform2.py b/examples/SQL/runform2.py index 5644475..112d04f 100755 --- a/examples/SQL/runform2.py +++ b/examples/SQL/runform2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * +from PyTQt.tqt import * from form2 import Form2 from dbconnect import createConnection diff --git a/examples/SQL/runsqlex.py b/examples/SQL/runsqlex.py index ccdec9d..4f35e52 100755 --- a/examples/SQL/runsqlex.py +++ b/examples/SQL/runsqlex.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * -from PyTQt.qtsql import * +from PyTQt.tqt import * +from PyTQt.tqtsql import * from sqlex import SqlEx from connect import ConnectDialog diff --git a/examples/SQL/sqlcustom1.py b/examples/SQL/sqlcustom1.py index 1ea3471..0c37911 100755 --- a/examples/SQL/sqlcustom1.py +++ b/examples/SQL/sqlcustom1.py @@ -11,8 +11,8 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * -from PyTQt.qtsql import * +from PyTQt.tqt import * +from PyTQt.tqtsql import * from dbconnect import createConnection diff --git a/examples/SQL/sqlsubclass5.py b/examples/SQL/sqlsubclass5.py index a288099..d627a6c 100755 --- a/examples/SQL/sqlsubclass5.py +++ b/examples/SQL/sqlsubclass5.py @@ -11,8 +11,8 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * -from PyTQt.qtsql import * +from PyTQt.tqt import * +from PyTQt.tqtsql import * from dbconnect import createConnection diff --git a/examples/SQL/sqltable4.py b/examples/SQL/sqltable4.py index 75eddad..13bbe3f 100755 --- a/examples/SQL/sqltable4.py +++ b/examples/SQL/sqltable4.py @@ -11,8 +11,8 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * -from PyTQt.qtsql import * +from PyTQt.tqt import * +from PyTQt.tqtsql import * from dbconnect import createConnection diff --git a/examples/aclock.py b/examples/aclock.py index 23ef169..ca81eb3 100755 --- a/examples/aclock.py +++ b/examples/aclock.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * +from PyTQt.tqt import * def TQMIN(x, y): if y > x: return y @@ -19,7 +19,7 @@ class AnalogClock(TQWidget): if new_time.minute() != self.time.minute(): self.update() - def paintEvent(self, qe): + def paintEvent(self, tqe): if not self.isVisible(): return self.time = TQTime.currentTime() diff --git a/examples/addressbook.py b/examples/addressbook.py index 760a164..22683d4 100755 --- a/examples/addressbook.py +++ b/examples/addressbook.py @@ -4,7 +4,7 @@ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/application.py b/examples/application.py index 30747e0..6e8a638 100755 --- a/examples/application.py +++ b/examples/application.py @@ -4,7 +4,7 @@ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * fileopen = [ diff --git a/examples/biff.py b/examples/biff.py index 0fdc9f6..2d41184 100755 --- a/examples/biff.py +++ b/examples/biff.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import os, sys, string -from PyTQt.qt import * +from PyTQt.tqt import * if TQT_VERSION < 0x030100: diff --git a/examples/bigtable.py b/examples/bigtable.py index 85a0349..e3c47a9 100755 --- a/examples/bigtable.py +++ b/examples/bigtable.py @@ -12,8 +12,8 @@ import sys import os -from PyTQt.qt import * -from PyTQt.qttable import * +from PyTQt.tqt import * +from PyTQt.tqttable import * TRUE = 1 FALSE = 0 diff --git a/examples/buttongroups.py b/examples/buttongroups.py index 1fe595a..7b780c2 100755 --- a/examples/buttongroups.py +++ b/examples/buttongroups.py @@ -10,7 +10,7 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 @@ -118,7 +118,7 @@ a = TQApplication( sys.argv ) buttonsgroups = ButtonsGroups() buttonsgroups.resize( 500, 250 ) -buttonsgroups.setCaption( "PyQT Example - Buttons and Groups" ) +buttonsgroups.setCaption( "PyTQt Example - Buttons and Groups" ) a.setMainWidget( buttonsgroups ) buttonsgroups.show() diff --git a/examples/canvas/canvas.py b/examples/canvas/canvas.py index 3039cdb..50797e5 100755 --- a/examples/canvas/canvas.py +++ b/examples/canvas/canvas.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * -from PyTQt.qtcanvas import * +from PyTQt.tqt import * +from PyTQt.tqtcanvas import * import random @@ -124,7 +124,7 @@ class BouncyLogo(TQCanvasSprite): # Make sure the logo exists. global bouncy_logo if bouncy_logo is None: - bouncy_logo=TQCanvasPixmapArray("qt-trans.xpm") + bouncy_logo=TQCanvasPixmapArray("tqt-trans.xpm") TQCanvasSprite.__init__(self,None,canvas) self.setSequence(bouncy_logo) @@ -587,11 +587,11 @@ if __name__=='__main__': if len(sys.argv) > 2: logo_fn = TQString(sys.argv[2]) else: - logo_fn=TQString("qtlogo.png") + logo_fn=TQString("tqtlogo.png") canvas=TQCanvas(800,600) canvas.setAdvancePeriod(30) - m=Main(canvas,None,"pyqt canvas example") + m=Main(canvas,None,"pytqt canvas example") m.resize(m.sizeHint()) tqApp.setMainWidget(m) diff --git a/examples/canvas/qt-trans.xpm b/examples/canvas/tqt-trans.xpm index 225f684..225f684 100644 --- a/examples/canvas/qt-trans.xpm +++ b/examples/canvas/tqt-trans.xpm diff --git a/examples/canvas/qtlogo.png b/examples/canvas/tqtlogo.png Binary files differindex 96202de..96202de 100644 --- a/examples/canvas/qtlogo.png +++ b/examples/canvas/tqtlogo.png diff --git a/examples/checklists.py b/examples/checklists.py index 5249bb0..52b93e8 100755 --- a/examples/checklists.py +++ b/examples/checklists.py @@ -3,7 +3,7 @@ # Copyright (C) 2002 Oleksandr Yakovlyev (yshurik) <yshurik@thekompany.com> import sys -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/cursor.py b/examples/cursor.py index f6ef6ee..f4a0ca4 100755 --- a/examples/cursor.py +++ b/examples/cursor.py @@ -10,7 +10,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * # cb_bits and cm_bits were generated by X bitmap program. diff --git a/examples/dclock.py b/examples/dclock.py index 9be19eb..08fcafe 100755 --- a/examples/dclock.py +++ b/examples/dclock.py @@ -4,7 +4,7 @@ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * class DigitalClock(TQLCDNumber): diff --git a/examples/desktop.py b/examples/desktop.py index 909ab91..f695835 100755 --- a/examples/desktop.py +++ b/examples/desktop.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * +from PyTQt.tqt import * seed = 0.353535353535 KINDA_RAND_MAX = 32767 diff --git a/examples/dirview.py b/examples/dirview.py index d3c8b0e..a147f3c 100755 --- a/examples/dirview.py +++ b/examples/dirview.py @@ -12,7 +12,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * folder_closed_xpm = [ "16 16 9 1", diff --git a/examples/dragdrop.py b/examples/dragdrop.py index ae577be..439e92d 100755 --- a/examples/dragdrop.py +++ b/examples/dragdrop.py @@ -3,7 +3,7 @@ # Ported to PyTQt by Issac Trotts on Jan 1, 2002 import sys -from PyTQt.qt import * +from PyTQt.tqt import * import dropsite, secret diff --git a/examples/drawlines.py b/examples/drawlines.py index 75da388..8e1ac82 100755 --- a/examples/drawlines.py +++ b/examples/drawlines.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys, random -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/dropsite.py b/examples/dropsite.py index ee8fcfb..162081e 100644 --- a/examples/dropsite.py +++ b/examples/dropsite.py @@ -1,7 +1,7 @@ # This is part of the dragdrop example. -from PyTQt.qt import * +from PyTQt.tqt import * import secret @@ -23,7 +23,7 @@ class DropSite(TQLabel): drobj = TQTextDrag( self.text(), self ) drobj.dragCopy() - def backgroundColorChange( self, qcolor ): + def backgroundColorChange( self, tqcolor ): # Reduce flicker by using repaint() rather than update() self.repaint() diff --git a/examples/fontdisplayer.py b/examples/fontdisplayer.py index bbf53a5..381b4d0 100755 --- a/examples/fontdisplayer.py +++ b/examples/fontdisplayer.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * class FontRowTable( TQFrame ): def __init__( self, parent=None, name=None ): diff --git a/examples/fonts.py b/examples/fonts.py index 770778c..7cb3cd1 100755 --- a/examples/fonts.py +++ b/examples/fonts.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * class Viewer( TQWidget ): def __init__( self ): diff --git a/examples/gears.py b/examples/gears.py index 71d81c0..e7bef18 100755 --- a/examples/gears.py +++ b/examples/gears.py @@ -3,8 +3,8 @@ import sys import math -from PyTQt.qt import * -from PyTQt.qtgl import * +from PyTQt.tqt import * +from PyTQt.tqtgl import * from OpenGL.GL import * def gear(inner_radius,outer_radius,width,teeth,tooth_depth): diff --git a/examples/i18n/i18n.py b/examples/i18n/i18n.py index 03d7c0c..ba64098 100755 --- a/examples/i18n/i18n.py +++ b/examples/i18n/i18n.py @@ -5,7 +5,7 @@ from whrandom import randint import sys -from PyTQt.qt import * +from PyTQt.tqt import * from mywidget import MyWidget diff --git a/examples/i18n/mywidget.py b/examples/i18n/mywidget.py index 760f4f8..cf5abea 100644 --- a/examples/i18n/mywidget.py +++ b/examples/i18n/mywidget.py @@ -1,6 +1,6 @@ # Copyright (c) 2002 Detlev Offenbach <detlev@die-offenbachs.de> -from PyTQt.qt import * +from PyTQt.tqt import * class MyWidget(TQMainWindow): diff --git a/examples/lineedits.py b/examples/lineedits.py index b3248fe..fe566ba 100755 --- a/examples/lineedits.py +++ b/examples/lineedits.py @@ -11,7 +11,7 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/listbox.py b/examples/listbox.py index af142eb..d5bf2e1 100755 --- a/examples/listbox.py +++ b/examples/listbox.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * FALSE = 0 TRUE = 1 diff --git a/examples/listboxcombo.py b/examples/listboxcombo.py index c997dab..b6b546e 100755 --- a/examples/listboxcombo.py +++ b/examples/listboxcombo.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * FALSE = 0 TRUE = 1 @@ -34,7 +34,7 @@ class ListBoxCombo( TQVBox ): self.lb1.setSelectionMode( TQListBox.Multi ) # ...insert a pixmap item... - xpm = TQPixmap( "qtlogo.png" ) + xpm = TQPixmap( "tqtlogo.png" ) txt = TQString() TQListBoxPixmap( self.lb1, xpm, txt ) diff --git a/examples/mdi.py b/examples/mdi.py index daf750b..591a4eb 100755 --- a/examples/mdi.py +++ b/examples/mdi.py @@ -4,7 +4,7 @@ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * fileopen = [ diff --git a/examples/menu.py b/examples/menu.py index ab9146e..f363195 100755 --- a/examples/menu.py +++ b/examples/menu.py @@ -11,7 +11,7 @@ #*****************************************************************************/ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/progress.py b/examples/progress.py index e38e737..e2344cc 100755 --- a/examples/progress.py +++ b/examples/progress.py @@ -13,7 +13,7 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * +from PyTQt.tqt import * from random import randint class AnimatedThingy(TQLabel): diff --git a/examples/progressbar.py b/examples/progressbar.py index dbb6e4e..b507d08 100755 --- a/examples/progressbar.py +++ b/examples/progressbar.py @@ -12,7 +12,7 @@ #import pdb import sys -from PyTQt.qt import * +from PyTQt.tqt import * FALSE = 0 TRUE = 1 diff --git a/examples/rangecontrols.py b/examples/rangecontrols.py index f59d7fc..e7983e2 100755 --- a/examples/rangecontrols.py +++ b/examples/rangecontrols.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * INT_MAX = sys.maxsize diff --git a/examples/richtext.py b/examples/richtext.py index 3ae6e81..14728ab 100755 --- a/examples/richtext.py +++ b/examples/richtext.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * sayings = [ "<b>Saying 1:</b><br>" diff --git a/examples/secret.py b/examples/secret.py index f2f5a64..9d3f2d4 100644 --- a/examples/secret.py +++ b/examples/secret.py @@ -1,7 +1,7 @@ # This is part of the dragdrop example. -from PyTQt.qt import * +from PyTQt.tqt import * def canDecode(e): diff --git a/examples/semaphore.py b/examples/semaphore.py index ecf1209..99b9bc6 100755 --- a/examples/semaphore.py +++ b/examples/semaphore.py @@ -7,12 +7,12 @@ import sys # Check if thread support was enabled. try: - from PyTQt.qt import TQThread + from PyTQt.tqt import TQThread except: print("Thread support not enabled") sys.exit(1) -from PyTQt.qt import * +from PyTQt.tqt import * # The semaphore instances. diff --git a/examples/smalltable.py b/examples/smalltable.py index ccee6c8..e3521e1 100755 --- a/examples/smalltable.py +++ b/examples/smalltable.py @@ -12,8 +12,8 @@ import sys import os -from PyTQt.qt import * -from PyTQt.qttable import * +from PyTQt.tqt import * +from PyTQt.tqttable import * TRUE = 1 FALSE = 0 diff --git a/examples/splitter.py b/examples/splitter.py index 534e50e..935cf66 100755 --- a/examples/splitter.py +++ b/examples/splitter.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from PyTQt.qt import * +from PyTQt.tqt import * class Test(TQWidget): def __init__(self, parent=None, name='Test', f=0): diff --git a/examples/tabdialog.py b/examples/tabdialog.py index 2fcc050..05365ff 100755 --- a/examples/tabdialog.py +++ b/examples/tabdialog.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * class TabDialog( TQTabDialog ): def __init__( self, parent=None, name=None, filename=None ): diff --git a/examples/tablestatistics.py b/examples/tablestatistics.py index 1288ff0..dd3058d 100755 --- a/examples/tablestatistics.py +++ b/examples/tablestatistics.py @@ -12,8 +12,8 @@ import sys import os -from PyTQt.qt import * -from PyTQt.qttable import * +from PyTQt.tqt import * +from PyTQt.tqttable import * TRUE = 1 FALSE = 0 @@ -52,11 +52,11 @@ class Table(TQTable): def initTable(self): # read all the TQt source and header files into a list all = [] - qtdir = os.getenv("TQTDIR") - if qtdir is None: + tqtdir = os.getenv("TQTDIR") + if tqtdir is None: raise Exception("The TQTDIR environment variable has not been set.") for i in dirs: - dir = TQDir(os.path.join(qtdir, "src", i)) + dir = TQDir(os.path.join(tqtdir, "src", i)) lst = TQStringList(dir.entryList("*.cpp; *.h")) for f in lst: if f.contains("moc"): @@ -71,7 +71,7 @@ class Table(TQTable): # insert the data into the table for it in all: self.setText(i, TB_FILE, it) - f = TQFile(os.path.join(qtdir, "src", str(it))) + f = TQFile(os.path.join(tqtdir, "src", str(it))) self.setText(i, TB_SIZE, str(f.size())) ci = ComboItem(self, TQTableItem.WhenCurrent) self.setItem(i, TB_FLAG, ci) diff --git a/examples/tooltip.py b/examples/tooltip.py index b55e0d6..ed36888 100755 --- a/examples/tooltip.py +++ b/examples/tooltip.py @@ -11,7 +11,7 @@ ***************************************************************************""" import sys -from PyTQt.qt import * +from PyTQt.tqt import * from random import random class DynamicTip( TQToolTip ): diff --git a/examples/qdir.py b/examples/tqdir.py index c08e9bc..8ed9d5e 100755 --- a/examples/qdir.py +++ b/examples/tqdir.py @@ -5,7 +5,7 @@ from __future__ import print_function import os import pickle -from PyTQt.qt import * +from PyTQt.tqt import * from dirview import Directory, DirectoryView bookmarks = [ diff --git a/examples/qmag.py b/examples/tqmag.py index bad7ecf..df4a85d 100755 --- a/examples/qmag.py +++ b/examples/tqmag.py @@ -11,7 +11,7 @@ #*****************************************************************************/ import sys -from PyTQt.qt import * +from PyTQt.tqt import * TRUE = 1 FALSE = 0 diff --git a/examples/qt.png b/examples/tqt.png Binary files differindex d63e16f..d63e16f 100644 --- a/examples/qt.png +++ b/examples/tqt.png diff --git a/examples/qtlogo.png b/examples/tqtlogo.png Binary files differindex c83c7b2..c83c7b2 100644 --- a/examples/qtlogo.png +++ b/examples/tqtlogo.png diff --git a/examples/tut1.py b/examples/tut1.py index c38a1ff..0f3d9a1 100755 --- a/examples/tut1.py +++ b/examples/tut1.py @@ -3,12 +3,12 @@ # TQt tutorial 1. import sys -from PyTQt import qt +from PyTQt import tqt -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) -hello = qt.TQPushButton("Hello world!", None) +hello = tqt.TQPushButton("Hello world!", None) hello.resize(100, 30) a.setMainWidget(hello) diff --git a/examples/tut10.py b/examples/tut10.py index 6b21e47..507c979 100755 --- a/examples/tut10.py +++ b/examples/tut10.py @@ -3,19 +3,19 @@ # TQt tutorial 10. import sys -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) @@ -31,13 +31,13 @@ class LCDRange(qt.TQVBox): self.slider.setRange(minVal, maxVal) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 self.f = 0 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) def angle(self): return self.ang @@ -51,7 +51,7 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def force(self): return self.f @@ -62,46 +62,46 @@ class CannonField(qt.TQWidget): if self.f == newton: return self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + self.emit(tqt.PYSIGNAL("forceChanged(int)"), (self.f, )) def paintEvent(self, ev): if not ev.rect().intersects(self.cannonRect()): return cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) + pix = tqt.TQPixmap(cr.size()) pix.fill(self, cr.topLeft()) - p = qt.TQPainter(pix) + p = tqt.TQPainter(pix) - p.setBrush(qt.TQt.blue) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.blue) + p.setPen(tqt.TQt.NoPen) p.translate(0, pix.height() - 1) - p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + p.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) p.rotate(-self.ang) - p.drawRect(qt.TQRect(33, -4, 15, 8)) + p.drawRect(tqt.TQRect(33, -4, 15, 8)) p.end() p.begin(self) p.drawPixmap(cr.topLeft(), pix) def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) + r = tqt.TQRect(0, 0, 50, 50) r.moveBottomLeft(self.rect().bottomLeft()) return r def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange(self, "angle") self.angle.setRange(5, 70) @@ -111,19 +111,19 @@ class MyWidget(qt.TQWidget): self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + self.connect(self.force, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, tqt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) - leftBox = qt.TQVBoxLayout() + leftBox = tqt.TQVBoxLayout() grid.addLayout(leftBox, 1, 0) @@ -135,8 +135,8 @@ class MyWidget(qt.TQWidget): self.angle.setFocus() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 500, 355) diff --git a/examples/tut11.py b/examples/tut11.py index f5a9930..a71ff03 100755 --- a/examples/tut11.py +++ b/examples/tut11.py @@ -4,19 +4,19 @@ import sys import math -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) @@ -32,23 +32,23 @@ class LCDRange(qt.TQVBox): self.slider.setRange(minVal, maxVal) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 self.f = 0 self.timerCount = 0 - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + self.autoShootTimer = tqt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, tqt.SIGNAL("timeout()"), self.moveShot) self.shoot_ang = 0 self.shoot_f = 0 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) - self.barrelRect = qt.TQRect(33, -4, 15, 8) + self.barrelRect = tqt.TQRect(33, -4, 15, 8) def angle(self): return self.ang @@ -62,7 +62,7 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def force(self): return self.f @@ -73,7 +73,7 @@ class CannonField(qt.TQWidget): if self.f == newton: return self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + self.emit(tqt.PYSIGNAL("forceChanged(int)"), (self.f, )) def shoot(self): if self.autoShootTimer.isActive(): @@ -85,7 +85,7 @@ class CannonField(qt.TQWidget): self.autoShootTimer.start(50) def moveShot(self): - r = qt.TQRegion(self.shotRect()) + r = tqt.TQRegion(self.shotRect()) self.timerCount = self.timerCount + 1 shotR = self.shotRect() @@ -93,13 +93,13 @@ class CannonField(qt.TQWidget): if shotR.x() > self.width() or shotR.y() > self.height(): self.autoShootTimer.stop() else: - r = r.unite(qt.TQRegion(shotR)) + r = r.unite(tqt.TQRegion(shotR)) self.repaint(r) def paintEvent(self, ev): updateR = ev.rect() - p = qt.TQPainter(self) + p = tqt.TQPainter(self) if updateR.intersects(self.cannonRect()): self.paintCannon(p) @@ -108,21 +108,21 @@ class CannonField(qt.TQWidget): self.paintShot(p) def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.black) + p.setPen(tqt.TQt.NoPen) p.drawRect(self.shotRect()) def paintCannon(self, p): cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) + pix = tqt.TQPixmap(cr.size()) pix.fill(self, cr.topLeft()) - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) + tmp = tqt.TQPainter(pix) + tmp.setBrush(tqt.TQt.blue) + tmp.setPen(tqt.TQt.NoPen) tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) tmp.rotate(-self.ang) tmp.drawRect(self.barrelRect) tmp.end() @@ -130,7 +130,7 @@ class CannonField(qt.TQWidget): p.drawPixmap(cr.topLeft(), pix) def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) + r = tqt.TQRect(0, 0, 50, 50) r.moveBottomLeft(self.rect().bottomLeft()) return r @@ -148,21 +148,21 @@ class CannonField(qt.TQWidget): x = x0 + velx * time y = y0 + vely * time - 0.5 * gravity * time * time - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + r = tqt.TQRect(0, 0, 6, 6) + r.moveCenter(tqt.TQPoint(int(x), int(self.height() - 1 - y))) return r def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange(self, "angle") self.angle.setRange(5, 70) @@ -172,28 +172,28 @@ class MyWidget(qt.TQWidget): self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + self.connect(self.force, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, tqt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - shoot = qt.TQPushButton("&Shoot", self, "shoot") - shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) + shoot = tqt.TQPushButton("&Shoot", self, "shoot") + shoot.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(shoot, tqt.SIGNAL("clicked()"), self.cannonField.shoot) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) - leftBox = qt.TQVBoxLayout() + leftBox = tqt.TQVBoxLayout() grid.addLayout(leftBox, 1, 0) leftBox.addWidget(self.angle) leftBox.addWidget(self.force) - topBox = qt.TQHBoxLayout() + topBox = tqt.TQHBoxLayout() grid.addLayout(topBox, 0, 1) topBox.addWidget(shoot) topBox.addStretch(1) @@ -203,8 +203,8 @@ class MyWidget(qt.TQWidget): self.angle.setFocus() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 500, 355) diff --git a/examples/tut12.py b/examples/tut12.py index d0370f8..f901b70 100755 --- a/examples/tut12.py +++ b/examples/tut12.py @@ -5,23 +5,23 @@ import sys import math import random -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, s=None, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) + self.label = tqt.TQLabel(" ", self, "label") + self.label.setAlignment(tqt.TQt.AlignCenter) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) @@ -47,24 +47,24 @@ class LCDRange(qt.TQVBox): self.label.setText(s) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 self.f = 0 self.timerCount = 0 - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + self.autoShootTimer = tqt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, tqt.SIGNAL("timeout()"), self.moveShot) self.shoot_ang = 0 self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) + self.target = tqt.TQPoint(0, 0) - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) - self.barrelRect = qt.TQRect(33, -4, 15, 8) + self.barrelRect = tqt.TQRect(33, -4, 15, 8) self.newTarget() @@ -80,7 +80,7 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def force(self): return self.f @@ -91,7 +91,7 @@ class CannonField(qt.TQWidget): if self.f == newton: return self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + self.emit(tqt.PYSIGNAL("forceChanged(int)"), (self.f, )) def shoot(self): if self.autoShootTimer.isActive(): @@ -103,30 +103,30 @@ class CannonField(qt.TQWidget): self.autoShootTimer.start(50) def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + r = tqt.TQRegion(self.targetRect()) + self.target = tqt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(tqt.TQRegion(self.targetRect()))) def moveShot(self): - r = qt.TQRegion(self.shotRect()) + r = tqt.TQRegion(self.shotRect()) self.timerCount = self.timerCount + 1 shotR = self.shotRect() if shotR.intersects(self.targetRect()): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) + self.emit(tqt.PYSIGNAL("hit()"), ()) elif shotR.x() > self.width() or shotR.y() > self.height(): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) + self.emit(tqt.PYSIGNAL("missed()"), ()) else: - r = r.unite(qt.TQRegion(shotR)) + r = r.unite(tqt.TQRegion(shotR)) self.repaint(r) def paintEvent(self, ev): updateR = ev.rect() - p = qt.TQPainter(self) + p = tqt.TQPainter(self) if updateR.intersects(self.cannonRect()): self.paintCannon(p) @@ -138,26 +138,26 @@ class CannonField(qt.TQWidget): self.paintTarget(p) def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.black) + p.setPen(tqt.TQt.NoPen) p.drawRect(self.shotRect()) def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) + p.setBrush(tqt.TQt.red) + p.setPen(tqt.TQt.black) p.drawRect(self.targetRect()) def paintCannon(self, p): cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) + pix = tqt.TQPixmap(cr.size()) pix.fill(self, cr.topLeft()) - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) + tmp = tqt.TQPainter(pix) + tmp.setBrush(tqt.TQt.blue) + tmp.setPen(tqt.TQt.NoPen) tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) tmp.rotate(-self.ang) tmp.drawRect(self.barrelRect) tmp.end() @@ -165,7 +165,7 @@ class CannonField(qt.TQWidget): p.drawPixmap(cr.topLeft(), pix) def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) + r = tqt.TQRect(0, 0, 50, 50) r.moveBottomLeft(self.rect().bottomLeft()) return r @@ -183,26 +183,26 @@ class CannonField(qt.TQWidget): x = x0 + velx * time y = y0 + vely * time - 0.5 * gravity * time * time - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + r = tqt.TQRect(0, 0, 6, 6) + r.moveCenter(tqt.TQPoint(int(x), int(self.height() - 1 - y))) return r def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + r = tqt.TQRect(0, 0, 20, 10) + r.moveCenter(tqt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) return r def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange("ANGLE", self, "angle") self.angle.setRange(5, 70) @@ -212,28 +212,28 @@ class MyWidget(qt.TQWidget): self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + self.connect(self.force, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, tqt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - shoot = qt.TQPushButton("&Shoot", self, "shoot") - shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(shoot, qt.SIGNAL("clicked()"), self.cannonField.shoot) + shoot = tqt.TQPushButton("&Shoot", self, "shoot") + shoot.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(shoot, tqt.SIGNAL("clicked()"), self.cannonField.shoot) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) - leftBox = qt.TQVBoxLayout() + leftBox = tqt.TQVBoxLayout() grid.addLayout(leftBox, 1, 0) leftBox.addWidget(self.angle) leftBox.addWidget(self.force) - topBox = qt.TQHBoxLayout() + topBox = tqt.TQHBoxLayout() grid.addLayout(topBox, 0, 1) topBox.addWidget(shoot) topBox.addStretch(1) @@ -243,8 +243,8 @@ class MyWidget(qt.TQWidget): self.angle.setFocus() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 500, 355) diff --git a/examples/tut13.py b/examples/tut13.py index b8b2d82..8bade61 100755 --- a/examples/tut13.py +++ b/examples/tut13.py @@ -5,27 +5,27 @@ import sys import math import random -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQWidget): +class LCDRange(tqt.TQWidget): def __init__(self, s=None, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) + self.label = tqt.TQLabel(" ", self, "label") + self.label.setAlignment(tqt.TQt.AlignCenter) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) - l = qt.TQVBoxLayout(self) + l = tqt.TQVBoxLayout(self) l.addWidget(lcd, 1) l.addWidget(self.slider) l.addWidget(self.label) @@ -52,25 +52,25 @@ class LCDRange(qt.TQWidget): self.label.setText(s) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 self.f = 0 self.timerCount = 0 - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + self.autoShootTimer = tqt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, tqt.SIGNAL("timeout()"), self.moveShot) self.shoot_ang = 0 self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) + self.target = tqt.TQPoint(0, 0) self.gameEnded = 0 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) - self.barrelRect = qt.TQRect(33, -4, 15, 8) + self.barrelRect = tqt.TQRect(33, -4, 15, 8) self.newTarget() @@ -86,7 +86,7 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def force(self): return self.f @@ -97,7 +97,7 @@ class CannonField(qt.TQWidget): if self.f == newton: return self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + self.emit(tqt.PYSIGNAL("forceChanged(int)"), (self.f, )) def shoot(self): if self.isShooting(): @@ -107,12 +107,12 @@ class CannonField(qt.TQWidget): self.shoot_ang = self.ang self.shoot_f = self.f self.autoShootTimer.start(50) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (0, )) def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + r = tqt.TQRegion(self.targetRect()) + self.target = tqt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(tqt.TQRegion(self.targetRect()))) def gameOver(self): return self.gameEnded @@ -130,35 +130,35 @@ class CannonField(qt.TQWidget): self.autoShootTime.stop() self.gameEnded = 0 self.repaint() - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) def moveShot(self): - r = qt.TQRegion(self.shotRect()) + r = tqt.TQRegion(self.shotRect()) self.timerCount = self.timerCount + 1 shotR = self.shotRect() if shotR.intersects(self.targetRect()): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("hit()"), ()) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) elif shotR.x() > self.width() or shotR.y() > self.height(): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("missed()"), ()) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) else: - r = r.unite(qt.TQRegion(shotR)) + r = r.unite(tqt.TQRegion(shotR)) self.repaint(r) def paintEvent(self, ev): updateR = ev.rect() - p = qt.TQPainter(self) + p = tqt.TQPainter(self) if self.gameEnded: - p.setPen(qt.TQt.black) - p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) - p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") + p.setPen(tqt.TQt.black) + p.setFont(tqt.TQFont("Courier", 48, tqt.TQFont.Bold)) + p.drawText(self.rect(), tqt.TQt.AlignCenter, "Game Over") if updateR.intersects(self.cannonRect()): self.paintCannon(p) @@ -170,26 +170,26 @@ class CannonField(qt.TQWidget): self.paintTarget(p) def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.black) + p.setPen(tqt.TQt.NoPen) p.drawRect(self.shotRect()) def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) + p.setBrush(tqt.TQt.red) + p.setPen(tqt.TQt.black) p.drawRect(self.targetRect()) def paintCannon(self, p): cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) + pix = tqt.TQPixmap(cr.size()) pix.fill(self, cr.topLeft()) - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) + tmp = tqt.TQPainter(pix) + tmp.setBrush(tqt.TQt.blue) + tmp.setPen(tqt.TQt.NoPen) tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) tmp.rotate(-self.ang) tmp.drawRect(self.barrelRect) tmp.end() @@ -197,7 +197,7 @@ class CannonField(qt.TQWidget): p.drawPixmap(cr.topLeft(), pix) def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) + r = tqt.TQRect(0, 0, 50, 50) r.moveBottomLeft(self.rect().bottomLeft()) return r @@ -215,29 +215,29 @@ class CannonField(qt.TQWidget): x = x0 + velx * time y = y0 + vely * time - 0.5 * gravity * time * time - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + r = tqt.TQRect(0, 0, 6, 6) + r.moveCenter(tqt.TQPoint(int(x), int(self.height() - 1 - y))) return r def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + r = tqt.TQRect(0, 0, 20, 10) + r.moveCenter(tqt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) return r def isShooting(self): return self.autoShootTimer.isActive() def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class GameBoard(qt.TQWidget): +class GameBoard(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange("ANGLE", self, "angle") self.angle.setRange(5, 70) @@ -247,40 +247,40 @@ class GameBoard(qt.TQWidget): self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + self.connect(self.force, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, tqt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) - self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) + self.connect(self.cannonField, tqt.PYSIGNAL("hit()"), self.hit) + self.connect(self.cannonField, tqt.PYSIGNAL("missed()"), self.missed) - self.shoot = qt.TQPushButton("&Shoot", self, "shoot") - self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) - self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) + self.shoot = tqt.TQPushButton("&Shoot", self, "shoot") + self.shoot.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(self.shoot, tqt.SIGNAL("clicked()"), self.fire) + self.connect(self.cannonField, tqt.PYSIGNAL("canShoot(bool)"), self.shoot, tqt.SLOT("setEnabled(bool)")) - restart = qt.TQPushButton("&New Game", self, "newgame") - restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) + restart = tqt.TQPushButton("&New Game", self, "newgame") + restart.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(restart, tqt.SIGNAL("clicked()"), self.newGame) - self.hits = qt.TQLCDNumber(2, self, "hits") - self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") - hitsL = qt.TQLabel("HITS", self, "hitsLabel") - shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") + self.hits = tqt.TQLCDNumber(2, self, "hits") + self.shotsLeft = tqt.TQLCDNumber(2, self, "shotsleft") + hitsL = tqt.TQLabel("HITS", self, "hitsLabel") + shotsLeftL = tqt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) - leftBox = qt.TQVBoxLayout() + leftBox tqt.TQVBoxLayout() grid.addLayout(leftBox, 1, 0) leftBox.addWidget(self.angle) leftBox.addWidget(self.force) - topBox = qt.TQHBoxLayout() + topBox = tqt.TQHBoxLayout() grid.addLayout(topBox, 0, 1) topBox.addWidget(self.shoot) topBox.addWidget(self.hits) @@ -320,8 +320,8 @@ class GameBoard(qt.TQWidget): self.cannonField.newTarget() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) gb = GameBoard() gb.setGeometry(100, 100, 500, 355) diff --git a/examples/tut14.py b/examples/tut14.py index 41d2631..0111cab 100755 --- a/examples/tut14.py +++ b/examples/tut14.py @@ -5,27 +5,27 @@ import sys import math import random -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQWidget): +class LCDRange(tqt.TQWidget): def __init__(self, s=None, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.label = qt.TQLabel(" ", self, "label") - self.label.setAlignment(qt.TQt.AlignCenter) + self.label = tqt.TQLabel(" ", self, "label") + self.label.setAlignment(tqt.TQt.AlignCenter) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) - l = qt.TQVBoxLayout(self) + l = tqt.TQVBoxLayout(self) l.addWidget(lcd, 1) l.addWidget(self.slider) l.addWidget(self.label) @@ -52,26 +52,26 @@ class LCDRange(qt.TQWidget): self.label.setText(s) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 self.f = 0 self.timerCount = 0 - self.autoShootTimer = qt.TQTimer(self, "movement handler") - self.connect(self.autoShootTimer, qt.SIGNAL("timeout()"), self.moveShot) + self.autoShootTimer = tqt.TQTimer(self, "movement handler") + self.connect(self.autoShootTimer, tqt.SIGNAL("timeout()"), self.moveShot) self.shoot_ang = 0 self.shoot_f = 0 - self.target = qt.TQPoint(0, 0) + self.target = tqt.TQPoint(0, 0) self.gameEnded = 0 self.barrelPressed = 0 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) - self.barrelRect = qt.TQRect(33, -4, 15, 8) + self.barrelRect = tqt.TQRect(33, -4, 15, 8) self.newTarget() @@ -87,7 +87,7 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint(self.cannonRect(), 0) - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def force(self): return self.f @@ -98,7 +98,7 @@ class CannonField(qt.TQWidget): if self.f == newton: return self.f = newton - self.emit(qt.PYSIGNAL("forceChanged(int)"), (self.f, )) + self.emit(tqt.PYSIGNAL("forceChanged(int)"), (self.f, )) def shoot(self): if self.isShooting(): @@ -108,12 +108,12 @@ class CannonField(qt.TQWidget): self.shoot_ang = self.ang self.shoot_f = self.f self.autoShootTimer.start(50) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (0, )) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (0, )) def newTarget(self): - r = qt.TQRegion(self.targetRect()) - self.target = qt.TQPoint(random.randint(200, 390), random.randint(10, 265)) - self.repaint(r.unite(qt.TQRegion(self.targetRect()))) + r = tqt.TQRegion(self.targetRect()) + self.target = tqt.TQPoint(random.randint(200, 390), random.randint(10, 265)) + self.repaint(r.unite(tqt.TQRegion(self.targetRect()))) def gameOver(self): return self.gameEnded @@ -131,29 +131,29 @@ class CannonField(qt.TQWidget): self.autoShootTime.stop() self.gameEnded = 0 self.repaint() - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) def moveShot(self): - r = qt.TQRegion(self.shotRect()) + r = tqt.TQRegion(self.shotRect()) self.timerCount = self.timerCount + 1 shotR = self.shotRect() if shotR.intersects(self.targetRect()): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("hit()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("hit()"), ()) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) elif shotR.x() > self.width() or shotR.y() > self.height() or shotR.intersects(self.barrierRect()): self.autoShootTimer.stop() - self.emit(qt.PYSIGNAL("missed()"), ()) - self.emit(qt.PYSIGNAL("canShoot(bool)"), (1, )) + self.emit(tqt.PYSIGNAL("missed()"), ()) + self.emit(tqt.PYSIGNAL("canShoot(bool)"), (1, )) else: - r = r.unite(qt.TQRegion(shotR)) + r = r.unite(tqt.TQRegion(shotR)) self.repaint(r) def mousePressEvent(self, ev): - if ev.button() != qt.TQt.LeftButton: + if ev.button() != tqt.TQt.LeftButton: return if self.barrelHit(ev.pos()): self.barrelPressed = 1 @@ -170,17 +170,17 @@ class CannonField(qt.TQWidget): self.setAngle(int(round(rad * 180 / math.pi))) def mouseReleaseEvent(self, ev): - if ev.button() == qt.TQt.LeftButton: + if ev.button() == tqt.TQt.LeftButton: self.barrelPressed = 0 def paintEvent(self, ev): updateR = ev.rect() - p = qt.TQPainter(self) + p = tqt.TQPainter(self) if self.gameEnded: - p.setPen(qt.TQt.black) - p.setFont(qt.TQFont("Courier", 48, qt.TQFont.Bold)) - p.drawText(self.rect(), qt.TQt.AlignCenter, "Game Over") + p.setPen(tqt.TQt.black) + p.setFont(tqt.TQFont("Courier", 48, tqt.TQFont.Bold)) + p.drawText(self.rect(), tqt.TQt.AlignCenter, "Game Over") if updateR.intersects(self.cannonRect()): self.paintCannon(p) @@ -195,31 +195,31 @@ class CannonField(qt.TQWidget): self.paintTarget(p) def paintShot(self, p): - p.setBrush(qt.TQt.black) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.black) + p.setPen(tqt.TQt.NoPen) p.drawRect(self.shotRect()) def paintTarget(self, p): - p.setBrush(qt.TQt.red) - p.setPen(qt.TQt.black) + p.setBrush(tqt.TQt.red) + p.setPen(tqt.TQt.black) p.drawRect(self.targetRect()) def paintBarrier(self, p): - p.setBrush(qt.TQt.yellow) - p.setPen(qt.TQt.black) + p.setBrush(tqt.TQt.yellow) + p.setPen(tqt.TQt.black) p.drawRect(self.barrierRect()) def paintCannon(self, p): cr = self.cannonRect() - pix = qt.TQPixmap(cr.size()) + pix = tqt.TQPixmap(cr.size()) pix.fill(self, cr.topLeft()) - tmp = qt.TQPainter(pix) - tmp.setBrush(qt.TQt.blue) - tmp.setPen(qt.TQt.NoPen) + tmp = tqt.TQPainter(pix) + tmp.setBrush(tqt.TQt.blue) + tmp.setPen(tqt.TQt.NoPen) tmp.translate(0, pix.height() - 1) - tmp.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + tmp.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) tmp.rotate(-self.ang) tmp.drawRect(self.barrelRect) tmp.end() @@ -227,7 +227,7 @@ class CannonField(qt.TQWidget): p.drawPixmap(cr.topLeft(), pix) def cannonRect(self): - r = qt.TQRect(0, 0, 50, 50) + r = tqt.TQRect(0, 0, 50, 50) r.moveBottomLeft(self.rect().bottomLeft()) return r @@ -245,20 +245,20 @@ class CannonField(qt.TQWidget): x = x0 + velx * time y = y0 + vely * time - 0.5 * gravity * time * time - r = qt.TQRect(0, 0, 6, 6) - r.moveCenter(qt.TQPoint(int(x), int(self.height() - 1 - y))) + r = tqt.TQRect(0, 0, 6, 6) + r.moveCenter(tqt.TQPoint(int(x), int(self.height() - 1 - y))) return r def targetRect(self): - r = qt.TQRect(0, 0, 20, 10) - r.moveCenter(qt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) + r = tqt.TQRect(0, 0, 20, 10) + r.moveCenter(tqt.TQPoint(self.target.x(), self.height() - 1 - self.target.y())) return r def barrierRect(self): - return qt.TQRect(145, self.height() - 100, 15, 100) + return tqt.TQRect(145, self.height() - 100, 15, 100) def barrelHit(self, p): - mtx = qt.TQWMatrix() + mtx = tqt.TQWMatrix() mtx.translate(0, self.height() - 1) mtx.rotate(-self.ang) (mtx, invertable) = mtx.invert() @@ -268,16 +268,16 @@ class CannonField(qt.TQWidget): return self.autoShootTimer.isActive() def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class GameBoard(qt.TQWidget): +class GameBoard(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange("ANGLE", self, "angle") self.angle.setRange(5, 70) @@ -285,50 +285,50 @@ class GameBoard(qt.TQWidget): self.force = LCDRange("FORCE", self, "force") self.force.setRange(10, 50) - box = qt.TQVBox(self, "cannonFrame") - box.setFrameStyle(qt.TQFrame.WinPanel | qt.TQFrame.Sunken) + box = tqt.TQVBox(self, "cannonFrame") + box.setFrameStyle(tqt.TQFrame.WinPanel | tqt.TQFrame.Sunken) self.cannonField = CannonField(box, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - self.connect(self.force, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) - self.connect(self.cannonField, qt.PYSIGNAL("forceChanged(int)"), self.force.setValue) + self.connect(self.force, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setForce) + self.connect(self.cannonField, tqt.PYSIGNAL("forceChanged(int)"), self.force.setValue) - self.connect(self.cannonField, qt.PYSIGNAL("hit()"), self.hit) - self.connect(self.cannonField, qt.PYSIGNAL("missed()"), self.missed) + self.connect(self.cannonField, tqt.PYSIGNAL("hit()"), self.hit) + self.connect(self.cannonField, tqt.PYSIGNAL("missed()"), self.missed) - self.shoot = qt.TQPushButton("&Shoot", self, "shoot") - self.shoot.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(self.shoot, qt.SIGNAL("clicked()"), self.fire) - self.connect(self.cannonField, qt.PYSIGNAL("canShoot(bool)"), self.shoot, qt.SLOT("setEnabled(bool)")) + self.shoot = tqt.TQPushButton("&Shoot", self, "shoot") + self.shoot.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(self.shoot, tqt.SIGNAL("clicked()"), self.fire) + self.connect(self.cannonField, tqt.PYSIGNAL("canShoot(bool)"), self.shoot, tqt.SLOT("setEnabled(bool)")) - restart = qt.TQPushButton("&New Game", self, "newgame") - restart.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(restart, qt.SIGNAL("clicked()"), self.newGame) + restart = tqt.TQPushButton("&New Game", self, "newgame") + restart.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(restart, tqt.SIGNAL("clicked()"), self.newGame) - self.hits = qt.TQLCDNumber(2, self, "hits") - self.shotsLeft = qt.TQLCDNumber(2, self, "shotsleft") - hitsL = qt.TQLabel("HITS", self, "hitsLabel") - shotsLeftL = qt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") + self.hits = tqt.TQLCDNumber(2, self, "hits") + self.shotsLeft = tqt.TQLCDNumber(2, self, "shotsleft") + hitsL = tqt.TQLabel("HITS", self, "hitsLabel") + shotsLeftL = tqt.TQLabel("SHOTS LEFT", self, "shotsleftLabel") - accel = qt.TQAccel(self) - accel.connectItem(accel.insertItem(qt.TQt.Key_Enter), self.fire) - accel.connectItem(accel.insertItem(qt.TQt.Key_Return), self.fire) - accel.connectItem(accel.insertItem(qt.TQt.CTRL + qt.TQt.Key_Q), qt.tqApp, qt.SLOT("quit()")) + accel = tqt.TQAccel(self) + accel.connectItem(accel.insertItem(tqt.TQt.Key_Enter), self.fire) + accel.connectItem(accel.insertItem(tqt.TQt.Key_Return), self.fire) + accel.connectItem(accel.insertItem(tqt.TQt.CTRL + tqt.TQt.Key_Q), tqt.tqApp, tqt.SLOT("quit()")) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) grid.addWidget(box, 1, 1) grid.setColStretch(1, 10) - leftBox = qt.TQVBoxLayout() + leftBox = tqt.TQVBoxLayout() grid.addLayout(leftBox, 1, 0) leftBox.addWidget(self.angle) leftBox.addWidget(self.force) - topBox = qt.TQHBoxLayout() + topBox = tqt.TQHBoxLayout() grid.addLayout(topBox, 0, 1) topBox.addWidget(self.shoot) topBox.addWidget(self.hits) @@ -368,8 +368,8 @@ class GameBoard(qt.TQWidget): self.cannonField.newTarget() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) gb = GameBoard() gb.setGeometry(100, 100, 500, 355) diff --git a/examples/tut2.py b/examples/tut2.py index e74101e..0f34b16 100755 --- a/examples/tut2.py +++ b/examples/tut2.py @@ -3,16 +3,16 @@ # TQt tutorial 2. import sys -from PyTQt import qt +from PyTQt import tqt -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) -quit = qt.TQPushButton("Quit", None) +quit = tqt.TQPushButton("Quit", None) quit.resize(75, 30) -quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) +quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) -qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) +qt.TQObject.connect(quit, tqt.SIGNAL("clicked()"), a, tqt.SLOT("quit()")) a.setMainWidget(quit) quit.show() diff --git a/examples/tut3.py b/examples/tut3.py index 85c3dc6..6cb1305 100755 --- a/examples/tut3.py +++ b/examples/tut3.py @@ -3,18 +3,18 @@ # TQt tutorial 3. import sys -from PyTQt import qt +from PyTQt import tqt -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) -box = qt.TQVBox() +box = tqt.TQVBox() box.resize(200, 120) -quit = qt.TQPushButton("Quit", box) -quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) +quit = tqt.TQPushButton("Quit", box) +quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) -qt.TQObject.connect(quit, qt.SIGNAL("clicked()"), a, qt.SLOT("quit()")) +qt.TQObject.connect(quit, tqt.SIGNAL("clicked()"), a, tqt.SLOT("quit()")) a.setMainWidget(box) box.show() diff --git a/examples/tut4.py b/examples/tut4.py index 04e0a61..f61a054 100755 --- a/examples/tut4.py +++ b/examples/tut4.py @@ -3,24 +3,24 @@ # TQt tutorial 4. import sys -from PyTQt import qt +from PyTQt import tqt -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.setMinimumSize(200, 120) self.setMaximumSize(200, 120) - quit = qt.TQPushButton("Quit", self, "quit") + quit = tqt.TQPushButton("Quit", self, "quit") quit.setGeometry(62, 40, 75, 30) - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 200, 120) diff --git a/examples/tut5.py b/examples/tut5.py index a56c216..fe12295 100755 --- a/examples/tut5.py +++ b/examples/tut5.py @@ -3,28 +3,28 @@ # TQt tutorial 5. import sys -from PyTQt import qt +from PyTQt import tqt -class MyWidget(qt.TQVBox): +class MyWidget(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + quit = tqt.TQPushButton("Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) - lcd = qt.TQLCDNumber(2, self, "lcd") + lcd = tqt.TQLCDNumber(2, self, "lcd") - slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") slider.setRange(0, 99) slider.setValue(0) - self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) w = MyWidget() a.setMainWidget(w) diff --git a/examples/tut6.py b/examples/tut6.py index ab98c09..7c6c682 100755 --- a/examples/tut6.py +++ b/examples/tut6.py @@ -3,37 +3,37 @@ # TQt tutorial 6. import sys -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") slider.setRange(0, 99) slider.setValue(0) - self.connect(slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) + self.connect(slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) -class MyWidget(qt.TQVBox): +class MyWidget(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + quit = tqt.TQPushButton("Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) - grid = qt.TQGrid(4, self) + grid = tqt.TQGrid(4, self) for c in range(4): for r in range(4): LCDRange(grid) -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) w = MyWidget() a.setMainWidget(w) diff --git a/examples/tut7.py b/examples/tut7.py index 1df3f4e..ed8da51 100755 --- a/examples/tut7.py +++ b/examples/tut7.py @@ -3,19 +3,19 @@ # TQt tutorial 7. import sys -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) def value(self): return self.slider.value() @@ -24,16 +24,16 @@ class LCDRange(qt.TQVBox): self.slider.setValue(value) -class MyWidget(qt.TQVBox): +class MyWidget(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) + quit = tqt.TQPushButton("Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) - grid = qt.TQGrid(4, self) + grid = tqt.TQGrid(4, self) self.lcdlist = [] previous = None @@ -43,13 +43,13 @@ class MyWidget(qt.TQVBox): lr = LCDRange(grid) if previous: - self.connect(lr, qt.PYSIGNAL("valueChanged(int)"), previous.setValue) + self.connect(lr, tqt.PYSIGNAL("valueChanged(int)"), previous.setValue) previous = lr self.lcdlist.append(lr) -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) w = MyWidget() a.setMainWidget(w) diff --git a/examples/tut8.py b/examples/tut8.py index 24f91c2..ca4a912 100755 --- a/examples/tut8.py +++ b/examples/tut8.py @@ -3,19 +3,19 @@ # TQt tutorial 8. import sys -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) @@ -32,12 +32,12 @@ class LCDRange(qt.TQVBox): self.slider.setRange(minVal, maxVal) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) def angle(self): return self.ang @@ -51,36 +51,36 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint() - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def paintEvent(self, ev): - p = qt.TQPainter(self) + p = tqt.TQPainter(self) p.drawText(200, 200, "Angle = %d" % (self.ang)) def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange(self, "angle") self.angle.setRange(5, 70) self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) - grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) + grid.addWidget(self.angle, 1, 0, tqt.TQt.AlignTop) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) @@ -88,7 +88,7 @@ class MyWidget(qt.TQWidget): self.angle.setFocus() -a = qt.TQApplication(sys.argv) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 500, 355) diff --git a/examples/tut9.py b/examples/tut9.py index e45b0e4..df0de2c 100755 --- a/examples/tut9.py +++ b/examples/tut9.py @@ -3,19 +3,19 @@ # TQt tutorial 9. import sys -from PyTQt import qt +from PyTQt import tqt -class LCDRange(qt.TQVBox): +class LCDRange(tqt.TQVBox): def __init__(self, parent=None, name=None): - qt.TQVBox.__init__(self, parent, name) + tqt.TQVBox.__init__(self, parent, name) - lcd = qt.TQLCDNumber(2, self, "lcd") - self.slider = qt.TQSlider(qt.TQt.Horizontal, self, "slider") + lcd = tqt.TQLCDNumber(2, self, "lcd") + self.slider = tqt.TQSlider(tqt.TQt.Horizontal, self, "slider") self.slider.setRange(0, 99) self.slider.setValue(0) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), lcd, qt.SLOT("display(int)")) - self.connect(self.slider, qt.SIGNAL("valueChanged(int)"), self, qt.PYSIGNAL("valueChanged(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), lcd, tqt.SLOT("display(int)")) + self.connect(self.slider, tqt.SIGNAL("valueChanged(int)"), self, tqt.PYSIGNAL("valueChanged(int)")) self.setFocusProxy(self.slider) @@ -31,12 +31,12 @@ class LCDRange(qt.TQVBox): self.slider.setRange(minVal, maxVal) -class CannonField(qt.TQWidget): +class CannonField(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) self.ang = 45 - self.setPalette(qt.TQPalette(qt.TQColor(250, 250, 200))) + self.setPalette(tqt.TQPalette(tqt.TQColor(250, 250, 200))) def angle(self): return self.ang @@ -50,43 +50,43 @@ class CannonField(qt.TQWidget): return self.ang = degrees self.repaint() - self.emit(qt.PYSIGNAL("angleChanged(int)"), (self.ang, )) + self.emit(tqt.PYSIGNAL("angleChanged(int)"), (self.ang, )) def paintEvent(self, ev): - p = qt.TQPainter(self) + p = tqt.TQPainter(self) - p.setBrush(qt.TQt.blue) - p.setPen(qt.TQt.NoPen) + p.setBrush(tqt.TQt.blue) + p.setPen(tqt.TQt.NoPen) p.translate(0, self.rect().bottom()) - p.drawPie(qt.TQRect(-35, -35, 70, 70), 0, 90 * 16) + p.drawPie(tqt.TQRect(-35, -35, 70, 70), 0, 90 * 16) p.rotate(-self.ang) - p.drawRect(qt.TQRect(33, -4, 15, 8)) + p.drawRect(tqt.TQRect(33, -4, 15, 8)) def sizePolicy(self): - return qt.TQSizePolicy(qt.TQSizePolicy.Expanding, qt.TQSizePolicy.Expanding) + return tqt.TQSizePolicy(tqt.TQSizePolicy.Expanding, tqt.TQSizePolicy.Expanding) -class MyWidget(qt.TQWidget): +class MyWidget(tqt.TQWidget): def __init__(self, parent=None, name=None): - qt.TQWidget.__init__(self, parent, name) + tqt.TQWidget.__init__(self, parent, name) - quit = qt.TQPushButton("&Quit", self, "quit") - quit.setFont(qt.TQFont("Times", 18, qt.TQFont.Bold)) - self.connect(quit, qt.SIGNAL("clicked()"), qt.tqApp, qt.SLOT("quit()")) + quit = tqt.TQPushButton("&Quit", self, "quit") + quit.setFont(tqt.TQFont("Times", 18, tqt.TQFont.Bold)) + self.connect(quit, tqt.SIGNAL("clicked()"), tqt.tqApp, tqt.SLOT("quit()")) self.angle = LCDRange(self, "angle") self.angle.setRange(5, 70) self.cannonField = CannonField(self, "cannonField") - self.connect(self.angle, qt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) - self.connect(self.cannonField, qt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) + self.connect(self.angle, tqt.PYSIGNAL("valueChanged(int)"), self.cannonField.setAngle) + self.connect(self.cannonField, tqt.PYSIGNAL("angleChanged(int)"), self.angle.setValue) - grid = qt.TQGridLayout(self, 2, 2, 10) + grid = tqt.TQGridLayout(self, 2, 2, 10) grid.addWidget(quit, 0, 0) - grid.addWidget(self.angle, 1, 0, qt.TQt.AlignTop) + grid.addWidget(self.angle, 1, 0, tqt.TQt.AlignTop) grid.addWidget(self.cannonField, 1, 1) grid.setColStretch(1, 10) @@ -94,8 +94,8 @@ class MyWidget(qt.TQWidget): self.angle.setFocus() -qt.TQApplication.setColorSpec(qt.TQApplication.CustomColor) -a = qt.TQApplication(sys.argv) +qt.TQApplication.setColorSpec(tqt.TQApplication.CustomColor) +a = tqt.TQApplication(sys.argv) w = MyWidget() w.setGeometry(100, 100, 500, 355) diff --git a/examples/webbrowser/mainwindow.py b/examples/webbrowser/mainwindow.py index 24ca188..2d4e740 100644 --- a/examples/webbrowser/mainwindow.py +++ b/examples/webbrowser/mainwindow.py @@ -3,13 +3,13 @@ # Form implementation generated from reading ui file 'mainwindow.ui' # # Created: Sun Dec 5 14:50:47 2004 -# by: The PyTQt User Interface Compiler (pyuic) snapshot-20041203 +# by: The PyTQt User Interface Compiler (pytquic) snapshot-20041203 # # WARNING! All changes made in this file will be lost! -from PyTQt.qt import * -from PyTQt.qtaxcontainer import TQAxWidget +from PyTQt.tqt import * +from PyTQt.tqtaxcontainer import TQAxWidget image0_data = [ "32 32 3 1", @@ -925,7 +925,7 @@ class MainWindow(TQMainWindow): self.setName("MainWindow") - self.setCentralWidget(TQWidget(self,"qt_central_widget")) + self.setCentralWidget(TQWidget(self,"tqt_central_widget")) MainWindowLayout = TQHBoxLayout(self.centralWidget(),0,6,"MainWindowLayout") self.Frame3 = TQFrame(self.centralWidget(),"Frame3") diff --git a/examples/webbrowser/webbrowser.py b/examples/webbrowser/webbrowser.py index 44d3488..0ae8702 100644 --- a/examples/webbrowser/webbrowser.py +++ b/examples/webbrowser/webbrowser.py @@ -7,21 +7,21 @@ import sys -from PyTQt import qt -from PyTQt import qtaxcontainer +from PyTQt import tqt +from PyTQt import tqtaxcontainer import mainwindow class MainWindowImpl(mainwindow.MainWindow): def init(self): - self.pb = qt.TQProgressBar(self.statusBar()) + self.pb = tqt.TQProgressBar(self.statusBar()) self.pb.setPercentageVisible(False) self.pb.hide() self.statusBar().addWidget(self.pb, 0, True) - self.connect(self.WebBrowser, qt.SIGNAL("ProgressChange(int,int)"), self.setProgress) - self.connect(self.WebBrowser, qt.SIGNAL("StatusTextChange(const TQString&)"), self.statusBar(), qt.SLOT("message(const TQString&)")) + self.connect(self.WebBrowser, tqt.SIGNAL("ProgressChange(int,int)"), self.setProgress) + self.connect(self.WebBrowser, tqt.SIGNAL("StatusTextChange(const TQString&)"), self.statusBar(), tqt.SLOT("message(const TQString&)")) self.WebBrowser.dynamicCall("GoHome()"); @@ -29,7 +29,7 @@ class MainWindowImpl(mainwindow.MainWindow): def go(self): self.actionStop.setEnabled(True) - self.WebBrowser.dynamicCall("Navigate(const TQString&)", qt.TQVariant(self.addressEdit.text())) + self.WebBrowser.dynamicCall("Navigate(const TQString&)", tqt.TQVariant(self.addressEdit.text())) def setTitle(self, title): self.setCaption("TQt WebBrowser - " + title.latin1()) @@ -69,17 +69,17 @@ class MainWindowImpl(mainwindow.MainWindow): self.subwindows += window def aboutSlot(self): - qt.TQMessageBox.about(self, self.tr("About WebBrowser"), self.tr( + tqt.TQMessageBox.about(self, self.tr("About WebBrowser"), self.tr( """This Example has been created using the ActiveTQt integration into TQt Designer. It demonstrates the use of TQAxWidget to embed the Internet Explorer ActiveX control into a TQt application.""")) def aboutTQtSlot(self): - qt.TQMessageBox.aboutTQt(self, self.tr("About TQt")) + tqt.TQMessageBox.aboutTQt(self, self.tr("About TQt")) def main(args): - a = qt.TQApplication(args) + a = tqt.TQApplication(args) w = MainWindowImpl() a.setMainWidget(w) w.show() diff --git a/examples/widgets.py b/examples/widgets.py index d9f554d..59a44c4 100755 --- a/examples/widgets.py +++ b/examples/widgets.py @@ -2,7 +2,7 @@ import sys, string -from PyTQt.qt import * +from PyTQt.tqt import * # ## Constructs an analog clock widget that uses an internal TQTimer. @@ -36,7 +36,7 @@ class AnalogClock( TQWidget ): # ## The clock is painted using a 1000x1000 square coordinate system. # - def paintEvent( self, qe ): # paint clock + def paintEvent( self, tqe ): # paint clock if not self.isVisible(): # is is invisible return self.time = TQTime.currentTime() # save current time @@ -192,10 +192,10 @@ class WidgetView ( TQWidget ): 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( "tqt.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" + "Could not load the file \"tqt.png\", which\n" "contains an icon used...\n\n" "The text \"line 42\" will be substituted.", TQMessageBox.Ok + TQMessageBox.Default ) |