diff options
author | aneejit1 <aneejit1@gmail.com> | 2022-04-19 13:21:52 +0000 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2022-07-27 18:08:53 +0200 |
commit | 6be046642290c28c17949022fb66ae02ac21d544 (patch) | |
tree | e7b38b35a42b27569b26736afc4e472a2a5d672d /examples3/tablestatistics.py | |
parent | 63fe0b82b47e7ee31f91374d96022a3ae77a86c3 (diff) | |
download | pytqt-6be046642290c28c17949022fb66ae02ac21d544.tar.gz pytqt-6be046642290c28c17949022fb66ae02ac21d544.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>
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 e0835bb..d6b6b2e 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("TQTDIR") + if qtdir is None: + raise Exception("The TQTDIR 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) |