summaryrefslogtreecommitdiffstats
path: root/examples3/tablestatistics.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/tablestatistics.py
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples3/tablestatistics.py')
-rwxr-xr-xexamples3/tablestatistics.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/examples3/tablestatistics.py b/examples3/tablestatistics.py
index 49f82ae..c0aa072 100755
--- a/examples3/tablestatistics.py
+++ b/examples3/tablestatistics.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.
#**
#*****************************************************************************/
@@ -36,9 +36,9 @@ dirs = (
"canvas",
)
-class Table(QTable):
+class Table(TQTable):
def __init__(self):
- QTable.__init__(self, 0, TB_COLS)
+ TQTable.__init__(self, 0, TB_COLS)
self.setSorting(TRUE)
self.horizontalHeader().setLabel(TB_FILE, self.tr("File"))
self.horizontalHeader().setLabel(TB_SIZE, self.tr("Size (bytes)"))
@@ -50,12 +50,12 @@ class Table(QTable):
self.connect(self, SIGNAL("valueChanged(int, int)"), self.recalcSum)
def initTable(self):
- # read all the Qt source and header files into a list
+ # read all the TQt source and header files into a list
all = []
qtdir = os.getenv("QTDIR")
for i in dirs:
- dir = QDir(os.path.join(qtdir, "src", i))
- lst = QStringList(dir.entryList("*.cpp; *.h"))
+ dir = TQDir(os.path.join(qtdir, "src", i))
+ lst = TQStringList(dir.entryList("*.cpp; *.h"))
for f in lst:
if f.contains("moc"):
continue
@@ -69,9 +69,9 @@ class Table(QTable):
# insert the data into the table
for it in all:
self.setText(i, TB_FILE, it)
- f = QFile(os.path.join(qtdir, "src", str(it)))
+ f = TQFile(os.path.join(qtdir, "src", str(it)))
self.setText(i, TB_SIZE, str(f.size()))
- ci = ComboItem(self, QTableItem.WhenCurrent)
+ ci = ComboItem(self, TQTableItem.WhenCurrent)
self.setItem(i, TB_FLAG, ci)
i = i + 1
sum += f.size()
@@ -91,9 +91,9 @@ class Table(QTable):
def displaySum(self, sum):
# insert calculated data
- i1 = TableItem(self, QTableItem.Never, self.tr("Sum"))
+ i1 = TableItem(self, TQTableItem.Never, self.tr("Sum"))
self.setItem(self.numRows()-1, TB_FILE, i1)
- i2 = TableItem(self, QTableItem.Never, str(sum))
+ i2 = TableItem(self, TQTableItem.Never, str(sum))
self.setItem(self.numRows()-1, TB_SIZE, i2)
def sortColumn(self, col, ascending, wholeRows):
@@ -101,35 +101,35 @@ class Table(QTable):
self.clearCell(self.numRows()-1, TB_FILE)
self.clearCell(self.numRows()-1, TB_SIZE)
# do sort
- QTable.sortColumn(self, col, ascending, TRUE)
+ TQTable.sortColumn(self, col, ascending, TRUE)
# re-insert sum row
self.recalcSum(0, TB_SIZE)
-class TableItem(QTableItem):
+class TableItem(TQTableItem):
def __init__(self, *args):
- apply(QTableItem.__init__, (self,) + args)
+ apply(TQTableItem.__init__, (self,) + args)
def paint(self, p, cg, cr, selected):
- g = QColorGroup(cg)
+ g = TQColorGroup(cg)
# last row is the sum row - we want to make it more visible by
# using a red background
if self.row() == self.table().numRows()-1:
- g.setColor(QColorGroup.Base, QColor("red"))
- QTableItem.paint(self, p, g, cr, selected)
+ g.setColor(TQColorGroup.Base, TQColor("red"))
+ TQTableItem.paint(self, p, g, cr, selected)
-class ComboItem(QTableItem):
+class ComboItem(TQTableItem):
def __init__(self, t, et):
- QTableItem.__init__(self, t, et, "Yes")
+ TQTableItem.__init__(self, t, et, "Yes")
self.cb = None
# we do not want this item to be replaced
self.setReplaceable(FALSE)
def createEditor(self):
# create an editor - a combobox in our case
- self.cb = QComboBox(self.table().viewport())
- QObject.connect(self.cb, SIGNAL("activated(int)"),
+ self.cb = TQComboBox(self.table().viewport())
+ TQObject.connect(self.cb, SIGNAL("activated(int)"),
self.table(), SLOT("doValueChanged()"))
self.cb.insertItem("Yes")
self.cb.insertItem("No")
@@ -143,10 +143,10 @@ class ComboItem(QTableItem):
def setContentFromEditor(self, w):
# the user changed the value of the combobox, so synchronize the
# value of the item (its text), with the value of the combobox
- if w.inherits("QComboBox"):
+ if w.inherits("TQComboBox"):
self.setText(w.currentText())
else:
- QTableItem.setContentFromEditor(self, w)
+ TQTableItem.setContentFromEditor(self, w)
def setText(self, s):
# initialize the combobox from the text
@@ -155,11 +155,11 @@ class ComboItem(QTableItem):
self.cb.setCurrentItem(1)
else:
self.cb.setCurrentItem(0)
- QTableItem.setText(self, s)
+ TQTableItem.setText(self, s)
if __name__ == '__main__':
- app = QApplication(sys.argv)
+ app = TQApplication(sys.argv)
t = Table()
t.setCaption("Statistics")