mirror of
https://github.com/python/cpython.git
synced 2025-10-25 10:44:55 +00:00
Fixes for some type-in strangeness
This commit is contained in:
parent
cd63dc9f3d
commit
8934af00d8
1 changed files with 18 additions and 8 deletions
|
|
@ -67,6 +67,8 @@ def __normalize(self, event=None):
|
||||||
icursor = ew.index(INSERT)
|
icursor = ew.index(INSERT)
|
||||||
if contents == '':
|
if contents == '':
|
||||||
contents = '0'
|
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
|
# figure out what the contents value is in the current base
|
||||||
try:
|
try:
|
||||||
if self.__hexp.get():
|
if self.__hexp.get():
|
||||||
|
|
@ -79,9 +81,10 @@ def __normalize(self, event=None):
|
||||||
# the bell
|
# the bell
|
||||||
if v is None or v < 0 or v > 255:
|
if v is None or v < 0 or v > 255:
|
||||||
i = ew.index(INSERT)
|
i = ew.index(INSERT)
|
||||||
contents = contents[:i-1] + contents[i:]
|
if event.char:
|
||||||
|
contents = contents[:i-1] + contents[i:]
|
||||||
|
icursor = icursor-1
|
||||||
ew.bell()
|
ew.bell()
|
||||||
icursor = icursor-1
|
|
||||||
elif self.__hexp.get():
|
elif self.__hexp.get():
|
||||||
contents = hex(v)
|
contents = hex(v)
|
||||||
else:
|
else:
|
||||||
|
|
@ -111,12 +114,19 @@ def update_yourself(self, red, green, blue):
|
||||||
redstr, greenstr, bluestr = map(hex, (red, green, blue))
|
redstr, greenstr, bluestr = map(hex, (red, green, blue))
|
||||||
else:
|
else:
|
||||||
redstr, greenstr, bluestr = red, green, blue
|
redstr, greenstr, bluestr = red, green, blue
|
||||||
self.__x.delete(0, END)
|
x, y, z = self.__x, self.__y, self.__z
|
||||||
self.__y.delete(0, END)
|
xicursor = x.index(INSERT)
|
||||||
self.__z.delete(0, END)
|
yicursor = y.index(INSERT)
|
||||||
self.__x.insert(0, redstr)
|
zicursor = z.index(INSERT)
|
||||||
self.__y.insert(0, greenstr)
|
x.delete(0, END)
|
||||||
self.__z.insert(0, bluestr)
|
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):
|
def hexp_var(self):
|
||||||
return self.__hexp
|
return self.__hexp
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue