summaryrefslogtreecommitdiffstats
path: root/examples3/qmag.py
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
commit8a055d66f43592c257cece2eb8cc021808062917 (patch)
treed0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples3/qmag.py
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples3/qmag.py')
-rwxr-xr-xexamples3/qmag.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/examples3/qmag.py b/examples3/qmag.py
index f27da2c..d52a48c 100755
--- a/examples3/qmag.py
+++ b/examples3/qmag.py
@@ -5,7 +5,7 @@
#**
#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
#**
-#** This file is part of an example program for PyQt. This example
+#** This file is part of an example program for PyTQt. This example
#** program may be used, distributed and modified without limitation.
#**
#*****************************************************************************/
@@ -25,25 +25,25 @@ refreshrates = [
timer = (0, 20, 250, 333, 500, 1000, 2000, 3000, 5000, 10000)
-class MagWidget(QWidget):
+class MagWidget(TQWidget):
def __init__(self, qApp, parent = None, name = None):
self.qApp = qApp
- QWidget.__init__(self, parent, name)
- self.pm = QPixmap() # pixmap magnified
- self.p = QPixmap() # pixmap
- self.image = QImage() # image of pixmap (for RGB)
+ TQWidget.__init__(self, parent, name)
+ self.pm = TQPixmap() # pixmap magnified
+ self.p = TQPixmap() # pixmap
+ self.image = TQImage() # image of pixmap (for RGB)
self.z = 0 # zoom factor
self.r = 0 # autorefresh rate (index into refreshrates)
self.grabbing = FALSE # TRUE if currently grabbing
self.grabx = -1
self.graby = -1
- self.zoom = QComboBox(FALSE, self)
+ self.zoom = TQComboBox(FALSE, self)
self.zoom.insertStrList(zoomfactors, len(zoomfactors))
self.connect(self.zoom, SIGNAL("activated(int)"),
self.setZoom)
- self.refresh = QComboBox(FALSE, self)
+ self.refresh = TQComboBox(FALSE, self)
self.refresh.insertStrList(refreshrates, len(refreshrates))
self.connect(self.refresh, SIGNAL("activated(int)"),
self.setRefresh)
@@ -63,21 +63,21 @@ class MagWidget(QWidget):
w = max(cw, w)
self.refresh.setGeometry(x, 2, w + 30, h)
- self.saveButton = QPushButton(self)
+ self.saveButton = TQPushButton(self)
self.connect(self.saveButton, SIGNAL("clicked()"), self.save)
self.saveButton.setText("Save")
self.saveButton.setGeometry(x + w + 30 + 2, 2,
10 + self.saveButton.fontMetrics().width("Save"), h)
- self.quitButton = QPushButton(self)
+ self.quitButton = TQPushButton(self)
self.connect(self.quitButton, SIGNAL("clicked()"), self.qApp, SLOT("quit()"))
self.quitButton.setText("Quit")
self.quitButton.setGeometry(self.saveButton.geometry().right() + 2, 2,
10 + self.quitButton.fontMetrics().width("Quit"), h)
- self.rgb = QLabel(self)
+ self.rgb = TQLabel(self)
self.rgb.setText("")
- self.rgb.setAlignment(Qt.AlignVCenter)
+ self.rgb.setAlignment(TQt.AlignVCenter)
self.rgb.resize(self.width(), self.rgb.fontMetrics().height() + 4)
self.yoffset = self.zoom.height() + 4 + self.rgb.height()
@@ -89,7 +89,7 @@ class MagWidget(QWidget):
self.setMouseTracking(TRUE)
self.grabx = self.qApp.desktop().width() / 2
self.graby = self.qApp.desktop().height() / 2
- self.grabAround(QPoint(self.grabx, self.graby))
+ self.grabAround(TQPoint(self.grabx, self.graby))
#self.zoom.setCurrentItem(1) # grabAround sets zoom factor
#self.setZoom(1)
@@ -113,7 +113,7 @@ class MagWidget(QWidget):
def save(self):
if not self.p.isNull():
self.killTimers()
- fn = QFileDialog.getSaveFileName()
+ fn = TQFileDialog.getSaveFileName()
if not fn.isEmpty():
self.p.save(fn, "BMP")
if self.r:
@@ -132,19 +132,19 @@ class MagWidget(QWidget):
x = self.grabx - w / 2
y = self.graby - h / 2
- if x + w > QApplication.desktop().width():
- x = QApplication.desktop().width() - w
+ if x + w > TQApplication.desktop().width():
+ x = TQApplication.desktop().width() - w
elif x < 0:
x = 0
- if y + h > QApplication.desktop().height():
- y = QApplication.desktop().height() - h
+ if y + h > TQApplication.desktop().height():
+ y = TQApplication.desktop().height() - h
elif y < 0:
y = 0
- self.p = QPixmap.grabWindow(QApplication.desktop().winId(), x, y, w, h)
+ self.p = TQPixmap.grabWindow(TQApplication.desktop().winId(), x, y, w, h)
self.image = self.p.convertToImage()
- m = QWMatrix()
+ m = TQWMatrix()
#print "z:", self.z
m.scale(float(self.z), float(self.z))
self.pm = self.p.xForm(m)
@@ -152,7 +152,7 @@ class MagWidget(QWidget):
def paintEvent(self, e):
if not self.pm.isNull():
- paint = QPainter(self)
+ paint = TQPainter(self)
paint.drawPixmap(0, self.zoom.height() + 4, self.pm,
0, 0, self.width(), self.height() - self.yoffset)
@@ -160,7 +160,7 @@ class MagWidget(QWidget):
if not self.grabbing:
self.grabbing = TRUE
self.killTimers()
- self.grabMouse(Qt.crossCursor)
+ self.grabMouse(TQt.crossCursor)
self.grabx = -1
self.graby = -1
else:
@@ -181,8 +181,8 @@ class MagWidget(QWidget):
if w > 10 and h > 10:
pz = 1
while w*pz*h*pz < self.width()*(self.height()-self.yoffset) and \
- w*pz < QApplication.desktop().width() and \
- h*pz < QApplication.desktop().height():
+ w*pz < TQApplication.desktop().width() and \
+ h*pz < TQApplication.desktop().height():
pz += 1
if (w*pz*h*pz - self.width()*(self.height()-self.yoffset)) > \
(self.width()*(self.height()-self.yoffset) - w*(pz-1)*h*(pz-1)):
@@ -226,7 +226,7 @@ class MagWidget(QWidget):
self.width(), self.rgb.height())
if __name__=='__main__':
- app = QApplication( sys.argv )
+ app = TQApplication( sys.argv )
m = MagWidget(app)
app.setMainWidget(m)
m.show()