Resolves: #911487 - Non-Chinese tables from the ibus-table-other package do not work
- Update cmode property in chinese mode only And some other small fixes and improvements: - Add auto_select functionality to select the first phrase when typing. Useful for Cyrillic transliteration - Fall back to auto_select = False if neither dconf nor the table have a value for auto_select - Preedit needs to be updated on page-up and page-down
This commit is contained in:
parent
17882b4e15
commit
afec9363fc
75
0001-Fix-typo-thanks-to-Mathieu-Bridon.patch
Normal file
75
0001-Fix-typo-thanks-to-Mathieu-Bridon.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From 03cba776da99b05218c2b1c86f3e93d3373f253e Mon Sep 17 00:00:00 2001
|
||||
From: Mike FABIAN <mfabian@redhat.com>
|
||||
Date: Wed, 30 Jan 2013 07:41:54 +0100
|
||||
Subject: [PATCH 1/5] Fix typo, thanks to Mathieu Bridon
|
||||
|
||||
---
|
||||
engine/chinese_variants.py | 4 ++--
|
||||
tools/generate-chinese-variants.py | 8 ++++----
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/engine/chinese_variants.py b/engine/chinese_variants.py
|
||||
index e48d992..5dce934 100644
|
||||
--- a/engine/chinese_variants.py
|
||||
+++ b/engine/chinese_variants.py
|
||||
@@ -27,7 +27,7 @@ variants_table = {
|
||||
# 1 = 1 << 0 simplified Chinese
|
||||
# 2 = 1 << 1 traditional Chinese
|
||||
# 3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- # 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ # 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
u'蘄': 2,
|
||||
u'谈': 1,
|
||||
u'預': 2,
|
||||
@@ -6075,7 +6075,7 @@ def detect_chinese_category(phrase):
|
||||
1 = 1 << 0 simplified Chinese
|
||||
2 = 1 << 1 traditional Chinese
|
||||
3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
'''
|
||||
# make sure that we got a unicode string
|
||||
if type(phrase) != type(u''):
|
||||
diff --git a/tools/generate-chinese-variants.py b/tools/generate-chinese-variants.py
|
||||
index b846496..c54eaec 100755
|
||||
--- a/tools/generate-chinese-variants.py
|
||||
+++ b/tools/generate-chinese-variants.py
|
||||
@@ -58,7 +58,7 @@ variants_table_orig = {
|
||||
# 1 = 1 << 0 simplified Chinese
|
||||
# 2 = 1 << 1 traditional Chinese
|
||||
# 3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- # 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ # 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
#
|
||||
# overrides can be added manually here. For example the following
|
||||
# line marks the 〇 character as used in both
|
||||
@@ -185,7 +185,7 @@ variants_table = {
|
||||
# 1 = 1 << 0 simplified Chinese
|
||||
# 2 = 1 << 1 traditional Chinese
|
||||
# 3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- # 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ # 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
''')
|
||||
|
||||
for phrase in variants_table_orig:
|
||||
@@ -208,7 +208,7 @@ def detect_chinese_category(phrase):
|
||||
1 = 1 << 0 simplified Chinese
|
||||
2 = 1 << 1 traditional Chinese
|
||||
3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
\'\'\'
|
||||
# make sure that we got a unicode string
|
||||
if type(phrase) != type(u''):
|
||||
@@ -253,7 +253,7 @@ test_data = {
|
||||
# 1 = 1 << 0 simplified Chinese
|
||||
# 2 = 1 << 1 traditional Chinese
|
||||
# 3 = (1 | 1 << 1) used both in simplified *and* traditional Chinese
|
||||
- # 4 = 2 << 3 mixture of simplified and traditional Chinese
|
||||
+ # 4 = 1 << 2 mixture of simplified and traditional Chinese
|
||||
u'乌': 1,
|
||||
u'烏': 2,
|
||||
u'晞': 3,
|
||||
--
|
||||
1.7.11.7
|
||||
|
111
0002-Add-auto_select-functionality-to-select-the-first-ph.patch
Normal file
111
0002-Add-auto_select-functionality-to-select-the-first-ph.patch
Normal file
@ -0,0 +1,111 @@
|
||||
From a55783887e757f02078143c2d12031a33c9e9223 Mon Sep 17 00:00:00 2001
|
||||
From: bnauwelaerts <bnauwelaerts@cli0189.fednot.be>
|
||||
Date: Sat, 2 Feb 2013 13:03:48 +0100
|
||||
Subject: [PATCH 2/5] Add auto_select functionality to select the first phrase
|
||||
when typing. Useful for Cyrillic transliteration.
|
||||
|
||||
---
|
||||
engine/table.py | 26 +++++++++++++++++++++++---
|
||||
engine/tabsqlitedb.py | 1 +
|
||||
tables/template.txt | 3 +++
|
||||
3 files changed, 27 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/engine/table.py b/engine/table.py
|
||||
index c106a0a..4a10636 100644
|
||||
--- a/engine/table.py
|
||||
+++ b/engine/table.py
|
||||
@@ -228,6 +228,13 @@ class editor(object):
|
||||
"ChineseMode"))
|
||||
if self._chinese_mode == None:
|
||||
self._chinese_mode = self.get_chinese_mode()
|
||||
+
|
||||
+ self._auto_select = variant_to_value(self._config.get_value(
|
||||
+ self._config_section,
|
||||
+ "AutoSelect"))
|
||||
+ if self._auto_select == None:
|
||||
+ self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
+
|
||||
|
||||
def init_select_keys(self):
|
||||
# __select_keys: lookup table select keys/labels
|
||||
@@ -728,7 +735,9 @@ class editor(object):
|
||||
if ascii.ispunct (self._chars[0][-1].encode('ascii')) \
|
||||
or len (self._chars[0][:-1]) \
|
||||
in self.db.pkeylens \
|
||||
- or only_one_last:
|
||||
+ or only_one_last \
|
||||
+ or self._auto_select:
|
||||
+
|
||||
# because we use [!@#$%] to denote [12345]
|
||||
# in py_mode, so we need to distinguish them
|
||||
## old manner:
|
||||
@@ -750,7 +759,7 @@ class editor(object):
|
||||
self._lookup_table.clear()
|
||||
self._lookup_table.set_cursor_visible(True)
|
||||
return False
|
||||
- else:
|
||||
+ else:
|
||||
# this is not a punct or not a valid phrase
|
||||
# last time
|
||||
self._chars[1].append( self._chars[0].pop() )
|
||||
@@ -1142,11 +1151,19 @@ class tabengine (IBus.Engine):
|
||||
self._full_width_punct[1] = self.db.get_ime_property('def_full_width_punct').lower() == u'true'
|
||||
# some properties we will involved, Property is taken from scim.
|
||||
#self._setup_property = Property ("setup", _("Setup"))
|
||||
+
|
||||
self._auto_commit = variant_to_value(self._config.get_value(
|
||||
self._config_section,
|
||||
"AutoCommit"))
|
||||
if self._auto_commit == None:
|
||||
self._auto_commit = self.db.get_ime_property('auto_commit').lower() == u'true'
|
||||
+
|
||||
+ self._auto_select = variant_to_value(self._config.get_value(
|
||||
+ self._config_section,
|
||||
+ "AutoSelect"))
|
||||
+ if self._auto_select == None:
|
||||
+ self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
+
|
||||
# the commit phrases length
|
||||
self._len_list = [0]
|
||||
# connect to SpeedMeter
|
||||
@@ -1736,7 +1753,10 @@ class tabengine (IBus.Engine):
|
||||
sp_res = self._editor.space ()
|
||||
#return (KeyProcessResult,whethercommit,commitstring)
|
||||
if sp_res[0]:
|
||||
- self.commit_string (sp_res[1])
|
||||
+ if self._auto_select:
|
||||
+ self.commit_string ("%s " %sp_res[1])
|
||||
+ else:
|
||||
+ self.commit_string (sp_res[1])
|
||||
#self.add_string_len(sp_res[1])
|
||||
self.db.check_phrase (sp_res[1], sp_res[2])
|
||||
else:
|
||||
diff --git a/engine/tabsqlitedb.py b/engine/tabsqlitedb.py
|
||||
index 78fa85d..fa56053 100644
|
||||
--- a/engine/tabsqlitedb.py
|
||||
+++ b/engine/tabsqlitedb.py
|
||||
@@ -99,6 +99,7 @@ class tabsqlitedb:
|
||||
'user_can_define_phrase':'FALSE',
|
||||
'pinyin_mode':'FALSE',
|
||||
'dynamic_adjust':'FALSE',
|
||||
+ 'auto_select':'false',
|
||||
'auto_commit':'false',
|
||||
#'no_check_chars':u'',
|
||||
'description':'A IME under IBus Table',
|
||||
diff --git a/tables/template.txt b/tables/template.txt
|
||||
index 40bc915..f51cdf8 100644
|
||||
--- a/tables/template.txt
|
||||
+++ b/tables/template.txt
|
||||
@@ -63,6 +63,9 @@ MAX_KEY_LENGTH = 4
|
||||
### Use auto_commit mode as default
|
||||
AUTO_COMMIT = FALSE
|
||||
|
||||
+### Automatically selects the first phrase when typing
|
||||
+AUTO_SELECT = FALSE
|
||||
+
|
||||
### Use full width punctuation by default
|
||||
DEF_FULL_WIDTH_PUNCT = TRUE
|
||||
### Not use full width letter by default
|
||||
--
|
||||
1.7.11.7
|
||||
|
25
0003-Update-cmode-pproperty-in-chinese-mode-only.patch
Normal file
25
0003-Update-cmode-pproperty-in-chinese-mode-only.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 2baa9c3ff258c0623b4777f2c537467339cdcef6 Mon Sep 17 00:00:00 2001
|
||||
From: bnauwelaerts <bnauwelaerts@cli0189.fednot.be>
|
||||
Date: Sat, 2 Feb 2013 17:22:40 +0100
|
||||
Subject: [PATCH 3/5] Update cmode pproperty in chinese mode only
|
||||
|
||||
---
|
||||
engine/table.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/engine/table.py b/engine/table.py
|
||||
index 4a10636..f0a8a61 100644
|
||||
--- a/engine/table.py
|
||||
+++ b/engine/table.py
|
||||
@@ -1304,7 +1304,7 @@ class tabengine (IBus.Engine):
|
||||
self._set_property(self._cmode_property, 'tcb-mode.svg', _('Traditional Chinese First Big Charset Mode'), _('Switch to Big Charset Mode'))
|
||||
elif self._editor._chinese_mode == 4:
|
||||
self._set_property(self._cmode_property, 'cb-mode.svg', _('Big Chinese Mode'), _('Switch to Simplified Chinese Mode'))
|
||||
- self.update_property(self._cmode_property)
|
||||
+ self.update_property(self._cmode_property)
|
||||
|
||||
def _set_property (self, property, icon, label, tooltip):
|
||||
property.set_icon ( u'%s%s' % (self._icon_dir, icon ) )
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,42 @@
|
||||
From 3d03bd8f8c558392db42897370cef65bdbad57bd Mon Sep 17 00:00:00 2001
|
||||
From: Mike FABIAN <mfabian@redhat.com>
|
||||
Date: Tue, 5 Feb 2013 09:11:17 +0100
|
||||
Subject: [PATCH 4/5] Fall back to auto_select = False if neither dconf nor
|
||||
the table have a value for auto_select
|
||||
|
||||
---
|
||||
engine/table.py | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/engine/table.py b/engine/table.py
|
||||
index f0a8a61..3999c35 100644
|
||||
--- a/engine/table.py
|
||||
+++ b/engine/table.py
|
||||
@@ -233,8 +233,10 @@ class editor(object):
|
||||
self._config_section,
|
||||
"AutoSelect"))
|
||||
if self._auto_select == None:
|
||||
- self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
-
|
||||
+ if self.db.get_ime_property('auto_select') != None:
|
||||
+ self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
+ else:
|
||||
+ self._auto_select = False
|
||||
|
||||
def init_select_keys(self):
|
||||
# __select_keys: lookup table select keys/labels
|
||||
@@ -1162,7 +1164,10 @@ class tabengine (IBus.Engine):
|
||||
self._config_section,
|
||||
"AutoSelect"))
|
||||
if self._auto_select == None:
|
||||
- self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
+ if self.db.get_ime_property('auto_select') != None:
|
||||
+ self._auto_select = self.db.get_ime_property('auto_select').lower() == u'true'
|
||||
+ else:
|
||||
+ self._auto_select = False
|
||||
|
||||
# the commit phrases length
|
||||
self._len_list = [0]
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -0,0 +1,66 @@
|
||||
From 3b7a3530c42766b801cded26b3bc269222c3fb0a Mon Sep 17 00:00:00 2001
|
||||
From: Mike FABIAN <mfabian@redhat.com>
|
||||
Date: Thu, 14 Feb 2013 18:21:57 +0100
|
||||
Subject: [PATCH 5/5] Preedit needs to be updated on page-up and page-down
|
||||
|
||||
When paging through the lookup table, the preedit needs to be updated
|
||||
to show the phrase selected by the cursor in the lookup table. Before
|
||||
this patch, the preedit was not updated and when commiting the
|
||||
character selected in the lookup table suddenly replaced the character
|
||||
in the preedit. This differed from the behaviour when moving through
|
||||
the lookup table with the arrow-up and arrow-down keys.
|
||||
Using page-up and page-down or the arrow icons at the bottom
|
||||
of the lookup table should also update the preedit just like it
|
||||
is done when the arrow-up and arrow-down keys are used.
|
||||
---
|
||||
engine/table.py | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/engine/table.py b/engine/table.py
|
||||
index 3999c35..58a8d4d 100644
|
||||
--- a/engine/table.py
|
||||
+++ b/engine/table.py
|
||||
@@ -1751,7 +1751,7 @@ class tabengine (IBus.Engine):
|
||||
# on lookup page
|
||||
if IBus.KEY_space in self._page_down_keys:
|
||||
res = self._editor.page_down()
|
||||
- self._update_lookup_table ()
|
||||
+ self._update_ui ()
|
||||
return res
|
||||
else:
|
||||
o_py = self._editor._py_mode
|
||||
@@ -1826,13 +1826,13 @@ class tabengine (IBus.Engine):
|
||||
elif key.code in self._page_down_keys \
|
||||
and self._editor._candidates[0]:
|
||||
res = self._editor.page_down()
|
||||
- self._update_lookup_table ()
|
||||
+ self._update_ui ()
|
||||
return res
|
||||
|
||||
elif key.code in self._page_up_keys \
|
||||
and self._editor._candidates[0]:
|
||||
res = self._editor.page_up ()
|
||||
- self._update_lookup_table ()
|
||||
+ self._update_ui ()
|
||||
return res
|
||||
|
||||
elif keychar in self._editor.get_select_keys() and self._editor._candidates[0]:
|
||||
@@ -1909,13 +1909,13 @@ class tabengine (IBus.Engine):
|
||||
|
||||
def do_page_up (self):
|
||||
if self._editor.page_up ():
|
||||
- self._update_lookup_table ()
|
||||
+ self._update_ui ()
|
||||
return True
|
||||
return False
|
||||
|
||||
def do_page_down (self):
|
||||
if self._editor.page_down ():
|
||||
- self._update_lookup_table ()
|
||||
+ self._update_ui ()
|
||||
return True
|
||||
return False
|
||||
|
||||
--
|
||||
1.7.11.7
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: ibus-table
|
||||
Version: 1.5.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: The Table engine for IBus platform
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
@ -12,6 +12,11 @@ Patch3: 0001-Make-comments-about-_chinese_mode-clearer.patch
|
||||
Patch4: 0002-Improve-detection-of-simplified-and-traditional-Chin.patch
|
||||
Patch5: 0003-add-engine-chinese_variants.py-to-engine-Makefile.am.patch
|
||||
Patch6: add-engine-chinese_variants.py-to-engine-Makefile.in.patch
|
||||
Patch7: 0001-Fix-typo-thanks-to-Mathieu-Bridon.patch
|
||||
Patch8: 0002-Add-auto_select-functionality-to-select-the-first-ph.patch
|
||||
Patch9: 0003-Update-cmode-pproperty-in-chinese-mode-only.patch
|
||||
Patch10: 0004-Fall-back-to-auto_select-False-if-neither-dconf-nor-.patch
|
||||
Patch11: 0005-Preedit-needs-to-be-updated-on-page-up-and-page-down.patch
|
||||
|
||||
Requires: ibus > 1.3.0
|
||||
BuildRequires: ibus-devel > 1.3.0
|
||||
@ -40,6 +45,11 @@ Development files for %{name}.
|
||||
%patch4 -p1 -b .improve-detection-of-simplified-and-traditional-chinese
|
||||
%patch5 -p1 -b .fix-makefile-am
|
||||
%patch6 -p1 -b .fix-makefile-in
|
||||
%patch7 -p1 -b .fix-typo
|
||||
%patch8 -p1 -b .add-auto-select
|
||||
%patch9 -p1 -b .update-cmode-in-chinese-mode-only
|
||||
%patch10 -p1 -b .fall-back-to-auto-select-false-by-default
|
||||
%patch11 -p1 -b .preedit-needs-to-be-updated-when-paging
|
||||
|
||||
%build
|
||||
%configure --disable-static --disable-additional
|
||||
@ -113,6 +123,15 @@ Development files for %{name}.
|
||||
%{_datadir}/pkgconfig/%{name}.pc
|
||||
|
||||
%changelog
|
||||
* Thu Feb 14 2013 Mike FABIAN <mfabian@redhat.com> - 1.5.0-2
|
||||
- Resolves: #911487 - Non-Chinese tables from the ibus-table-other package do not work
|
||||
- Add auto_select functionality to select the first phrase when typing.
|
||||
Useful for Cyrillic transliteration
|
||||
- Update cmode property in chinese mode only
|
||||
- Fall back to auto_select = False if neither dconf nor the table
|
||||
have a value for auto_select
|
||||
- Preedit needs to be updated on page-up and page-down
|
||||
|
||||
* Mon Jan 28 2013 Mike FABIAN <mfabian@redhat.com> - 1.5.0-1
|
||||
- update to latest upstream 1.5.0 from Caius ‘kaio’ Chance’s repository
|
||||
- add patches for better simplified/traditional Chinese detection
|
||||
|
Loading…
Reference in New Issue
Block a user