Lots of changes to support loading alternative color name database.
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.
diff --git a/Tools/pynche/Switchboard.py b/Tools/pynche/Switchboard.py
index 3b06f11..9f2c64c 100644
--- a/Tools/pynche/Switchboard.py
+++ b/Tools/pynche/Switchboard.py
@@ -17,9 +17,9 @@
import marshal
class Switchboard:
- def __init__(self, colordb, initfile):
+ def __init__(self, initfile):
self.__initfile = initfile
- self.__colordb = colordb
+ self.__colordb = None
self.__optiondb = {}
self.__views = []
self.__red = 0
@@ -63,6 +63,9 @@
def colordb(self):
return self.__colordb
+ def set_colordb(self, colordb):
+ self.__colordb = colordb
+
def optiondb(self):
return self.__optiondb
@@ -74,6 +77,9 @@
for v in self.__views:
if hasattr(v, 'save_options'):
v.save_options(self.__optiondb)
+ # save the name of the file used for the color database. we'll try to
+ # load this first.
+ self.__optiondb['DBFILE'] = self.__colordb.filename()
fp = None
try:
try: