summaryrefslogtreecommitdiffstats
path: root/Tools/pynche
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1998-10-07 02:44:17 (GMT)
committerBarry Warsaw <barry@python.org>1998-10-07 02:44:17 (GMT)
commit8934af00d8a99e606729b96c34e8da6fb9c9123c (patch)
treebdb02922e002a0c3a04f6f31e4d1a7c961d81736 /Tools/pynche
parentcd63dc9f3d3749a31e22870e3792e82856e7dc06 (diff)
downloadcpython-8934af00d8a99e606729b96c34e8da6fb9c9123c.zip
cpython-8934af00d8a99e606729b96c34e8da6fb9c9123c.tar.gz
cpython-8934af00d8a99e606729b96c34e8da6fb9c9123c.tar.bz2
Fixes for some type-in strangeness
Diffstat (limited to 'Tools/pynche')
-rw-r--r--Tools/pynche/TypeinViewer.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/Tools/pynche/TypeinViewer.py b/Tools/pynche/TypeinViewer.py
index 6e50f0f..20fba88 100644
--- a/Tools/pynche/TypeinViewer.py
+++ b/Tools/pynche/TypeinViewer.py
@@ -67,6 +67,8 @@ class TypeinViewer:
icursor = ew.index(INSERT)
if contents == '':
contents = '0'
+ if contents[0] in 'xX' and self.__hexp.get():
+ contents = '0' + contents
# figure out what the contents value is in the current base
try:
if self.__hexp.get():
@@ -79,9 +81,10 @@ class TypeinViewer:
# the bell
if v is None or v < 0 or v > 255:
i = ew.index(INSERT)
- contents = contents[:i-1] + contents[i:]
+ if event.char:
+ contents = contents[:i-1] + contents[i:]
+ icursor = icursor-1
ew.bell()
- icursor = icursor-1
elif self.__hexp.get():
contents = hex(v)
else:
@@ -111,12 +114,19 @@ class TypeinViewer:
redstr, greenstr, bluestr = map(hex, (red, green, blue))
else:
redstr, greenstr, bluestr = red, green, blue
- self.__x.delete(0, END)
- self.__y.delete(0, END)
- self.__z.delete(0, END)
- self.__x.insert(0, redstr)
- self.__y.insert(0, greenstr)
- self.__z.insert(0, bluestr)
+ x, y, z = self.__x, self.__y, self.__z
+ xicursor = x.index(INSERT)
+ yicursor = y.index(INSERT)
+ zicursor = z.index(INSERT)
+ x.delete(0, END)
+ y.delete(0, END)
+ z.delete(0, END)
+ x.insert(0, redstr)
+ y.insert(0, greenstr)
+ z.insert(0, bluestr)
+ x.icursor(xicursor)
+ y.icursor(yicursor)
+ z.icursor(zicursor)
def hexp_var(self):
return self.__hexp