|
|
7a4110 |
From c9d8db44583262f49adf7588fe0adbf0842a995a Mon Sep 17 00:00:00 2001
|
|
|
7a4110 |
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
|
7a4110 |
Date: Thu, 31 Jan 2013 17:31:55 +0900
|
|
|
7a4110 |
Subject: [PATCH] Enable ibus-setup to show the frequently used languages
|
|
|
7a4110 |
only in IME list.
|
|
|
7a4110 |
|
|
|
7a4110 |
---
|
|
|
7a4110 |
data/ibus.schemas.in | 168 ++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
7a4110 |
setup/enginecombobox.py | 155 +++++++++++++++++++++++++++++++++++++-------
|
|
|
7a4110 |
setup/main.py | 1 +
|
|
|
7a4110 |
3 files changed, 300 insertions(+), 24 deletions(-)
|
|
|
7a4110 |
|
|
|
7a4110 |
diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in
|
|
|
7a4110 |
index 52ece27..007fc66 100644
|
|
|
7a4110 |
--- a/data/ibus.schemas.in
|
|
|
7a4110 |
+++ b/data/ibus.schemas.in
|
|
|
7a4110 |
@@ -339,6 +339,174 @@ se,si,sk,sy,sy(ku),th,tj,tr,ua,uz,vn
|
|
|
7a4110 |
</locale>
|
|
|
7a4110 |
</schema>
|
|
|
7a4110 |
<schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/group_list</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/group_list</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+ <default>[west_europe,south_europe,east_europe,north_europe,west_asia,center_asia,east_asia,india,australia]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of system keyboard layout groups on ibus-setup</short>
|
|
|
7a4110 |
+ <long>The group list is used not to show all the system
|
|
|
7a4110 |
+ keyboard layouts by default. The list item will be
|
|
|
7a4110 |
+ appended at the end of gconf key. e.g.
|
|
|
7a4110 |
+ .../xkblayoutconfig/item1</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/west_europe</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/west_europe</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[ad,be,br,de,ca,ch,cz,es,fr,gn,hu,ie,ie(CloGaelach),it,latam,nl,pt,si,sk]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[ca,cs,de,en,es,fr,gd,hu,it,nl,pt,sk,sl]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of European languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/south_europe</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/south_europe</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[al,ba,bg,gr,me,mk,mt,ro,rs]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[bg,bs,el,mk,mt,ro,sq,sr]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of European languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/east_europe</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/east_europe</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[by,ee,epo,ge,ge(dsb),ge(ru),ge(os),hr,kg,kz,lt,lv,pl,pl(csb),ru,ru(cv),ru(kom),ru(sah),ru(tt),ru(xal),ua,uz]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[be,csb,cv,et,ka,kk,ky,lt,lv,pl,ru,tt,uk,uz]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of European languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/north_europe</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/north_europe</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[dk,fi,fo,is,no,no(smi),se]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[da,fi,fo,is,no,se,sv]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of European languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/west_asia</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/west_asia</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[am,ara,az,et,gh,gh(akan),gh(ewe),gh(fula),gh(ga),gh(hausa),il,iq,iq(ku),ir,ir(ku),ma,ma(tifinagh),ng,ng(hausa),ng,ng(igbo),ng(yoruba),sy,sy(ku),tj,tr]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[am,ar,az,ber,fa,ha,he,hy,ig,ku,tg,tr,yo]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of Asian languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/center_asia</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/center_asia</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[cn(tib)]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[bo,zh]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of Asian languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/east_asia</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/east_asia</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[bt,kh,la,mal,mm,th,vn]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[dz,km,lo,my,th,vi]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of Asian languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/india</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/india</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[bd,in,in(ben),in(guj),in(guru),in(jhelum),in(kan),in(mal),in(ori),in(tam),in(tel),in(urd-phonetic),in(bolnagri),lk,lk(tam_unicode),mv,np,pk]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[bn,dv,gu,hi,kn,ml,ne,or,pa,si,ta,te,ur]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of Asian languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
+ <key>/schemas/desktop/ibus/general/xkblayoutconfig/australia</key>
|
|
|
7a4110 |
+ <applyto>/desktop/ibus/general/xkblayoutconfig/australia</applyto>
|
|
|
7a4110 |
+ <owner>ibus</owner>
|
|
|
7a4110 |
+ <type>list</type>
|
|
|
7a4110 |
+ <list_type>string</list_type>
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ <default>[mao]</default>
|
|
|
7a4110 |
+ -->
|
|
|
7a4110 |
+ <default>[mi]</default>
|
|
|
7a4110 |
+ <locale name="C">
|
|
|
7a4110 |
+ <short>List of Asian languages on ibus-setup</short>
|
|
|
7a4110 |
+ <long>ibus-setup shows the languages only in input method list
|
|
|
7a4110 |
+ when you run ibus-setup on one of the languages.
|
|
|
7a4110 |
+ Other languages are hidden under an extended button.</long>
|
|
|
7a4110 |
+ </locale>
|
|
|
7a4110 |
+ </schema>
|
|
|
7a4110 |
+ <schema>
|
|
|
7a4110 |
<key>/schemas/desktop/ibus/panel/custom_font</key>
|
|
|
7a4110 |
<applyto>/desktop/ibus/panel/custom_font</applyto>
|
|
|
7a4110 |
<owner>ibus</owner>
|
|
|
7a4110 |
diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py
|
|
|
7a4110 |
index 0f8a6ae..9828ee6 100644
|
|
|
7a4110 |
--- a/setup/enginecombobox.py
|
|
|
7a4110 |
+++ b/setup/enginecombobox.py
|
|
|
7a4110 |
@@ -45,6 +45,9 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
self.connect("notify::active", self.__notify_active_cb)
|
|
|
7a4110 |
|
|
|
7a4110 |
self.__model = None
|
|
|
7a4110 |
+ self.__all_model = None
|
|
|
7a4110 |
+ self.__config = None
|
|
|
7a4110 |
+ self.__show_sub_lang = False
|
|
|
7a4110 |
|
|
|
7a4110 |
renderer = Gtk.CellRendererPixbuf()
|
|
|
7a4110 |
renderer.set_property("xalign", 0)
|
|
|
7a4110 |
@@ -58,20 +61,51 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
self.pack_start(renderer, True)
|
|
|
7a4110 |
self.set_cell_data_func(renderer, self.__name_cell_data_cb, None)
|
|
|
7a4110 |
|
|
|
7a4110 |
- def set_engines(self, engines):
|
|
|
7a4110 |
- self.__model = Gtk.TreeStore(object)
|
|
|
7a4110 |
+ def __gconf_get_lang_list_from_locale(self):
|
|
|
7a4110 |
+ common_list = ['en', 'Other']
|
|
|
7a4110 |
+ if self.__config == None:
|
|
|
7a4110 |
+ return None
|
|
|
7a4110 |
+ loc = None
|
|
|
7a4110 |
+ try:
|
|
|
7a4110 |
+ loc = locale.setlocale (locale.LC_ALL)
|
|
|
7a4110 |
+ except:
|
|
|
7a4110 |
+ pass
|
|
|
7a4110 |
+ if loc == None:
|
|
|
7a4110 |
+ return common_list
|
|
|
7a4110 |
+ current_lang = IBus.get_language_name(loc)
|
|
|
7a4110 |
+ if current_lang == None:
|
|
|
7a4110 |
+ return common_list
|
|
|
7a4110 |
+ group_list = self.__config.get_value("general/xkblayoutconfig",
|
|
|
7a4110 |
+ "group_list")
|
|
|
7a4110 |
+ if group_list == None:
|
|
|
7a4110 |
+ return [loc] + common_list
|
|
|
7a4110 |
+ group_list = list(group_list)
|
|
|
7a4110 |
+ lang_list = None
|
|
|
7a4110 |
+ for group in group_list:
|
|
|
7a4110 |
+ group = str(group)
|
|
|
7a4110 |
+ langs = list(self.__config.get_value("general/xkblayoutconfig",
|
|
|
7a4110 |
+ group))
|
|
|
7a4110 |
+ for lang in langs:
|
|
|
7a4110 |
+ lang = str(lang)
|
|
|
7a4110 |
+ if current_lang == IBus.get_language_name(lang):
|
|
|
7a4110 |
+ lang_list = langs
|
|
|
7a4110 |
+ break
|
|
|
7a4110 |
+ if lang_list != None:
|
|
|
7a4110 |
+ break
|
|
|
7a4110 |
+ if lang_list == None:
|
|
|
7a4110 |
+ return [loc] + common_list
|
|
|
7a4110 |
+ return lang_list + common_list
|
|
|
7a4110 |
|
|
|
7a4110 |
- iter1 = self.__model.append(None)
|
|
|
7a4110 |
- self.__model.set(iter1, 0, 0)
|
|
|
7a4110 |
- langs = {}
|
|
|
7a4110 |
- for e in engines:
|
|
|
7a4110 |
- l = IBus.get_language_name(e.get_language())
|
|
|
7a4110 |
- if l == None:
|
|
|
7a4110 |
- l = ""
|
|
|
7a4110 |
- if l not in langs:
|
|
|
7a4110 |
- langs[l] = []
|
|
|
7a4110 |
- langs[l].append(e)
|
|
|
7a4110 |
+ def __has_engine_in_lang_list(self, engine, lang_list):
|
|
|
7a4110 |
+ retval = False
|
|
|
7a4110 |
+ for lang in lang_list:
|
|
|
7a4110 |
+ if IBus.get_language_name(lang) == \
|
|
|
7a4110 |
+ IBus.get_language_name(engine.props.language):
|
|
|
7a4110 |
+ retval = True
|
|
|
7a4110 |
+ break
|
|
|
7a4110 |
+ return retval
|
|
|
7a4110 |
|
|
|
7a4110 |
+ def __model_append_langs(self, model, langs, visible):
|
|
|
7a4110 |
keys = langs.keys()
|
|
|
7a4110 |
keys.sort(locale.strcoll)
|
|
|
7a4110 |
loc = locale.getlocale()[0]
|
|
|
7a4110 |
@@ -89,29 +123,86 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
keys.remove(IBus.get_language_name("Other"))
|
|
|
7a4110 |
keys += [IBus.get_language_name("Other")]
|
|
|
7a4110 |
for l in keys:
|
|
|
7a4110 |
- iter1 = self.__model.append(None)
|
|
|
7a4110 |
- self.__model.set(iter1, 0, l)
|
|
|
7a4110 |
+ iter1 = model.append(None)
|
|
|
7a4110 |
+ model.set(iter1, 0, l)
|
|
|
7a4110 |
def cmp_engine(a, b):
|
|
|
7a4110 |
if a.get_rank() == b.get_rank():
|
|
|
7a4110 |
return locale.strcoll(a.get_longname(), b.get_longname())
|
|
|
7a4110 |
return int(b.get_rank() - a.get_rank())
|
|
|
7a4110 |
langs[l].sort(cmp_engine)
|
|
|
7a4110 |
for e in langs[l]:
|
|
|
7a4110 |
- iter2 = self.__model.append(iter1)
|
|
|
7a4110 |
- self.__model.set(iter2, 0, e)
|
|
|
7a4110 |
+ iter2 = model.append(iter1)
|
|
|
7a4110 |
+ model.set(iter2, 0, e)
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ def set_engines(self, engines):
|
|
|
7a4110 |
+ self.__model = Gtk.TreeStore(object)
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ iter1 = self.__model.append(None)
|
|
|
7a4110 |
+ self.__model.set(iter1, 0, 0)
|
|
|
7a4110 |
+ lang_list = self.__gconf_get_lang_list_from_locale()
|
|
|
7a4110 |
+ lang = {}
|
|
|
7a4110 |
+ sub_lang = {}
|
|
|
7a4110 |
+ for e in engines:
|
|
|
7a4110 |
+ l = IBus.get_language_name(e.props.language)
|
|
|
7a4110 |
+ if lang_list == None or \
|
|
|
7a4110 |
+ self.__has_engine_in_lang_list(e, lang_list):
|
|
|
7a4110 |
+ if l not in lang:
|
|
|
7a4110 |
+ lang[l] = []
|
|
|
7a4110 |
+ lang[l].append(e)
|
|
|
7a4110 |
+ else:
|
|
|
7a4110 |
+ if l not in sub_lang:
|
|
|
7a4110 |
+ sub_lang[l] = []
|
|
|
7a4110 |
+ sub_lang[l].append(e)
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ self.__model_append_langs(self.__model, lang, True)
|
|
|
7a4110 |
+ iter1 = self.__model.append(None)
|
|
|
7a4110 |
+ self.__model.set(iter1, 0, -1)
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ self.__all_model = Gtk.TreeStore(object)
|
|
|
7a4110 |
+ iter1 = self.__all_model.append(None)
|
|
|
7a4110 |
+ self.__all_model.set(iter1, 0, 0)
|
|
|
7a4110 |
+ self.__model_append_langs(self.__all_model, lang, False)
|
|
|
7a4110 |
+ iter1 = self.__all_model.append(None)
|
|
|
7a4110 |
+ self.__all_model.set(iter1, 0, -1)
|
|
|
7a4110 |
+ self.__model_append_langs(self.__all_model, sub_lang, False)
|
|
|
7a4110 |
+
|
|
|
7a4110 |
+ self.__toggle_sub_lang()
|
|
|
7a4110 |
|
|
|
7a4110 |
- self.set_model(self.__model)
|
|
|
7a4110 |
+ def __toggle_sub_lang(self):
|
|
|
7a4110 |
+ self.set_model(None)
|
|
|
7a4110 |
+ if self.__show_sub_lang:
|
|
|
7a4110 |
+ self.set_model(self.__all_model)
|
|
|
7a4110 |
+ else:
|
|
|
7a4110 |
+ self.set_model(self.__model)
|
|
|
7a4110 |
self.set_active(0)
|
|
|
7a4110 |
|
|
|
7a4110 |
def __icon_cell_data_cb(self, celllayout, renderer, model, iter, data):
|
|
|
7a4110 |
- engine = self.__model.get_value(iter, 0)
|
|
|
7a4110 |
+ model = self.get_model()
|
|
|
7a4110 |
+ engine = model.get_value(iter, 0)
|
|
|
7a4110 |
|
|
|
7a4110 |
if isinstance(engine, str) or isinstance (engine, unicode):
|
|
|
7a4110 |
renderer.set_property("visible", False)
|
|
|
7a4110 |
renderer.set_property("sensitive", False)
|
|
|
7a4110 |
elif isinstance(engine, int):
|
|
|
7a4110 |
- renderer.set_property("visible", False)
|
|
|
7a4110 |
- renderer.set_property("sensitive", False)
|
|
|
7a4110 |
+ if engine == 0:
|
|
|
7a4110 |
+ renderer.set_property("visible", False)
|
|
|
7a4110 |
+ renderer.set_property("sensitive", False)
|
|
|
7a4110 |
+ renderer.set_property("pixbuf", None)
|
|
|
7a4110 |
+ elif engine < 0:
|
|
|
7a4110 |
+ if not self.__show_sub_lang:
|
|
|
7a4110 |
+ pixbuf = load_icon("go-bottom", Gtk.IconSize.LARGE_TOOLBAR)
|
|
|
7a4110 |
+ else:
|
|
|
7a4110 |
+ pixbuf = load_icon("go-up", Gtk.IconSize.LARGE_TOOLBAR)
|
|
|
7a4110 |
+ if pixbuf == None:
|
|
|
7a4110 |
+ pixbuf = load_icon(Gtk.STOCK_MISSING_IMAGE,
|
|
|
7a4110 |
+ Gtk.IconSize.LARGE_TOOLBAR)
|
|
|
7a4110 |
+ if pixbuf == None:
|
|
|
7a4110 |
+ renderer.set_property("visible", False)
|
|
|
7a4110 |
+ renderer.set_property("sensitive", False)
|
|
|
7a4110 |
+ return
|
|
|
7a4110 |
+ renderer.set_property("visible", True)
|
|
|
7a4110 |
+ renderer.set_property("sensitive", True)
|
|
|
7a4110 |
+ renderer.set_property("pixbuf", pixbuf)
|
|
|
7a4110 |
else:
|
|
|
7a4110 |
renderer.set_property("visible", True)
|
|
|
7a4110 |
renderer.set_property("sensitive", True)
|
|
|
7a4110 |
@@ -119,7 +210,8 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
renderer.set_property("pixbuf", pixbuf)
|
|
|
7a4110 |
|
|
|
7a4110 |
def __name_cell_data_cb(self, celllayout, renderer, model, iter, data):
|
|
|
7a4110 |
- engine = self.__model.get_value(iter, 0)
|
|
|
7a4110 |
+ model = self.get_model()
|
|
|
7a4110 |
+ engine = model.get_value(iter, 0)
|
|
|
7a4110 |
|
|
|
7a4110 |
if isinstance (engine, str) or isinstance (engine, unicode):
|
|
|
7a4110 |
renderer.set_property("sensitive", False)
|
|
|
7a4110 |
@@ -127,8 +219,15 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
renderer.set_property("weight", Pango.Weight.NORMAL)
|
|
|
7a4110 |
elif isinstance(engine, int):
|
|
|
7a4110 |
renderer.set_property("sensitive", True)
|
|
|
7a4110 |
- renderer.set_property("text", _("Select an input method"))
|
|
|
7a4110 |
- renderer.set_property("weight", Pango.Weight.NORMAL)
|
|
|
7a4110 |
+ if engine == 0:
|
|
|
7a4110 |
+ renderer.set_property("text", _("Select an input method"))
|
|
|
7a4110 |
+ renderer.set_property("weight", Pango.Weight.NORMAL)
|
|
|
7a4110 |
+ elif engine < 0:
|
|
|
7a4110 |
+ if not self.__show_sub_lang:
|
|
|
7a4110 |
+ renderer.set_property("text", _("Show all input methods"))
|
|
|
7a4110 |
+ else:
|
|
|
7a4110 |
+ renderer.set_property("text", _("Show only input methods for your region"))
|
|
|
7a4110 |
+ renderer.set_property("weight", Pango.Weight.BOLD)
|
|
|
7a4110 |
else:
|
|
|
7a4110 |
renderer.set_property("sensitive", True)
|
|
|
7a4110 |
renderer.set_property("text", engine.get_longname())
|
|
|
7a4110 |
@@ -144,10 +243,18 @@ class EngineComboBox(Gtk.ComboBox):
|
|
|
7a4110 |
if i == 0 or i == -1:
|
|
|
7a4110 |
return None
|
|
|
7a4110 |
iter = self.get_active_iter()
|
|
|
7a4110 |
- return self.get_model()[iter][0]
|
|
|
7a4110 |
+ model = self.get_model()
|
|
|
7a4110 |
+ if model[iter][0] == -1:
|
|
|
7a4110 |
+ self.__show_sub_lang = not self.__show_sub_lang
|
|
|
7a4110 |
+ self.__toggle_sub_lang()
|
|
|
7a4110 |
+ return None
|
|
|
7a4110 |
+ return model[iter][0]
|
|
|
7a4110 |
else:
|
|
|
7a4110 |
raise AttributeError, 'unknown property %s' % property.name
|
|
|
7a4110 |
|
|
|
7a4110 |
+ def set_config(self, config):
|
|
|
7a4110 |
+ self.__config = config
|
|
|
7a4110 |
+
|
|
|
7a4110 |
def get_active_engine(self):
|
|
|
7a4110 |
return self.get_property("active-engine")
|
|
|
7a4110 |
|
|
|
7a4110 |
diff --git a/setup/main.py b/setup/main.py
|
|
|
7a4110 |
index b39a044..5b077a8 100644
|
|
|
7a4110 |
--- a/setup/main.py
|
|
|
7a4110 |
+++ b/setup/main.py
|
|
|
7a4110 |
@@ -206,6 +206,7 @@ class Setup(object):
|
|
|
7a4110 |
# init engine page
|
|
|
7a4110 |
self.__engines = self.__bus.list_engines()
|
|
|
7a4110 |
self.__combobox = self.__builder.get_object("combobox_engines")
|
|
|
7a4110 |
+ self.__combobox.set_config(self.__config)
|
|
|
7a4110 |
self.__combobox.set_engines(self.__engines)
|
|
|
7a4110 |
|
|
|
7a4110 |
engine_names = values.get("preload_engines", [])
|
|
|
7a4110 |
--
|
|
|
7a4110 |
1.8.0
|
|
|
7a4110 |
|