[ibus-indic-table/f16] Fixed bug 684118
anish
anishpatil at fedoraproject.org
Thu Oct 13 11:56:00 UTC 2011
commit a8a38cb96f96fed1cc809460391eb479b2be251d
Author: anish <anish at dhcp193-44.pnq.redhat.com>
Date: Thu Oct 13 17:26:51 2011 +0530
Fixed bug 684118
bug-684118.patch | 151 +++++++++++++++++++++++++++++++++++++++++++++++++
ibus-indic-table.spec | 7 ++-
2 files changed, 157 insertions(+), 1 deletions(-)
---
diff --git a/bug-684118.patch b/bug-684118.patch
new file mode 100644
index 0000000..1cb8473
--- /dev/null
+++ b/bug-684118.patch
@@ -0,0 +1,151 @@
+Only in ibus-indic-table-1.3.1/engine: factory.pyc
+diff -rup ibus-indic-table-1.3.1-old/engine/indic_table.py ibus-indic-table-1.3.1/engine/indic_table.py
+--- ibus-indic-table-1.3.1-old/engine/indic_table.py 2011-10-12 11:47:43.326031998 +0530
++++ ibus-indic-table-1.3.1/engine/indic_table.py 2011-10-13 13:11:19.303276550 +0530
+@@ -99,6 +99,16 @@ class editor(object):
+ self._ap_dict = {}
+ # list used to track caret chars after pressing space
+ self._caret_chars = []
++ self._is_inscript = False
++ self._ins_keys = {}
++ try:
++ if self.db.get_ime_property('INSCRIPT'):
++ self._is_inscript = True
++ keyvals = self.db.get_all_values()
++ for keyval in keyvals:
++ self._ins_keys[keyval[0]] = keyval[1]
++ except:
++ self._is_inscript = False
+ # self._chinese_mode: the candidate filter mode,
+ # 0 is simplify Chinese
+ # 1 is traditional Chinese
+@@ -1234,6 +1244,14 @@ class tabengine (ibus.EngineBase):
+ _ic = self._editor.get_aux_strings()+self._editor._ap_dict[_ic]
+ '''
+ _ic = self._editor.get_aux_strings()
++ ins_str = ''
++ if self._editor._is_inscript:
++ for ch in _ic:
++ if ch in self._editor._ins_keys:
++ ins_str += self._editor._ins_keys[ch]
++ else:
++ ins_str += ch
++ _ic = ins_str
+ if _ic:
+ attrs = ibus.AttrList([ ibus.AttributeForeground(0x9515b5,0, len(_ic)) ])
+ #attrs = [ scim.Attribute(0,len(_ic),scim.ATTR_FOREGROUND,0x5540c1)]
+Only in ibus-indic-table-1.3.1/engine: indic_table.pyc
+diff -rup ibus-indic-table-1.3.1-old/engine/tabcreatedb.py ibus-indic-table-1.3.1/engine/tabcreatedb.py
+--- ibus-indic-table-1.3.1-old/engine/tabcreatedb.py 2011-10-12 11:47:43.326031998 +0530
++++ ibus-indic-table-1.3.1/engine/tabcreatedb.py 2011-10-13 15:51:54.461496400 +0530
+@@ -91,16 +91,17 @@ def main ():
+ _attri = []
+ _table = []
+ _gouci = []
++ _ins_keys = []
+ patt_com = re.compile(r'^###.*')
+ patt_blank = re.compile(r'^[ \t]*$')
+ patt_conf = re.compile(r'.*=.*')
+ patt_table = re.compile(r'(.*)\t(.*)\t.*')
+ patt_gouci = re.compile(r'.*\t.*')
+ patt_s = re.compile(r'(.*)\t([\x00-\xff]{3})\t.*')
+-
++ patt_inscript = re.compile(r'.*:.*')
+ for l in f:
+ if ( not patt_com.match(l) ) and ( not patt_blank.match(l) ):
+- for _patt, _list in ( (patt_table,_table),(patt_gouci,_gouci),(patt_conf,_attri) ):
++ for _patt, _list in ( (patt_table,_table),(patt_gouci,_gouci),(patt_conf,_attri),(patt_inscript,_ins_keys)):
+ if _patt.match(l):
+ _list.append(l)
+ break
+@@ -119,7 +120,7 @@ def main ():
+ _gouci.append('%s\t%s' %(key,gouci_dict[key] ) )
+ _gouci.sort()
+
+- return (_attri, _table, _gouci)
++ return (_attri, _table, _gouci,_ins_keys)
+
+ def parse_pinyin (f):
+ _pinyins = []
+@@ -184,6 +185,22 @@ def main ():
+ attr = attr.lower()
+ val = val.strip()
+ yield (attr,val)
++
++ def colon_parser (f):
++ for l in f:
++ try:
++ if len(unicode (l,"utf-8").strip().split (':'))==3:
++ attr, val, dum = unicode (l,"utf-8").strip().split (':')
++ val=''.join([val,"=",dum])
++ else:
++ attr,val = unicode (l,"utf-8").strip().split (':')
++ except:
++ attr,val = unicode (l,"utf-8").strip().split ('::')
++ attr = attr.strip()
++ origin_attr = attr
++ attr = attr.lower()
++ val = val.strip()
++ yield (attr,val)
+
+ def extra_parser (f):
+ list = []
+@@ -216,13 +233,16 @@ def main ():
+ source = file ( opts.source, 'r' )
+ # first get config line and table line and goucima line respectively
+ debug_print ('\tParsing table source file ')
+- attri,table,gouci = parse_source ( source )
++ attri,table,gouci,in_keys = parse_source ( source )
+
+ debug_print ('\t get attribute of IME :)')
+ attributes = attribute_parser ( attri )
+ debug_print ('\t add attributes into DB ')
+ db.update_ime ( attributes )
+ db.create_tables ('main')
++
++ i_keys = colon_parser(in_keys)
++ db.insert_inks(i_keys)
+
+ # second, we use generators for database generating:
+ debug_print ('\t get phrases of IME :)')
+Only in ibus-indic-table-1.3.1/engine: tabdict.pyc
+diff -rup ibus-indic-table-1.3.1-old/engine/tabsqlitedb.py ibus-indic-table-1.3.1/engine/tabsqlitedb.py
+--- ibus-indic-table-1.3.1-old/engine/tabsqlitedb.py 2011-10-12 11:47:43.327031999 +0530
++++ ibus-indic-table-1.3.1/engine/tabsqlitedb.py 2011-10-13 15:50:10.731494033 +0530
+@@ -275,6 +275,10 @@ class tabsqlitedb:
+ # create ikeys table
+ sqlstr = 'CREATE TABLE IF NOT EXISTS %s.ikeys (ikey TEXT PRIMARY KEY, id INTEGER);' % database
+ self.db.execute ( sqlstr )
++
++ #create inscript keys table
++ sqlstr = 'CREATE TABLE IF NOT EXISTS %s.inks (attr TEXT, val TEXT);' % database
++ self.db.execute ( sqlstr )
+
+ # create goucima table, this table is used in construct new phrases
+ sqlstr = 'CREATE TABLE IF NOT EXISTS %s.goucima (zi TEXT PRIMARY KEY' % database
+@@ -304,6 +308,12 @@ class tabsqlitedb:
+ self.db.execute ( sqlstr )
+ self.db.commit()
+
++
++ def insert_inks(self,attrs):
++ sqlstr = 'INSERT INTO main.inks (attr,val) VALUES (?,?);'
++ for attr,val in attrs:
++ self.db.execute(sqlstr,(attr,val))
++
+ def update_ime (self, attrs):
+ '''Update attributes in ime table, attrs is a iterable object
+ Like [(attr,val), (attr,val), ...]
+@@ -775,6 +785,11 @@ class tabsqlitedb:
+ x_len += 1
+ #self.db.commit()
+ return result[:]
++
++ def get_all_values(self,d_name='main',t_name='inks'):
++ sqlstr = 'SELECT * FROM '+d_name+'.'+t_name+';'
++ _result = self.db.execute( sqlstr).fetchall()
++ return _result
+
+ def get_ime_property( self, attr ):
+ '''get IME property from database, attr is the string of property,
+Only in ibus-indic-table-1.3.1/engine: tabsqlitedb.pyc
diff --git a/ibus-indic-table.spec b/ibus-indic-table.spec
index c69b7f6..c3ea79d 100644
--- a/ibus-indic-table.spec
+++ b/ibus-indic-table.spec
@@ -1,6 +1,6 @@
Name: ibus-indic-table
Version: 1.3.1
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: The Table engine for IBus platform
License: LGPLv2+
Group: System Environment/Libraries
@@ -13,6 +13,7 @@ Patch3: bug-741176.patch
Patch4: bug-741176-minor-symbol.patch
Patch5: bug-742852.patch
Patch6: bug-683749.patch
+Patch7: bug-684118.patch
Requires: ibus
BuildRequires: ibus-devel
BuildArch: noarch
@@ -29,6 +30,7 @@ The Indic Table engine for IBus platform.
%patch4 -p1
%patch5 -p1
%patch6 -p1
+%patch7 -p1
%build
%configure --disable-static --disable-additional
@@ -49,6 +51,9 @@ make DESTDIR=${RPM_BUILD_ROOT} NO_INDEX=true install pkgconfigdir=%{_datadir}/pk
%{_datadir}/pkgconfig/%{name}.pc
%changelog
+* Thu Oct 13 2011 Anish Patil <apatil at redhat.com> - 1.3.1-9
+- Fixed the bug #684118
+
* Mon Oct 05 2011 Anish Patil <apatil at redhat.com> - 1.3.1-8
- Fixed the bug #683749
More information about the scm-commits
mailing list