Updated to 1.2.5

This commit is contained in:
Takao Fujiwara 2010-12-01 14:58:39 +09:00
parent ad2f16ffd7
commit 30b4702df5
4 changed files with 8 additions and 557 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ ibus-anthy.png
/ibus-anthy-1.2.2.20101015.tar.gz
/ibus-anthy-1.2.3.tar.gz
/ibus-anthy-1.2.4.tar.gz
/ibus-anthy-1.2.5.tar.gz

View File

@ -1,551 +1 @@
From aaa2f6ad0ff5da7915b33b5d30ded25def187e7c Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 15 Nov 2010 13:25:11 +0900
Subject: [PATCH] Fixed SEGV when key tables are customized in new gconf.
---
setup/main.py | 18 ------------------
setup/prefs.py | 4 ++++
2 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/setup/main.py b/setup/main.py
index f341cc1..6093d43 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -695,24 +695,14 @@ class AnthySetup(object):
l[i] = [id, short_label, long_label, embed, single, reverse]
key = 'short_label'
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
prefs.set_value(section, key, short_label)
key = 'long_label'
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
prefs.set_value(section, key, long_label)
key = 'embed'
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
prefs.set_value(section, key, embed)
key = 'single'
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
prefs.set_value(section, key, single)
key = 'reverse'
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
prefs.set_value(section, key, reverse)
def __text_cell_data_cb(self, layout, renderer, model, iter, id):
@@ -887,10 +877,6 @@ class AnthySetup(object):
if section == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
- if section not in prefs.sections():
- prefs.set_new_section(section)
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
if type != 'thumb':
prefs.set_value(section, key, value)
else:
@@ -921,10 +907,6 @@ class AnthySetup(object):
if section == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
- if section not in prefs.sections():
- prefs.set_new_section(section)
- if key not in prefs.keys(section):
- prefs.set_new_key(section, key)
# config.set_value(key, None) is not supported.
if type != 'thumb':
prefs.set_value(section, key, '')
diff --git a/setup/prefs.py b/setup/prefs.py
index f3f0781..66f2cd6 100644
--- a/setup/prefs.py
+++ b/setup/prefs.py
@@ -57,6 +57,10 @@ class Prefs(object):
return self.default[section][key]
def set_value(self, section, key, value):
+ if section not in self.sections():
+ self.set_new_section(section)
+ if key not in self.keys(section):
+ self.set_new_key(section, key)
self.default[section][key]
self.new.setdefault(section, {})[key] = value
--
1.7.2.1
From f8f201c12fbd2af2154e13d5d46bff67f714179d Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 23 Nov 2010 18:01:56 +0900
Subject: [PATCH] Fixed the custom tables with new keys.
---
engine/kana.py | 4 ++
engine/romaji.py | 4 ++
engine/thumb.py | 80 ++++++++++++++++++++++++++++++------------------
setup/anthyprefs.py.in | 16 +++++++++
setup/main.py | 68 +++++++++++++++++++++++++++++++++--------
setup/prefs.py | 6 +++
6 files changed, 135 insertions(+), 43 deletions(-)
diff --git a/engine/kana.py b/engine/kana.py
index 8f5f6c3..d98852e 100644
--- a/engine/kana.py
+++ b/engine/kana.py
@@ -55,6 +55,10 @@ class KanaSegment(segment.Segment):
if section != None:
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
+ else:
+ value = prefs.get_value_direct(section, enchars)
+ if value != None:
+ value = unicode(str(value))
if value == '':
value = None
if value == None:
diff --git a/engine/romaji.py b/engine/romaji.py
index b3a54bd..3f28ff6 100644
--- a/engine/romaji.py
+++ b/engine/romaji.py
@@ -58,6 +58,10 @@ class RomajiSegment(segment.Segment):
if section != None:
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
+ else:
+ value = prefs.get_value_direct(section, enchars)
+ if value != None:
+ value = unicode(str(value))
if value == '':
value = None
if value == None:
diff --git a/engine/thumb.py b/engine/thumb.py
index 1ea582a..1745cc5 100644
--- a/engine/thumb.py
+++ b/engine/thumb.py
@@ -228,6 +228,7 @@ class ThumbShiftKeyboard:
self.__layout = 0
self.__fmv_extension = 2
self.__handakuten = False
+ self.__thumb_typing_rule_section_base = None
self.__thumb_typing_rule_section = None
self.__init_thumb_typing_rule()
self.__init_layout_table()
@@ -243,7 +244,9 @@ class ThumbShiftKeyboard:
method = prefs.get_value('thumb_typing_rule', 'method')
if method == None:
method = _THUMB_BASIC_METHOD
- self.__thumb_typing_rule_section = 'thumb_typing_rule/' + method
+ self.__thumb_typing_rule_section_base = 'thumb_typing_rule'
+ self.__thumb_typing_rule_section = \
+ self.__thumb_typing_rule_section_base + '/' + method
if self.__thumb_typing_rule_section not in prefs.sections():
self.__thumb_typing_rule_section = None
@@ -252,27 +255,34 @@ class ThumbShiftKeyboard:
self.__table.clear()
if self.__r_table != {}:
self.__r_table.clear()
+ section_base = self.__thumb_typing_rule_section_base
section = self.__thumb_typing_rule_section
if section != None:
prefs = self.__prefs
for k in prefs.keys(section):
value = prefs.get_value(section, k)
- if value == None or len(value) != 3 or \
- (str(value[0]) == '' and \
- str(value[1]) == '' and str(value[2]) == ''):
- continue
- value = [unicode(str(value[0])),
- unicode(str(value[1])),
- unicode(str(value[2]))]
- self.__table[ord(k)] = value
- for c in value:
- self.__r_table[c] = k
+ self.__set_bus_table(k, value)
+ for k in prefs.get_value(section_base, 'newkeys'):
+ value = prefs.get_value_direct(section, k)
+ self.__set_bus_table(k, value)
else:
for k in _table.keys():
self.__table[ord(k)] = _table_static[k]
for c in _table_static[k]:
self.__r_table[c] = k
+ def __set_bus_table(self, key, value):
+ if value == None or len(value) != 3 or \
+ (str(value[0]) == '' and \
+ str(value[1]) == '' and str(value[2]) == ''):
+ return
+ value = [unicode(str(value[0])),
+ unicode(str(value[1])),
+ unicode(str(value[2]))]
+ self.__table[ord(key)] = value
+ for c in value:
+ self.__r_table[c] = key
+
def __reset_layout_table(self, init,
j_table_label, j_table,
a_table_label, a_table,
@@ -292,18 +302,17 @@ class ThumbShiftKeyboard:
sub_table = f_table
if method == None or sub_table == None:
return
- base_section = self.__thumb_typing_rule_section
- sub_section = 'thumb_typing_rule/' + method
- if base_section != None:
+ section_base = self.__thumb_typing_rule_section_base
+ section = self.__thumb_typing_rule_section
+ sub_section = section_base + '/' + method
+ if section != None:
prefs = self.__prefs
for k in prefs.keys(sub_section):
value = prefs.get_value(sub_section, k)
- if len(value) == 3 and value[0] == '' and \
- value[1] == '' and value[2] == '':
- continue
- self.__table[ord(k)] = value
- for c in value:
- self.__r_table[c] = k
+ self.__set_bus_table(k, value)
+ for k in prefs.get_value(section_base, method + '_newkeys'):
+ value = prefs.get_value_direct(sub_section, k)
+ self.__set_bus_table(k, value)
else:
for k in sub_table.keys():
self.__table[ord(unicode(k))] = sub_table[k]
@@ -479,6 +488,7 @@ class ThumbShiftKeyboard:
class ThumbShiftSegment(segment.Segment):
_prefs = None
+ _thumb_typing_rule_section_base = None
_thumb_typing_rule_section = None
_r_table = {}
@@ -500,7 +510,9 @@ class ThumbShiftSegment(segment.Segment):
method = prefs.get_value('thumb_typing_rule', 'method')
if method == None:
method = _THUMB_BASIC_METHOD
- cls._thumb_typing_rule_section = 'thumb_typing_rule/' + method
+ cls._thumb_typing_rule_section_base = 'thumb_typing_rule'
+ cls._thumb_typing_rule_section = \
+ cls._thumb_typing_rule_section_base + '/' + method
if cls._thumb_typing_rule_section not in prefs.sections():
cls._thumb_typing_rule_section = None
cls._init_layout_table()
@@ -509,25 +521,33 @@ class ThumbShiftSegment(segment.Segment):
def _init_layout_table(cls):
if cls._r_table != {}:
cls._r_table.clear()
+ section_base = cls._thumb_typing_rule_section_base
section = cls._thumb_typing_rule_section
if section != None:
prefs = cls._prefs
for k in prefs.keys(section):
value = prefs.get_value(section, k)
- if value == None or len(value) != 3 or \
- (str(value[0]) == '' and \
- str(value[1]) == '' and str(value[2]) == ''):
- continue
- value = [unicode(str(value[0])),
- unicode(str(value[1])),
- unicode(str(value[2]))]
- for c in value:
- cls._r_table[c] = k
+ cls._set_bus_table(k, value)
+ for k in prefs.get_value(section_base, 'newkeys'):
+ value = prefs.get_value_direct(section, k)
+ cls._set_bus_table(k, value)
else:
for k in _table.keys():
for c in _table_static[k]:
cls._r_table[c] = k
+ @classmethod
+ def _set_bus_table(cls, key, value):
+ if value == None or len(value) != 3 or \
+ (str(value[0]) == '' and \
+ str(value[1]) == '' and str(value[2]) == ''):
+ return
+ value = [unicode(str(value[0])),
+ unicode(str(value[1])),
+ unicode(str(value[2]))]
+ for c in value:
+ cls._r_table[c] = key
+
def is_finished(self):
return not (self._jachars in _UNFINISHED_HIRAGANA)
diff --git a/setup/anthyprefs.py.in b/setup/anthyprefs.py.in
index d05c41a..5e39eec 100644
--- a/setup/anthyprefs.py.in
+++ b/setup/anthyprefs.py.in
@@ -243,6 +243,11 @@ _config = {
'romaji_typing_rule': {
'method': 'default',
+ # The newkeys list is saved for every romaji_typing_rule/$method
+ # so that prefs.get_value_direct() is not used.
+ # prefs.fetch_section() doesn't get the keys if they exist
+ # in gconf only.
+ 'newkeys': [],
},
'romaji_typing_rule/default': {
@@ -485,6 +490,7 @@ _config = {
'kana_typing_rule': {
'method': 'default',
+ 'newkeys': [],
},
'kana_typing_rule/default': {
@@ -612,6 +618,16 @@ _config = {
'thumb_typing_rule': {
'method': 'base',
+ 'newkeys': [],
+ 'nicola_j_table_newkeys': [],
+ 'nicola_a_table_newkeys': [],
+ 'nicola_f_table_newkeys': [],
+ 'kb231_j_fmv_table_newkeys': [],
+ 'kb231_a_fmv_table_newkeys': [],
+ 'kb231_f_fmv_table_newkeys': [],
+ 'kb611_j_fmv_table_newkeys': [],
+ 'kb611_a_fmv_table_newkeys': [],
+ 'kb611_f_fmv_table_newkeys': [],
},
'thumb_typing_rule/base': {
diff --git a/setup/main.py b/setup/main.py
index 6093d43..1971c5b 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -249,13 +249,20 @@ class AnthySetup(object):
rule = {}
ls = gtk.ListStore(str, str, str)
tv = self.xml.get_widget('treeview_custom_key_table')
- section = 'romaji_typing_rule/' + str(method)
+ section_base = 'romaji_typing_rule'
+ section = section_base + '/' + str(method)
for key in prefs.keys(section):
key = str(key)
value = prefs.get_value(section, key)
# config.set_value(key, None) is not supported.
if value != None and value != '':
rule[key] = str(value)
+ for key in prefs.get_value(section_base, 'newkeys'):
+ key = str(key)
+ value = self.prefs.get_value_direct(section, key)
+ # config.set_value(key, None) is not supported.
+ if value != None and value != '':
+ rule[key] = str(value)
for key, value in sorted(rule.items(), \
cmp = self.__japanese_tuple_sort):
ls.append(['romaji', key, value])
@@ -271,13 +278,20 @@ class AnthySetup(object):
rule = {}
ls = gtk.ListStore(str, str, str)
tv = self.xml.get_widget('treeview_custom_key_table')
- section = 'kana_typing_rule/' + str(method)
+ section_base = 'kana_typing_rule'
+ section = section_base + '/' + str(method)
for key in prefs.keys(section):
key = str(key)
value = prefs.get_value(section, key)
# config.set_value(key, None) is not supported.
if value != None and value != '':
rule[key] = str(value)
+ for key in prefs.get_value(section_base, 'newkeys'):
+ key = str(key)
+ value = self.prefs.get_value_direct(section, key)
+ # config.set_value(key, None) is not supported.
+ if value != None and value != '':
+ rule[key] = str(value)
for key, value in sorted(rule.items(), \
cmp = self.__japanese_tuple_sort):
ls.append(['kana', key, value])
@@ -293,7 +307,8 @@ class AnthySetup(object):
rule = {}
ls = gtk.ListStore(str, str, str, str, str)
tv = self.xml.get_widget('treeview_custom_key_table')
- section = 'thumb_typing_rule/' + str(method)
+ section_base = 'thumb_typing_rule'
+ section = section_base + '/' + str(method)
for key in prefs.keys(section):
key = str(key)
value = prefs.get_value(section, key)
@@ -306,6 +321,18 @@ class AnthySetup(object):
rule[key][0] = str(value[0])
rule[key][1] = str(value[1])
rule[key][2] = str(value[2])
+ for key in prefs.get_value(section_base, 'newkeys'):
+ key = str(key)
+ value = self.prefs.get_value_direct(section, key)
+ # config.set_value(key, None) is not supported.
+ if value != None and len(value) == 3 and \
+ ((value[0] != None and value[0] != '') or \
+ (value[1] != None and value[1] != '') or \
+ (value[2] != None and value[2] != '')):
+ rule[key] = {}
+ rule[key][0] = str(value[0])
+ rule[key][1] = str(value[1])
+ rule[key][2] = str(value[2])
for key, value in sorted(rule.items(), \
cmp = self.__japanese_thumb_sort):
ls.append(['thumb', key, value[0], value[2], value[1]])
@@ -846,7 +873,7 @@ class AnthySetup(object):
model_combobox = combobox.get_model()
method = model_combobox[id][1]
type = user_data
- section = None
+ section_base = None
key = input.get_text()
value = output.get_text()
left_text = left.get_text()
@@ -866,17 +893,27 @@ class AnthySetup(object):
return
if type == 'romaji':
- section = 'romaji_typing_rule/' + method
+ section_base = 'romaji_typing_rule'
model.append([type, key, value])
elif type == 'kana':
- section = 'kana_typing_rule/' + method
+ section_base = 'kana_typing_rule'
model.append([type, key, value])
elif type == 'thumb':
- section = 'thumb_typing_rule/' + method
+ section_base = 'thumb_typing_rule'
model.append([type, key, value, left_text, right_text])
- if section == None:
+ if section_base == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
+ section = section_base + '/' + method
+ if key not in prefs.keys(section):
+ # ibus does not support gconf_client_all_entries().
+ # prefs.fetch_section() doesn't get the keys if they exist
+ # in gconf only.
+ # Use newkeys for that way.
+ newkeys = prefs.get_value(section_base, 'newkeys')
+ if key not in newkeys:
+ newkeys.append(key)
+ prefs.set_value(section_base, 'newkeys', newkeys)
if type != 'thumb':
prefs.set_value(section, key, value)
else:
@@ -897,16 +934,21 @@ class AnthySetup(object):
l, i = tv.get_selection().get_selected()
type = l[i][0]
key = l[i][1]
- section = None
+ section_base = None
if type == 'romaji':
- section = 'romaji_typing_rule/' + method
+ section_base = 'romaji_typing_rule'
elif type == 'kana':
- section = 'kana_typing_rule/' + method
+ section_base = 'kana_typing_rule'
elif type == 'thumb':
- section = 'thumb_typing_rule/' + method
- if section == None:
+ section_base = 'thumb_typing_rule'
+ if section_base == None:
self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug."))
return
+ section = section_base + '/' + method
+ newkeys = prefs.get_value(section_base, 'newkeys')
+ if key in newkeys:
+ newkeys.remove(key)
+ prefs.set_value(section_base, 'newkeys', newkeys)
# config.set_value(key, None) is not supported.
if type != 'thumb':
prefs.set_value(section, key, '')
diff --git a/setup/prefs.py b/setup/prefs.py
index 66f2cd6..2b56908 100644
--- a/setup/prefs.py
+++ b/setup/prefs.py
@@ -56,6 +56,12 @@ class Prefs(object):
except:
return self.default[section][key]
+ def get_value_direct(self, section, key, default=None):
+ s = section
+ section = '/'.join(
+ [s for s in '/'.join([self._prefix, section]).split('/') if s])
+ return self._config.get_value(section, key, default)
+
def set_value(self, section, key, value):
if section not in self.sections():
self.set_new_section(section)
--
1.7.2.1
From ef1a6edef6bd269677b57aa243dd6dd2e9a221a9 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 23 Nov 2010 18:33:58 +0900
Subject: [PATCH] Fixed romaji_typing_rule and kana_typing_rule receives UTF-8 keys. (#1146)
---
engine/kana.py | 8 ++++++++
engine/romaji.py | 8 ++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/engine/kana.py b/engine/kana.py
index d98852e..a2be52b 100644
--- a/engine/kana.py
+++ b/engine/kana.py
@@ -23,6 +23,7 @@
from ibus import unichar_half_to_full
from tables import *
import segment
+import sys
_UNFINISHED_HIRAGANA = set(u"かきくけこさしすせそたちつてとはひふへほ")
@@ -53,6 +54,13 @@ class KanaSegment(segment.Segment):
value = None
section = self._kana_typing_rule_section
if section != None:
+ try:
+ # U+A5 needs to be UTF-8 since gconf values are
+ # disk saved values.
+ enchars = enchars.encode('utf-8')
+ except:
+ print >> sys.stderr, \
+ "Failed to encode UTF-8:", enchars
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
else:
diff --git a/engine/romaji.py b/engine/romaji.py
index 3f28ff6..3e656fc 100644
--- a/engine/romaji.py
+++ b/engine/romaji.py
@@ -23,6 +23,7 @@
from ibus import unichar_half_to_full
from tables import *
import segment
+import sys
def romaji_correction_rule_get(k, d):
return (u'ん', k[1:2]) if k[0:1] == u'n' and not k[1:2] in u"aiueony'" else d
@@ -56,6 +57,13 @@ class RomajiSegment(segment.Segment):
value = None
section = self._romaji_typing_rule_section
if section != None:
+ try:
+ # U+A5 needs to be UTF-8 since gconf values are
+ # disk saved values.
+ enchars = enchars.encode('utf-8')
+ except:
+ print >> sys.stderr, \
+ "Failed to encode UTF-8:", enchars
if enchars in prefs.keys(section):
value = unicode(str(prefs.get_value(section, enchars)))
else:
--
1.7.2.1

View File

@ -2,14 +2,14 @@
%define require_ibus_version 1.2.0.20100111
%define require_pygtk2_version 2.15.2
Name: ibus-anthy
Version: 1.2.4
Release: 4%{?dist}
Version: 1.2.5
Release: 1%{?dist}
Summary: The Anthy engine for IBus input platform
License: GPLv2+
Group: System Environment/Libraries
URL: http://code.google.com/p/ibus/
Source0: http://ibus.googlecode.com/files/%{name}-%{version}.tar.gz
Patch0: ibus-anthy-HEAD.patch
# Patch0: ibus-anthy-HEAD.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -32,7 +32,7 @@ libanthy.
%prep
%setup -q
%patch0 -p1
# %patch0 -p1
%build
%configure --disable-static
@ -60,8 +60,8 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/ibus/component/*
%changelog
* Tue Nov 23 2010 Takao Fujiwara <tfujiwar@redhat.com> - 1.2.4-4
- Added ibus-anthy-HEAD.patch
* Wed Dec 01 2010 Takao Fujiwara <tfujiwar@redhat.com> - 1.2.5-1
- Updated to 1.2.5
Fixed Bug 652881 - SEGV when key tables are customized in new gconf.
Fixed Bug 654322 - new custom keys are not loaded.

View File

@ -1 +1 @@
48e1133550fa6f1ed4fa8aea1a73dc10 ibus-anthy-1.2.4.tar.gz
00b44c874616d797a0117d087cf33341 ibus-anthy-1.2.5.tar.gz