Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by

Févry Thibault.
This commit is contained in:
Serhiy Storchaka 2013-07-15 12:37:43 +03:00
commit 6180a2f453
3 changed files with 18 additions and 14 deletions

View file

@ -1248,6 +1248,7 @@ Mikhail Terekhov
Victor Terrón Victor Terrón
Richard M. Tew Richard M. Tew
Tobias Thelen Tobias Thelen
Févry Thibault
Lowe Thiderman Lowe Thiderman
Nicolas M. Thiéry Nicolas M. Thiéry
James Thomas James Thomas

View file

@ -656,6 +656,9 @@ Build
Tools/Demos Tools/Demos
----------- -----------
- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by
Févry Thibault.
- Issue #12990: The "Python Launcher" on OSX could not launch python scripts - Issue #12990: The "Python Launcher" on OSX could not launch python scripts
that have paths that include wide characters. that have paths that include wide characters.

View file

@ -79,10 +79,10 @@ class Sheet:
del self.cells[xy] del self.cells[xy]
def clearrows(self, y1, y2): def clearrows(self, y1, y2):
self.clearcells(0, y1, sys.maxint, y2) self.clearcells(0, y1, sys.maxsize, y2)
def clearcolumns(self, x1, x2): def clearcolumns(self, x1, x2):
self.clearcells(x1, 0, x2, sys.maxint) self.clearcells(x1, 0, x2, sys.maxsize)
def selectcells(self, x1, y1, x2, y2): def selectcells(self, x1, y1, x2, y2):
if x1 > x2: if x1 > x2:
@ -113,23 +113,23 @@ class Sheet:
def insertrows(self, y, n): def insertrows(self, y, n):
assert n > 0 assert n > 0
self.movecells(0, y, sys.maxint, sys.maxint, 0, n) self.movecells(0, y, sys.maxsize, sys.maxsize, 0, n)
def deleterows(self, y1, y2): def deleterows(self, y1, y2):
if y1 > y2: if y1 > y2:
y1, y2 = y2, y1 y1, y2 = y2, y1
self.clearrows(y1, y2) self.clearrows(y1, y2)
self.movecells(0, y2+1, sys.maxint, sys.maxint, 0, y1-y2-1) self.movecells(0, y2+1, sys.maxsize, sys.maxsize, 0, y1-y2-1)
def insertcolumns(self, x, n): def insertcolumns(self, x, n):
assert n > 0 assert n > 0
self.movecells(x, 0, sys.maxint, sys.maxint, n, 0) self.movecells(x, 0, sys.maxsize, sys.maxsize, n, 0)
def deletecolumns(self, x1, x2): def deletecolumns(self, x1, x2):
if x1 > x2: if x1 > x2:
x1, x2 = x2, x1 x1, x2 = x2, x1
self.clearcells(x1, x2) self.clearcells(x1, x2)
self.movecells(x2+1, 0, sys.maxint, sys.maxint, x1-x2-1, 0) self.movecells(x2+1, 0, sys.maxsize, sys.maxsize, x1-x2-1, 0)
def getsize(self): def getsize(self):
maxx = maxy = 0 maxx = maxy = 0
@ -626,29 +626,29 @@ class SheetGUI:
def selectall(self, event): def selectall(self, event):
self.setcurrent(1, 1) self.setcurrent(1, 1)
self.setcorner(sys.maxint, sys.maxint) self.setcorner(sys.maxsize, sys.maxsize)
def selectcolumn(self, event): def selectcolumn(self, event):
x, y = self.whichxy(event) x, y = self.whichxy(event)
self.setcurrent(x, 1) self.setcurrent(x, 1)
self.setcorner(x, sys.maxint) self.setcorner(x, sys.maxsize)
def extendcolumn(self, event): def extendcolumn(self, event):
x, y = self.whichxy(event) x, y = self.whichxy(event)
if x > 0: if x > 0:
self.setcurrent(self.currentxy[0], 1) self.setcurrent(self.currentxy[0], 1)
self.setcorner(x, sys.maxint) self.setcorner(x, sys.maxsize)
def selectrow(self, event): def selectrow(self, event):
x, y = self.whichxy(event) x, y = self.whichxy(event)
self.setcurrent(1, y) self.setcurrent(1, y)
self.setcorner(sys.maxint, y) self.setcorner(sys.maxsize, y)
def extendrow(self, event): def extendrow(self, event):
x, y = self.whichxy(event) x, y = self.whichxy(event)
if y > 0: if y > 0:
self.setcurrent(1, self.currentxy[1]) self.setcurrent(1, self.currentxy[1])
self.setcorner(sys.maxint, y) self.setcorner(sys.maxsize, y)
def press(self, event): def press(self, event):
x, y = self.whichxy(event) x, y = self.whichxy(event)
@ -709,14 +709,14 @@ class SheetGUI:
self.setbeacon(x1, y1, x2, y2) self.setbeacon(x1, y1, x2, y2)
def setbeacon(self, x1, y1, x2, y2): def setbeacon(self, x1, y1, x2, y2):
if x1 == y1 == 1 and x2 == y2 == sys.maxint: if x1 == y1 == 1 and x2 == y2 == sys.maxsize:
name = ":" name = ":"
elif (x1, x2) == (1, sys.maxint): elif (x1, x2) == (1, sys.maxsize):
if y1 == y2: if y1 == y2:
name = "%d" % y1 name = "%d" % y1
else: else:
name = "%d:%d" % (y1, y2) name = "%d:%d" % (y1, y2)
elif (y1, y2) == (1, sys.maxint): elif (y1, y2) == (1, sys.maxsize):
if x1 == x2: if x1 == x2:
name = "%s" % colnum2name(x1) name = "%s" % colnum2name(x1)
else: else: