Kaydet (Commit) 8934af00 authored tarafından Barry Warsaw's avatar Barry Warsaw

Fixes for some type-in strangeness

üst cd63dc9f
...@@ -67,6 +67,8 @@ class TypeinViewer: ...@@ -67,6 +67,8 @@ class TypeinViewer:
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 @@ class TypeinViewer: ...@@ -79,9 +81,10 @@ class TypeinViewer:
# 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 @@ class TypeinViewer: ...@@ -111,12 +114,19 @@ class TypeinViewer:
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment