annotate Tools/pynche/TypeinViewer.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 1d84bf5f9478
children 37d399aa8c16
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9229
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
1 """TypeinViewer class.
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
2
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
3 The TypeinViewer is what you see at the lower right of the main Pynche
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
4 widget. It contains three text entry fields, one each for red, green, blue.
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
5 Input into these windows is highly constrained; it only allows you to enter
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
6 values that are legal for a color axis. This usually means 0-255 for decimal
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
7 input and 0x0 - 0xff for hex input.
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
8
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
9 You can toggle whether you want to view and input the values in either decimal
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
10 or hex by clicking on Hexadecimal. By clicking on Update while typing, the
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
11 color selection will be made on every change to the text field. Otherwise,
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
12 you must hit Return or Tab to select the color.
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
13 """
2e3712e84781 Docstring
Barry Warsaw <barry@python.org>
parents: 9186
diff changeset
14
7227
045ffa4c56f7 Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
15 from Tkinter import *
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
16
7227
045ffa4c56f7 Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
17
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
18
9172
9fd2bbd4454e Got updating with Return/Tab working
Barry Warsaw <barry@python.org>
parents: 9171
diff changeset
19 class TypeinViewer:
9427
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
20 def __init__(self, switchboard, master=None):
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
21 # non-gui ivars
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
22 self.__sb = switchboard
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
23 optiondb = switchboard.optiondb()
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
24 self.__hexp = BooleanVar()
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
25 self.__hexp.set(optiondb.get('HEXTYPE', 0))
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
26 self.__uwtyping = BooleanVar()
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
27 self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0))
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
28 # create the gui
9427
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
29 self.__frame = Frame(master, relief=RAISED, borderwidth=1)
9436
49623da3c63f sticky should be NSEW to fix pixel weirdness at right edge
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
30 self.__frame.grid(row=3, column=1, sticky='NSEW')
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
31 # Red
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
32 self.__xl = Label(self.__frame, text='Red:')
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
33 self.__xl.grid(row=0, column=0, sticky=E)
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
34 subframe = Frame(self.__frame)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
35 subframe.grid(row=0, column=1)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
36 self.__xox = Label(subframe, text='0x')
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
37 self.__xox.grid(row=0, column=0, sticky=E)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
38 self.__xox['font'] = 'courier'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
39 self.__x = Entry(subframe, width=3)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
40 self.__x.grid(row=0, column=1)
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
41 self.__x.bindtags(self.__x.bindtags() + ('Normalize', 'Update'))
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
42 self.__x.bind_class('Normalize', '<Key>', self.__normalize)
9172
9fd2bbd4454e Got updating with Return/Tab working
Barry Warsaw <barry@python.org>
parents: 9171
diff changeset
43 self.__x.bind_class('Update' , '<Key>', self.__maybeupdate)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
44 # Green
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
45 self.__yl = Label(self.__frame, text='Green:')
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
46 self.__yl.grid(row=1, column=0, sticky=E)
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
47 subframe = Frame(self.__frame)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
48 subframe.grid(row=1, column=1)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
49 self.__yox = Label(subframe, text='0x')
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
50 self.__yox.grid(row=0, column=0, sticky=E)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
51 self.__yox['font'] = 'courier'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
52 self.__y = Entry(subframe, width=3)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
53 self.__y.grid(row=0, column=1)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
54 self.__y.bindtags(self.__y.bindtags() + ('Normalize', 'Update'))
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
55 # Blue
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
56 self.__zl = Label(self.__frame, text='Blue:')
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
57 self.__zl.grid(row=2, column=0, sticky=E)
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
58 subframe = Frame(self.__frame)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
59 subframe.grid(row=2, column=1)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
60 self.__zox = Label(subframe, text='0x')
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
61 self.__zox.grid(row=0, column=0, sticky=E)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
62 self.__zox['font'] = 'courier'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
63 self.__z = Entry(subframe, width=3)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
64 self.__z.grid(row=0, column=1)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
65 self.__z.bindtags(self.__z.bindtags() + ('Normalize', 'Update'))
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
66 # Update while typing?
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
67 self.__uwt = Checkbutton(self.__frame,
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
68 text='Update while typing',
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
69 variable=self.__uwtyping)
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
70 self.__uwt.grid(row=3, column=0, columnspan=2, sticky=W)
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
71 # Hex/Dec
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
72 self.__hex = Checkbutton(self.__frame,
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
73 text='Hexadecimal',
9182
e75e228f8395 Fixed toggle b/w hex and decimal
Barry Warsaw <barry@python.org>
parents: 9178
diff changeset
74 variable=self.__hexp,
e75e228f8395 Fixed toggle b/w hex and decimal
Barry Warsaw <barry@python.org>
parents: 9178
diff changeset
75 command=self.__togglehex)
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
76 self.__hex.grid(row=4, column=0, columnspan=2, sticky=W)
7235
debe8e081260 #Layout looks good, as does validation, and delegate chaining
Barry Warsaw <barry@python.org>
parents: 7227
diff changeset
77
9182
e75e228f8395 Fixed toggle b/w hex and decimal
Barry Warsaw <barry@python.org>
parents: 9178
diff changeset
78 def __togglehex(self, event=None):
9247
b4872bc8d9ef __togglehex(): Simplify
Barry Warsaw <barry@python.org>
parents: 9245
diff changeset
79 red, green, blue = self.__sb.current_rgb()
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
80 if self.__hexp.get():
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
81 label = '0x'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
82 else:
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
83 label = ' '
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
84 self.__xox['text'] = label
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
85 self.__yox['text'] = label
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
86 self.__zox['text'] = label
9247
b4872bc8d9ef __togglehex(): Simplify
Barry Warsaw <barry@python.org>
parents: 9245
diff changeset
87 self.update_yourself(red, green, blue)
9182
e75e228f8395 Fixed toggle b/w hex and decimal
Barry Warsaw <barry@python.org>
parents: 9178
diff changeset
88
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
89 def __normalize(self, event=None):
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
90 ew = event.widget
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
91 contents = ew.get()
9243
048002f27c1d __normalize(): Preserve the location of the icursor and restore it so
Barry Warsaw <barry@python.org>
parents: 9229
diff changeset
92 icursor = ew.index(INSERT)
16397
0bb58cdfa688 Special case around some of the nastier annoyances with the type-in
Barry Warsaw <barry@python.org>
parents: 9436
diff changeset
93 if contents and contents[0] in 'xX' and self.__hexp.get():
9270
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
94 contents = '0' + contents
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
95 # Figure out the contents in the current base.
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
96 try:
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
97 if self.__hexp.get():
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
98 v = int(contents, 16)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
99 else:
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
100 v = int(contents)
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
101 except ValueError:
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
102 v = None
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
103 # If value is not legal, or empty, delete the last character inserted
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
104 # and ring the bell. Don't ring the bell if the field is empty (it'll
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
105 # just equal zero.
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
106 if v is None:
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
107 pass
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
108 elif v < 0 or v > 255:
9182
e75e228f8395 Fixed toggle b/w hex and decimal
Barry Warsaw <barry@python.org>
parents: 9178
diff changeset
109 i = ew.index(INSERT)
9270
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
110 if event.char:
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
111 contents = contents[:i-1] + contents[i:]
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
112 icursor -= 1
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
113 ew.bell()
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
114 elif self.__hexp.get():
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
115 contents = hex(v)[2:]
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
116 else:
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
117 contents = int(v)
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
118 ew.delete(0, END)
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
119 ew.insert(0, contents)
9243
048002f27c1d __normalize(): Preserve the location of the icursor and restore it so
Barry Warsaw <barry@python.org>
parents: 9229
diff changeset
120 ew.icursor(icursor)
7227
045ffa4c56f7 Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
121
9172
9fd2bbd4454e Got updating with Return/Tab working
Barry Warsaw <barry@python.org>
parents: 9171
diff changeset
122 def __maybeupdate(self, event=None):
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
123 if self.__uwtyping.get() or event.keysym in ('Return', 'Tab'):
9172
9fd2bbd4454e Got updating with Return/Tab working
Barry Warsaw <barry@python.org>
parents: 9171
diff changeset
124 self.__update(event)
9fd2bbd4454e Got updating with Return/Tab working
Barry Warsaw <barry@python.org>
parents: 9171
diff changeset
125
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
126 def __update(self, event=None):
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
127 redstr = self.__x.get() or '0'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
128 greenstr = self.__y.get() or '0'
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
129 bluestr = self.__z.get() or '0'
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
130 if self.__hexp.get():
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
131 base = 16
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
132 else:
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
133 base = 10
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
134 red, green, blue = [int(x, base) for x in (redstr, greenstr, bluestr)]
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
135 self.__sb.update_views(red, green, blue)
7227
045ffa4c56f7 Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
136
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
137 def update_yourself(self, red, green, blue):
9178
0625b9958b23 Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9172
diff changeset
138 if self.__hexp.get():
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
139 sred, sgreen, sblue = [hex(x)[2:] for x in (red, green, blue)]
9171
3ce511ba4242 Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7702
diff changeset
140 else:
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
141 sred, sgreen, sblue = red, green, blue
9270
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
142 x, y, z = self.__x, self.__y, self.__z
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
143 xicursor = x.index(INSERT)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
144 yicursor = y.index(INSERT)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
145 zicursor = z.index(INSERT)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
146 x.delete(0, END)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
147 y.delete(0, END)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
148 z.delete(0, END)
18464
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
149 x.insert(0, sred)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
150 y.insert(0, sgreen)
c1a5e5175907 Change the way hex type-ins are displayed. The old way was way too
Barry Warsaw <barry@python.org>
parents: 16397
diff changeset
151 z.insert(0, sblue)
9270
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
152 x.icursor(xicursor)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
153 y.icursor(yicursor)
72441113243a Fixes for some type-in strangeness
Barry Warsaw <barry@python.org>
parents: 9247
diff changeset
154 z.icursor(zicursor)
9244
159f9e746754 hexp(): New function
Barry Warsaw <barry@python.org>
parents: 9243
diff changeset
155
9245
8a885f3a5f46 hexp() => hexp_var()
Barry Warsaw <barry@python.org>
parents: 9244
diff changeset
156 def hexp_var(self):
8a885f3a5f46 hexp() => hexp_var()
Barry Warsaw <barry@python.org>
parents: 9244
diff changeset
157 return self.__hexp
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
158
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
159 def save_options(self, optiondb):
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
160 optiondb['HEXTYPE'] = self.__hexp.get()
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9270
diff changeset
161 optiondb['UPWHILETYPE'] = self.__uwtyping.get()