1 # -*- coding: utf-8 -*-
3 import preferences
as p
5 dicts
= (("EDICT (Small, fast)"),
6 #("EDICT2 (Smaller, fast) Recommended)"),
7 ("JMdict (Huge, slow, detailed) (full)"),
8 ("JMdict_e (Huge, slow, detailed) (English only)"),
9 ("KANJIDIC (Small, very fast)"),
11 ("KANJIDIC2 (Large, a little slow)"))
15 # 1. Chain of word dictionaries
16 # 2. Chain of kanji dictionaries
18 # In both cases, searches proceed through the chain until results are
19 # returned by one of them. In most cases, only the first dictionary
20 # will ever be examined.
22 def set_dicts(dicts
, option_key
):
23 keylen
= len(option_key
)
24 if dicts
and (type(dicts
) == dict):
25 # Clear previous entries
26 keys
= p
.options
.keys()
27 for key
in [k
for k
in keys
if k
[:keylen
] == option_key
]:
30 for i
, d
in enumerate(dicts
.iteritems()):
31 p
.options
["%s.%d" % (option_key
, i
)] = d
33 def set_word_dicts(dicts
):
34 set_dicts(dicts
, "dict.word")
36 def set_kanji_dicts(dicts
):
37 set_dicts(dicts
, "dict.kanji")
39 def console_chooser():
40 """Select dictionaries from the console."""
43 if __name__
== "__main__":