update dictionaries
authorPeng Wu <alexepico@gmail.com>
Wed, 20 Feb 2013 02:54:32 +0000 (10:54 +0800)
committerPeng Wu <alexepico@gmail.com>
Wed, 20 Feb 2013 02:54:32 +0000 (10:54 +0800)
setup/dicttreeview.py
setup/main2.py
src/PYConfig.cc
src/PYLibPinyin.cc
src/PYPConfig.cc

index b35f8b9..9d834cf 100644 (file)
@@ -25,6 +25,24 @@ from gi.repository import Gtk
 
 _ = lambda x : gettext.gettext(x)
 
+(
+    RESERVED,
+    GB_DICTIONARY,
+    GBK_DICTIONARY,
+    MERGED_DICTIONARY,
+    ART_DICTIONARY,
+    CULTURE_DICTIONARY,
+    ECONOMY_DICTIONARY,
+    GEOLOGY_DICTIONARY,
+    HISTORY_DICTIONARY,
+    LIFE_DICTIONARY,
+    NATURE_DICTIONARY,
+    SCITECH_DICTIONARY,
+    SOCIETY_DICTIONARY,
+    SPORT_DICTIONARY,
+    RESERVED1,
+    USER_DICTIONARY
+) = range(16)
 
 (
 COLUMN_SENSITIVE,
@@ -34,8 +52,19 @@ COLUMN_ACTIVE
 ) = range(4)
 
 dictionaries = \
-    ((False, 1, _("GB Dictionary"), True),
-     (True,  2, _("GBK Dictionary"), True))
+    (
+    (True, GBK_DICTIONARY, _("Low Frequent Characters"), True),
+    (True, ART_DICTIONARY, _("Art"), True),
+    (True, CULTURE_DICTIONARY, _("Culture"), True),
+    (True, ECONOMY_DICTIONARY, _("Economy"), True),
+    (True, GEOLOGY_DICTIONARY, _("Geology"), True),
+    (True, HISTORY_DICTIONARY, _("History"), True),
+    (True, LIFE_DICTIONARY, _("Life"), True),
+    (True, NATURE_DICTIONARY, _("Nature"), True),
+    (True, SCITECH_DICTIONARY, _("SciTech"), True),
+    (True, SOCIETY_DICTIONARY, _("Society"), True),
+    (True, SPORT_DICTIONARY, _("Sport"), True)
+    )
 
 
 class DictionaryTreeView(Gtk.TreeView):
index 24c210a..0700651 100644 (file)
@@ -346,7 +346,7 @@ class PreferencesDialog:
         # dictionary tree view
         self.__dict_treeview = self.__builder.get_object("Dictionaries")
         self.__dict_treeview.show()
-        self.__dict_treeview.set_dictionaries(self.__get_value("Dictionaries", "2"))
+        self.__dict_treeview.set_dictionaries(self.__get_value("Dictionaries", "2;4;5;6;7;8;9;10;11;12;13"))
 
         def __notified_dicts_cb(self, param, dialog):
             dialog.__set_value("Dictionaries", self.get_dictionaries())
index 2ed964c..6a51110 100644 (file)
@@ -62,7 +62,7 @@ Config::initDefaultValues (void)
     m_init_simp_chinese = TRUE;
     m_special_phrases = TRUE;
 
-    m_dictionaries = "2";
+    m_dictionaries = "2;4;5;6;7;8;9;10;11;12;13";
 }
 
 
index d2cb5d1..a9a75e9 100644 (file)
@@ -81,7 +81,7 @@ LibPinyinBackEnd::initPinyinContext (Config *config)
     g_strfreev (indices);
 
     /* load user phrase library. */
-    pinyin_load_phrase_library (context, 15);
+    pinyin_load_phrase_library (context, USER_DICTIONARY);
 
     return context;
 }
index f66b542..d75b5ed 100644 (file)
@@ -101,7 +101,7 @@ LibPinyinConfig::initDefaultValues (void)
     m_init_simp_chinese = TRUE;
     m_special_phrases = TRUE;
 
-    m_dictionaries = "2";
+    m_dictionaries = "2;4;5;6;7;8;9;10;11;12;13";
 }
 
 static const struct {
@@ -165,7 +165,7 @@ LibPinyinConfig::readDefaultValues (void)
         g_warn_if_reached ();
     }
     m_ctrl_switch = read(CONFIG_CTRL_SWITCH, false);
-    m_dictionaries = read (CONFIG_DICTIONARIES, std::string("2"));
+    m_dictionaries = read (CONFIG_DICTIONARIES, std::string("2;4;5;6;7;8;9;10;11;12;13"));
 
     /* fuzzy pinyin */
     if (read (CONFIG_FUZZY_PINYIN, false))
@@ -237,7 +237,7 @@ LibPinyinConfig::valueChanged (const std::string &section,
     } else if (CONFIG_CTRL_SWITCH == name) {
         m_ctrl_switch = normalizeGVariant (value, false);
     } else if (CONFIG_DICTIONARIES == name) {
-        m_dictionaries = normalizeGVariant (value, std::string("2"));
+        m_dictionaries = normalizeGVariant (value, std::string("2;4;5;6;7;8;9;10;11;12;13"));
     }
     /* fuzzy pinyin */
     else if (CONFIG_FUZZY_PINYIN == name) {