annotate Tools/pynche/StripViewer.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 8a2ab5f51932
children 63741c7521aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9228
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
1 """Strip viewer and related widgets.
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
2
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 30772
diff changeset
3 The classes in this file implement the StripViewer shown in the top two thirds
9228
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
4 of the main Pynche window. It consists of three StripWidgets which display
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
5 the variations in red, green, and blue respectively of the currently selected
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
6 r/g/b color value.
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
7
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
8 Each StripWidget shows the color variations that are reachable by varying an
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
9 axis of the currently selected color. So for example, if the color is
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
10
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
11 (R,G,B)=(127,163,196)
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
12
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
13 then the Red variations show colors from (0,163,196) to (255,163,196), the
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
14 Green variations show colors from (127,0,196) to (127,255,196), and the Blue
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
15 variations show colors from (127,163,0) to (127,163,255).
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
16
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
17 The selected color is always visible in all three StripWidgets, and in fact
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
18 each StripWidget highlights the selected color, and has an arrow pointing to
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
19 the selected chip, which includes the value along that particular axis.
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
20
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
21 Clicking on any chip in any StripWidget selects that color, and updates all
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
22 arrows and other windows. By toggling on Update while dragging, Pynche will
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
23 select the color under the cursor while you drag it, but be forewarned that
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
24 this can be slow.
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
25 """
a03c6fd81d4d Docstring
Barry Warsaw <barry@python.org>
parents: 9184
diff changeset
26
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
27 from Tkinter import *
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
28 import ColorDB
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
29
7368
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
30 # Load this script into the Tcl interpreter and call it in
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
31 # StripWidget.set_color(). This is about as fast as it can be with the
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
32 # current _tkinter.c interface, which doesn't support Tcl Objects.
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
33 TCLPROC = '''\
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
34 proc setcolor {canv colors} {
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
35 set i 1
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
36 foreach c $colors {
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
37 $canv itemconfigure $i -fill $c -outline $c
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
38 incr i
7368
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
39 }
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
40 }
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
41 '''
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
42
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
43 # Tcl event types
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
44 BTNDOWN = 4
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
45 BTNUP = 5
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
46 BTNDRAG = 6
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
47
18460
00934d62e781 De-string-module-ification.
Barry Warsaw <barry@python.org>
parents: 17567
diff changeset
48 SPACE = ' '
7368
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
49
18460
00934d62e781 De-string-module-ification.
Barry Warsaw <barry@python.org>
parents: 17567
diff changeset
50
00934d62e781 De-string-module-ification.
Barry Warsaw <barry@python.org>
parents: 17567
diff changeset
51
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
52 def constant(numchips):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
53 step = 255.0 / (numchips - 1)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
54 start = 0.0
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
55 seq = []
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
56 while numchips > 0:
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
57 seq.append(int(start))
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
58 start = start + step
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
59 numchips = numchips - 1
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
60 return seq
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
61
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
62 # red variations, green+blue = cyan constant
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
63 def constant_red_generator(numchips, red, green, blue):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
64 seq = constant(numchips)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
65 return map(None, [red] * numchips, seq, seq)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
66
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
67 # green variations, red+blue = magenta constant
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
68 def constant_green_generator(numchips, red, green, blue):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
69 seq = constant(numchips)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
70 return map(None, seq, [green] * numchips, seq)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
71
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
72 # blue variations, red+green = yellow constant
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
73 def constant_blue_generator(numchips, red, green, blue):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
74 seq = constant(numchips)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
75 return map(None, seq, seq, [blue] * numchips)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
76
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
77 # red variations, green+blue = cyan constant
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
78 def constant_cyan_generator(numchips, red, green, blue):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
79 seq = constant(numchips)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
80 return map(None, seq, [green] * numchips, [blue] * numchips)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
81
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
82 # green variations, red+blue = magenta constant
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
83 def constant_magenta_generator(numchips, red, green, blue):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
84 seq = constant(numchips)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
85 return map(None, [red] * numchips, seq, [blue] * numchips)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
86
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
87 # blue variations, red+green = yellow constant
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
88 def constant_yellow_generator(numchips, red, green, blue):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
89 seq = constant(numchips)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
90 return map(None, [red] * numchips, [green] * numchips, seq)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
91
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
92
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
93
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
94 class LeftArrow:
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
95 _ARROWWIDTH = 30
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
96 _ARROWHEIGHT = 15
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
97 _YOFFSET = 13
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
98 _TEXTYOFFSET = 1
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
99 _TAG = ('leftarrow',)
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
100
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
101 def __init__(self, canvas, x):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
102 self._canvas = canvas
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
103 self.__arrow, self.__text = self._create(x)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
104 self.move_to(x)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
105
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
106 def _create(self, x):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
107 arrow = self._canvas.create_line(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
108 x, self._ARROWHEIGHT + self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
109 x, self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
110 x + self._ARROWWIDTH, self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
111 arrow='first',
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
112 width=3.0,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
113 tags=self._TAG)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
114 text = self._canvas.create_text(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
115 x + self._ARROWWIDTH + 13,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
116 self._ARROWHEIGHT - self._TEXTYOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
117 tags=self._TAG,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
118 text='128')
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
119 return arrow, text
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
120
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
121 def _x(self):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
122 coords = self._canvas.coords(self._TAG)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
123 assert coords
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
124 return coords[0]
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
125
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
126 def move_to(self, x):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
127 deltax = x - self._x()
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
128 self._canvas.move(self._TAG, deltax, 0)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
129
7295
285449268c37 get arrow movement, and text updating. also outlining of highlight
Barry Warsaw <barry@python.org>
parents: 7263
diff changeset
130 def set_text(self, text):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
131 self._canvas.itemconfigure(self.__text, text=text)
7295
285449268c37 get arrow movement, and text updating. also outlining of highlight
Barry Warsaw <barry@python.org>
parents: 7263
diff changeset
132
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
133
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
134 class RightArrow(LeftArrow):
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
135 _TAG = ('rightarrow',)
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
136
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
137 def _create(self, x):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
138 arrow = self._canvas.create_line(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
139 x, self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
140 x + self._ARROWWIDTH, self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
141 x + self._ARROWWIDTH, self._ARROWHEIGHT + self._YOFFSET,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
142 arrow='last',
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
143 width=3.0,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
144 tags=self._TAG)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
145 text = self._canvas.create_text(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
146 x - self._ARROWWIDTH + 15, # BAW: kludge
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
147 self._ARROWHEIGHT - self._TEXTYOFFSET,
9266
a0f3325fedf1 RightARrow._create(): justify=RIGHT on the text object
Barry Warsaw <barry@python.org>
parents: 9248
diff changeset
148 justify=RIGHT,
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
149 text='128',
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
150 tags=self._TAG)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
151 return arrow, text
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
152
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
153 def _x(self):
36168
8a2ab5f51932 Ported from 2.4 branch:
Barry Warsaw <barry@python.org>
parents: 35276
diff changeset
154 coords = self._canvas.coords(self._TAG)
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
155 assert coords
36168
8a2ab5f51932 Ported from 2.4 branch:
Barry Warsaw <barry@python.org>
parents: 35276
diff changeset
156 return coords[0] + self._ARROWWIDTH
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
157
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
158
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
159
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
160 class StripWidget:
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
161 _CHIPHEIGHT = 50
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
162 _CHIPWIDTH = 10
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
163 _NUMCHIPS = 40
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
164
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
165 def __init__(self, switchboard,
9427
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
166 master = None,
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
167 chipwidth = _CHIPWIDTH,
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
168 chipheight = _CHIPHEIGHT,
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
169 numchips = _NUMCHIPS,
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
170 generator = None,
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
171 axis = None,
9181
fa893d55794e Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9170
diff changeset
172 label = '',
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
173 uwdvar = None,
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
174 hexvar = None):
9156
daf1d61b9611 formatting
Barry Warsaw <barry@python.org>
parents: 9155
diff changeset
175 # instance variables
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
176 self.__generator = generator
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
177 self.__axis = axis
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
178 self.__numchips = numchips
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
179 assert self.__axis in (0, 1, 2)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
180 self.__uwd = uwdvar
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
181 self.__hexp = hexvar
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
182 # the last chip selected
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
183 self.__lastchip = None
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
184 self.__sb = switchboard
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 30772
diff changeset
185
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
186 canvaswidth = numchips * (chipwidth + 1)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
187 canvasheight = chipheight + 43 # BAW: Kludge
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
188
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
189 # create the canvas and pack it
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
190 canvas = self.__canvas = Canvas(master,
9427
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
191 width=canvaswidth,
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
192 height=canvasheight,
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
193 ## borderwidth=2,
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
194 ## relief=GROOVE
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
195 )
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
196
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
197 canvas.pack()
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
198 canvas.bind('<ButtonPress-1>', self.__select_chip)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
199 canvas.bind('<ButtonRelease-1>', self.__select_chip)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
200 canvas.bind('<B1-Motion>', self.__select_chip)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
201
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
202 # Load a proc into the Tcl interpreter. This is used in the
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
203 # set_color() method to speed up setting the chip colors.
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
204 canvas.tk.eval(TCLPROC)
7368
21657bb0be35 Implementation using TCLPROC loaded into the Tcl interpreter
Barry Warsaw <barry@python.org>
parents: 7347
diff changeset
205
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
206 # create the color strip
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
207 chips = self.__chips = []
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
208 x = 1
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
209 y = 30
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
210 tags = ('chip',)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
211 for c in range(self.__numchips):
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
212 color = 'grey'
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
213 canvas.create_rectangle(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
214 x, y, x+chipwidth, y+chipheight,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
215 fill=color, outline=color,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
216 tags=tags)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
217 x = x + chipwidth + 1 # for outline
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
218 chips.append(color)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
219
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
220 # create the strip label
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
221 self.__label = canvas.create_text(
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
222 3, y + chipheight + 8,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
223 text=label,
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
224 anchor=W)
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
225
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
226 # create the arrow and text item
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
227 chipx = self.__arrow_x(0)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
228 self.__leftarrow = LeftArrow(canvas, chipx)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
229
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
230 chipx = self.__arrow_x(len(chips) - 1)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
231 self.__rightarrow = RightArrow(canvas, chipx)
7263
41a928cbcc5e Initial revision
Barry Warsaw <barry@python.org>
parents:
diff changeset
232
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
233 def __arrow_x(self, chipnum):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
234 coords = self.__canvas.coords(chipnum+1)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
235 assert coords
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
236 x0, y0, x1, y1 = coords
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
237 return (x1 + x0) / 2.0
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
238
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
239 # Invoked when one of the chips is clicked. This should just tell the
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
240 # switchboard to set the color on all the output components
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
241 def __select_chip(self, event=None):
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
242 x = event.x
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
243 y = event.y
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
244 canvas = self.__canvas
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
245 chip = canvas.find_overlapping(x, y, x, y)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
246 if chip and (1 <= chip[0] <= self.__numchips):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
247 color = self.__chips[chip[0]-1]
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
248 red, green, blue = ColorDB.rrggbb_to_triplet(color)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
249 etype = int(event.type)
9181
fa893d55794e Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9170
diff changeset
250 if (etype == BTNUP or self.__uwd.get()):
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
251 # update everyone
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
252 self.__sb.update_views(red, green, blue)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
253 else:
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
254 # just track the arrows
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
255 self.__trackarrow(chip[0], (red, green, blue))
7331
83a30a3583d3 Added chip selection stuff, strip label
Barry Warsaw <barry@python.org>
parents: 7295
diff changeset
256
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
257 def __trackarrow(self, chip, rgbtuple):
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
258 # invert the last chip
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
259 if self.__lastchip is not None:
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
260 color = self.__canvas.itemcget(self.__lastchip, 'fill')
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
261 self.__canvas.itemconfigure(self.__lastchip, outline=color)
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
262 self.__lastchip = chip
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
263 # get the arrow's text
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
264 coloraxis = rgbtuple[self.__axis]
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
265 if self.__hexp.get():
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
266 # hex
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
267 text = hex(coloraxis)
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
268 else:
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
269 # decimal
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
270 text = repr(coloraxis)
35276
4adbd331d335 Fix all wrong instances of "it's".
Georg Brandl <georg@python.org>
parents: 32736
diff changeset
271 # move the arrow, and set its text
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
272 if coloraxis <= 128:
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
273 # use the left arrow
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
274 self.__leftarrow.set_text(text)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
275 self.__leftarrow.move_to(self.__arrow_x(chip-1))
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
276 self.__rightarrow.move_to(-100)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
277 else:
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
278 # use the right arrow
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
279 self.__rightarrow.set_text(text)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
280 self.__rightarrow.move_to(self.__arrow_x(chip-1))
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
281 self.__leftarrow.move_to(-100)
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
282 # and set the chip's outline
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
283 brightness = ColorDB.triplet_to_brightness(rgbtuple)
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
284 if brightness <= 128:
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
285 outline = 'white'
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
286 else:
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
287 outline = 'black'
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
288 self.__canvas.itemconfigure(chip, outline=outline)
7701
2cc4bc0cd036 Add option for no updates on dragging
Barry Warsaw <barry@python.org>
parents: 7370
diff changeset
289
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
290
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
291 def update_yourself(self, red, green, blue):
30772
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
292 assert self.__generator
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
293 i = 1
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
294 chip = 0
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
295 chips = self.__chips = []
897afcacba00 Patch #812378: Normalize white space.
Martin v. Löwis <martin@v.loewis.de>
parents: 18460
diff changeset
296 tk = self.__canvas.tk
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
297 # get the red, green, and blue components for all chips
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
298 for t in self.__generator(self.__numchips, red, green, blue):
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
299 rrggbb = ColorDB.triplet_to_rrggbb(t)
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
300 chips.append(rrggbb)
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
301 tred, tgreen, tblue = t
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
302 if tred <= red and tgreen <= green and tblue <= blue:
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
303 chip = i
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
304 i = i + 1
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
305 # call the raw tcl script
18460
00934d62e781 De-string-module-ification.
Barry Warsaw <barry@python.org>
parents: 17567
diff changeset
306 colors = SPACE.join(chips)
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
307 tk.eval('setcolor %s {%s}' % (self.__canvas._w, colors))
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
308 # move the arrows around
9155
3529bb4caefd Un PMW-ified
Barry Warsaw <barry@python.org>
parents: 7716
diff changeset
309 self.__trackarrow(chip, (red, green, blue))
7715
388b097bddb9 No update while dragging still tracks the arrows
Barry Warsaw <barry@python.org>
parents: 7701
diff changeset
310
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
311 def set(self, label, generator):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
312 self.__canvas.itemconfigure(self.__label, text=label)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
313 self.__generator = generator
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
314
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
315
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
316 class StripViewer:
9427
7567ef40de77 Many changes to support a second mode of operation. Pynche can now be
Barry Warsaw <barry@python.org>
parents: 9414
diff changeset
317 def __init__(self, switchboard, master=None):
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
318 self.__sb = switchboard
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
319 optiondb = switchboard.optiondb()
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
320 # create a frame inside the master.
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
321 frame = Frame(master, relief=RAISED, borderwidth=1)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
322 frame.grid(row=1, column=0, columnspan=2, sticky='NSEW')
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
323 # create the options to be used later
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
324 uwd = self.__uwdvar = BooleanVar()
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
325 uwd.set(optiondb.get('UPWHILEDRAG', 0))
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
326 hexp = self.__hexpvar = BooleanVar()
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
327 hexp.set(optiondb.get('HEXSTRIP', 0))
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
328 # create the red, green, blue strips inside their own frame
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
329 frame1 = Frame(frame)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
330 frame1.pack(expand=YES, fill=BOTH)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
331 self.__reds = StripWidget(switchboard, frame1,
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
332 generator=constant_cyan_generator,
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
333 axis=0,
9181
fa893d55794e Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9170
diff changeset
334 label='Red Variations',
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
335 uwdvar=uwd, hexvar=hexp)
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
336
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
337 self.__greens = StripWidget(switchboard, frame1,
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
338 generator=constant_magenta_generator,
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
339 axis=1,
9181
fa893d55794e Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9170
diff changeset
340 label='Green Variations',
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
341 uwdvar=uwd, hexvar=hexp)
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
342
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
343 self.__blues = StripWidget(switchboard, frame1,
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
344 generator=constant_yellow_generator,
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
345 axis=2,
9181
fa893d55794e Added options to visible window
Barry Warsaw <barry@python.org>
parents: 9170
diff changeset
346 label='Blue Variations',
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
347 uwdvar=uwd, hexvar=hexp)
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
348
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
349 # create a frame to contain the controls
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
350 frame2 = Frame(frame)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
351 frame2.pack(expand=YES, fill=BOTH)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
352 frame2.columnconfigure(0, weight=20)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
353 frame2.columnconfigure(2, weight=20)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
354
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
355 padx = 8
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
356
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
357 # create the black button
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
358 blackbtn = Button(frame2,
10755
bfa0c743347a Change Black/White button labels to not include the arrow
Barry Warsaw <barry@python.org>
parents: 9638
diff changeset
359 text='Black',
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
360 command=self.__toblack)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
361 blackbtn.grid(row=0, column=0, rowspan=2, sticky=W, padx=padx)
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
362
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
363 # create the controls
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
364 uwdbtn = Checkbutton(frame2,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
365 text='Update while dragging',
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
366 variable=uwd)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
367 uwdbtn.grid(row=0, column=1, sticky=W)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
368 hexbtn = Checkbutton(frame2,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
369 text='Hexadecimal',
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
370 variable=hexp,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
371 command=self.__togglehex)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
372 hexbtn.grid(row=1, column=1, sticky=W)
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
373
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
374 # XXX: ignore this feature for now; it doesn't work quite right yet
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 30772
diff changeset
375
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
376 ## gentypevar = self.__gentypevar = IntVar()
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
377 ## self.__variations = Radiobutton(frame,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
378 ## text='Variations',
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
379 ## variable=gentypevar,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
380 ## value=0,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
381 ## command=self.__togglegentype)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
382 ## self.__variations.grid(row=0, column=1, sticky=W)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
383 ## self.__constants = Radiobutton(frame,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
384 ## text='Constants',
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
385 ## variable=gentypevar,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
386 ## value=1,
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
387 ## command=self.__togglegentype)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
388 ## self.__constants.grid(row=1, column=1, sticky=W)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
389
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
390 # create the white button
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
391 whitebtn = Button(frame2,
10755
bfa0c743347a Change Black/White button labels to not include the arrow
Barry Warsaw <barry@python.org>
parents: 9638
diff changeset
392 text='White',
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
393 command=self.__towhite)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
394 whitebtn.grid(row=0, column=2, rowspan=2, sticky=E, padx=padx)
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
395
9162
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
396 def update_yourself(self, red, green, blue):
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
397 self.__reds.update_yourself(red, green, blue)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
398 self.__greens.update_yourself(red, green, blue)
e2daa783bd47 Updated to new post-PMW framework. Moved generators to here and added
Barry Warsaw <barry@python.org>
parents: 9156
diff changeset
399 self.__blues.update_yourself(red, green, blue)
9248
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
400
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
401 def __togglehex(self, event=None):
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
402 red, green, blue = self.__sb.current_rgb()
e19954ba1bc4 Added a hex button so arrow numbers can display in decimal or hex.
Barry Warsaw <barry@python.org>
parents: 9228
diff changeset
403 self.update_yourself(red, green, blue)
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
404
17567
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
405 ## def __togglegentype(self, event=None):
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
406 ## which = self.__gentypevar.get()
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
407 ## if which == 0:
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
408 ## self.__reds.set(label='Red Variations',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
409 ## generator=constant_cyan_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
410 ## self.__greens.set(label='Green Variations',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
411 ## generator=constant_magenta_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
412 ## self.__blues.set(label='Blue Variations',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
413 ## generator=constant_yellow_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
414 ## elif which == 1:
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
415 ## self.__reds.set(label='Red Constant',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
416 ## generator=constant_red_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
417 ## self.__greens.set(label='Green Constant',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
418 ## generator=constant_green_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
419 ## self.__blues.set(label='Blue Constant',
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
420 ## generator=constant_blue_generator)
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
421 ## else:
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
422 ## assert 0
d944423e6fff StripWidget.__init__(), update_yourself(): Removed some unused local
Barry Warsaw <barry@python.org>
parents: 10755
diff changeset
423 ## self.__sb.update_views_current()
9638
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
424
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
425 def __toblack(self, event=None):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
426 self.__sb.update_views(0, 0, 0)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
427
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
428 def __towhite(self, event=None):
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
429 self.__sb.update_views(255, 255, 255)
f9cc52374c52 Added most of the mechanism to change the strips from color variations
Barry Warsaw <barry@python.org>
parents: 9427
diff changeset
430
9414
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
431 def save_options(self, optiondb):
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
432 optiondb['UPWHILEDRAG'] = self.__uwdvar.get()
c03ffff387f8 Saving/Restoring state into ~/.pynche file
Barry Warsaw <barry@python.org>
parents: 9266
diff changeset
433 optiondb['HEXSTRIP'] = self.__hexpvar.get()