summaryrefslogtreecommitdiffstats
path: root/Tools/pynche
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-04-27 18:56:35 (GMT)
committerBarry Warsaw <barry@python.org>1999-04-27 18:56:35 (GMT)
commit80d83e38ab8000bfcfcb92a1b228b143a8f7b231 (patch)
tree13f0a03a8fe08eddd13a7d40ca43a4317ab3ab87 /Tools/pynche
parent9af697b85dacccfcc1a2d8968b5a4000ff66c1ff (diff)
downloadcpython-80d83e38ab8000bfcfcb92a1b228b143a8f7b231.zip
cpython-80d83e38ab8000bfcfcb92a1b228b143a8f7b231.tar.gz
cpython-80d83e38ab8000bfcfcb92a1b228b143a8f7b231.tar.bz2
askcolor(): databasefile and wantspec can now be set on every
invocation, instead of just the first.
Diffstat (limited to 'Tools/pynche')
-rw-r--r--Tools/pynche/pyColorChooser.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/Tools/pynche/pyColorChooser.py b/Tools/pynche/pyColorChooser.py
index c487b0e..788ad5a 100644
--- a/Tools/pynche/pyColorChooser.py
+++ b/Tools/pynche/pyColorChooser.py
@@ -20,7 +20,14 @@ class Chooser:
self.__pw = None
self.__wantspec = wantspec
- def show(self, color=None):
+ def show(self, color, options):
+ # scan for options that can override the ctor options
+ self.__wantspec = options.get('wantspec', self.__wantspec)
+ dbfile = options.get('databasefile', self.__databasefile)
+ # load the database file
+ colordb = None
+ if dbfile <> self.__databasefile:
+ colordb = ColorDB.get_colordb(dbfile)
if not self.__master:
from Tkinter import Tk
self.__master = Tk()
@@ -32,7 +39,10 @@ class Chooser:
else:
self.__pw.deiconify()
# convert color
- colordb = self.__sb.colordb()
+ if colordb:
+ self.__sb.set_colordb(colordb)
+ else:
+ colordb = self.__sb.colordb()
if color:
r, g, b = Main.initial_color(color, colordb)
self.__sb.update_views(r, g, b)
@@ -70,7 +80,7 @@ def askcolor(color = None, **options):
global _chooser
if not _chooser:
_chooser = apply(Chooser, (), options)
- return _chooser.show(color)
+ return _chooser.show(color, options)
def save():
global _chooser