diff options
| author | aneejit1 <aneejit1@gmail.com> | 2022-04-19 13:21:52 +0000 |
|---|---|---|
| committer | Slávek Banko <slavek.banko@axis.cz> | 2022-07-28 00:56:02 +0200 |
| commit | 52f8f8436dc2af136156ef95dbb8463481a78df8 (patch) | |
| tree | 50e5f757a67774f98bfa931ef191dcc07683996d /examples3/tablestatistics.py | |
| parent | 228b87ea89625d0783fdfe60114eba89e0f37942 (diff) | |
| download | pytqt-52f8f8436dc2af136156ef95dbb8463481a78df8.tar.gz pytqt-52f8f8436dc2af136156ef95dbb8463481a78df8.zip | |
Updates to support Python version 3
Amendments to the sip source and configuration/build scripts to allow
for support under Python version 3. The examples have been updated
using "2to3" along with some manual changes to sort out intentation
and casting to integer from float.
Signed-off-by: aneejit1 <aneejit1@gmail.com>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 6be046642290c28c17949022fb66ae02ac21d544)
Diffstat (limited to 'examples3/tablestatistics.py')
| -rwxr-xr-x | examples3/tablestatistics.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples3/tablestatistics.py b/examples3/tablestatistics.py index ee1f0f7..b2fe337 100755 --- a/examples3/tablestatistics.py +++ b/examples3/tablestatistics.py @@ -53,6 +53,8 @@ class Table(TQTable): # read all the TQt source and header files into a list all = [] qtdir = os.getenv("QTDIR") + if qtdir is None: + raise Exception("The QTDIR environment variable has not been set.") for i in dirs: dir = TQDir(os.path.join(qtdir, "src", i)) lst = TQStringList(dir.entryList("*.cpp; *.h")) @@ -65,7 +67,7 @@ class Table(TQTable): self.setNumRows(len(all) + 1) i = 0 - sum = 0L + sum = 0 # insert the data into the table for it in all: self.setText(i, TB_FILE, it) @@ -82,11 +84,11 @@ class Table(TQTable): if col < TB_SIZE or col > TB_FLAG: return - sum = 0L + sum = 0 for i in range(self.numRows()-1): if str(self.text(i, TB_FLAG)) == "No": continue - sum += long(str(self.text(i, TB_SIZE))) + sum += int(str(self.text(i, TB_SIZE))) self.displaySum(sum) def displaySum(self, sum): @@ -108,7 +110,7 @@ class Table(TQTable): class TableItem(TQTableItem): def __init__(self, *args): - apply(TQTableItem.__init__, (self,) + args) + TQTableItem.__init__(*(self,) + args) def paint(self, p, cg, cr, selected): g = TQColorGroup(cg) |
