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