ChipWidget.__init__(): Added a message area just below the color
name. Both the message and name widgets are now FLAT, DISABLED
Entry widgets instead of Labels. This allows users to
copy-n-paste the color names or color specs. Also, the contents
of both widgets are now driven by StringVars.
set_color(): This only sets the chip color; it does not set the name
widgets.
set_name(): New method which only sets the name widget contents.
set_message(): New method which only sets the message widget contents.
ChipViewer.update_yourself(): Set the color, name, and message for
each chip as follows: the first line always contains the color
spec in #rrggbb format. The second line will contain the color
name, but slightly differently for each widget. For the Selected
widget, if the color exactly matches the Nearest color, the name
is shown, otherwise the message field will be empty. The name
field of the Nearest widget will always contain the color name.
You can switch database by just loading the new one; the list window
and nearest colors adapt to the new database.
Some reorganizing of code. Also, the name of the database file is
stored in the ~/.pynche pickle. If it can't be loaded, fallbacks are
used.
run either as a standalone application (by running pynche or
pynche.pyw), or as a modal dialog inside another application. This
can be done by importing pyColorChooser and running askcolor(). The
API for this is the same as the tkColorChooser.askcolor() API, namely:
When `Okay' is hit, askcolor() returns ((r, g, b), "name"). When
`Cancel' is hit, askcolor() returns (None, None).
Note the following differences:
1. pyColorChooser.askcolor() takes an optional keyword `master'
which if set tells Pynche to run as a modal dialog. `master'
is a Tkinter parent window. Without the `master' keyword
Pynche runs standalone.
2. in pyColorChooser.askcolor() will return a Tk/X11 color name as
"name" if there is an exact match, otherwise it will return a
color spec, e.g. "#rrggbb". tkColorChooser can't return a
color name.
There are also some UI differences when running standalone vs. modal.
When modal, there is no "File" menu, but instead there are "Okay" and
"Cancel" buttons.
The implementation of all this is a bit of a hack, but it seems to
work moderately well. I'm not guaranteeing the pyColorChooser.Chooser
class has the same semantics as the tkColorChooser.Chooser class.