[ibus-indic-table/f16] Fixed [Bug 743502] cant type marathi numerals using booster ime

anish anishpatil at fedoraproject.org
Wed Oct 19 10:35:42 UTC 2011


commit 83df7c5c0a8fc7a30ad98eb322cd80fb0459244d
Author: anish <anish at dhcp193-44.pnq.redhat.com>
Date:   Wed Oct 19 16:06:36 2011 +0530

    Fixed [Bug 743502] cant type marathi numerals using booster ime

 bug-743502.patch      |  169 +++++++++++++++++++++++++++++++++++++++++++++++++
 ibus-indic-table.spec |    7 ++-
 2 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/bug-743502.patch b/bug-743502.patch
new file mode 100644
index 0000000..4116c7f
--- /dev/null
+++ b/bug-743502.patch
@@ -0,0 +1,169 @@
+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-19 12:00:19.403393414 +0530
++++ ibus-indic-table-1.3.1/engine/indic_table.py	2011-10-19 15:48:43.881706117 +0530
+@@ -109,6 +109,13 @@ class editor(object):
+                     self._ins_keys[keyval[0]] = keyval[1]
+         except:
+             self._is_inscript = False
++        self._indic_nums = {}
++        try:
++            keyvals = self.db.get_all_values(d_name='main',t_name='numbers')
++            for keyval in keyvals:
++                self._indic_nums[keyval[0]] = keyval[1]
++        except:
++            self._indic_nums = {}
+         # self._chinese_mode: the candidate filter mode,
+         #   0 is simplify Chinese
+         #   1 is traditional Chinese
+@@ -1467,7 +1474,11 @@ class tabengine (ibus.EngineBase):
+                     self.commit_string (cond_punct_translate (unichr (key.code)))
+                     return True
+                 if ascii.isdigit (key.code):
+-                    self.commit_string (cond_letter_translate (unichr (key.code)))
++                    if unichr (key.code) in self._editor._indic_nums:
++                        key.code = self._editor._indic_nums[unichr (key.code)]
++                        self.commit_string (cond_letter_translate (key.code))
++                    else:
++                        self.commit_string (cond_letter_translate (unichr (key.code)))
+                     return True
+             elif key.code > 127 and (not self._editor._py_mode):
+                 return False
+@@ -1588,7 +1599,7 @@ class tabengine (ibus.EngineBase):
+                     self.commit_string (sp_res[1])
+                     #self.add_string_len(sp_res[1])
+                     self.db.check_phrase (sp_res[1],sp_res[2])
+-            
++                    
+             res = self._editor.add_input ( unichr(key.code) )
+             if not res:
+                 if ascii.ispunct (key.code):
+Only in ibus-indic-table-1.3.1/engine: indic_table.py~
+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-19 12:00:19.401393414 +0530
++++ ibus-indic-table-1.3.1/engine/tabcreatedb.py	2011-10-19 15:16:29.077661969 +0530
+@@ -92,6 +92,7 @@ def main ():
+         _table = []
+         _gouci = []
+         _ins_keys = []
++        _nums = []
+         patt_com = re.compile(r'^###.*')
+         patt_blank = re.compile(r'^[ \t]*$')
+         patt_conf = re.compile(r'.*=.*')
+@@ -99,9 +100,10 @@ def main ():
+         patt_gouci = re.compile(r'.*\t.*')
+         patt_s = re.compile(r'(.*)\t([\x00-\xff]{3})\t.*')
+         patt_inscript = re.compile(r'.*:.*')
++        patt_num = 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),(patt_inscript,_ins_keys)):
++                for _patt, _list in ( (patt_table,_table),(patt_gouci,_gouci),(patt_conf,_attri),(patt_inscript,_ins_keys),(patt_num,_nums)):
+                     if _patt.match(l):
+                         _list.append(l)
+                         break
+@@ -120,7 +122,7 @@ def main ():
+                 _gouci.append('%s\t%s' %(key,gouci_dict[key] ) )
+             _gouci.sort()
+ 
+-        return (_attri, _table, _gouci,_ins_keys)
++        return (_attri, _table, _gouci,_ins_keys,_nums)
+ 
+     def parse_pinyin (f):
+         _pinyins = []
+@@ -201,6 +203,24 @@ def main ():
+             #attr = attr.lower()
+             val = val.strip()
+             yield (attr,val)
++
++
++    # Could i have much better code 
++    # first aim is to get workable code 
++    def num_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
++            val = val.strip()
++            yield (attr,val)
+     
+     def extra_parser (f):
+         list = []
+@@ -233,7 +253,7 @@ 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,in_keys =  parse_source ( source )
++    attri,table,gouci,in_keys,in_nums =  parse_source ( source )
+     
+     debug_print ('\t  get attribute of IME :)')
+     attributes = attribute_parser ( attri )
+@@ -244,6 +264,10 @@ def main ():
+     i_keys = colon_parser(in_keys)
+     db.insert_inks(i_keys)
+ 
++    # this will insert the inscript numbers into the database
++    i_nums = num_parser(in_nums)
++    db.insert_nums(i_nums)
++
+     # second, we use generators for database generating:
+     debug_print ('\t  get phrases of IME :)')
+     phrases = phrase_parser ( table)
+Only in ibus-indic-table-1.3.1/engine: tabcreatedb.py~
+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-19 12:00:19.406393414 +0530
++++ ibus-indic-table-1.3.1/engine/tabsqlitedb.py	2011-10-19 15:02:25.190642713 +0530
+@@ -279,6 +279,10 @@ class tabsqlitedb:
+             #create inscript keys table
+             sqlstr = 'CREATE TABLE IF NOT EXISTS %s.inks (attr TEXT, val TEXT);' % database
+             self.db.execute ( sqlstr )
++            
++            # create numbers table this is used to store indic numbers
++            sqlstr = 'CREATE TABLE IF NOT EXISTS %s.numbers (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
+@@ -314,6 +318,11 @@ class tabsqlitedb:
+         for attr,val in attrs:
+             self.db.execute(sqlstr,(attr,val))
+ 
++    def insert_nums(self,attrs):
++        sqlstr = 'INSERT INTO main.numbers (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), ...]
+Only in ibus-indic-table-1.3.1/engine: tabsqlitedb.py~
+Only in ibus-indic-table-1.3.1/engine: tabsqlitedb.pyc
+diff -rup ibus-indic-table-1.3.1-old/indic-tables/template.txt ibus-indic-table-1.3.1/indic-tables/template.txt
+--- ibus-indic-table-1.3.1-old/indic-tables/template.txt	2011-10-19 12:00:19.423393414 +0530
++++ ibus-indic-table-1.3.1/indic-tables/template.txt	2011-10-19 15:51:28.187709865 +0530
+@@ -135,3 +135,15 @@ BEGIN_DEFINATION_INKEYS
+   2: २
+   #:#
+ END_DEFINATION_INKEYS
++#### Numbers
++BEGIN_DEFINATION_NUMBERS
++  1 @ १
++  2 @ २
++  3 @ ३
++  4 @ ४
++  5 @ ५
++  6 @ ६
++  7 @ ७
++  8 @ ८
++  9 @ ९
++END_DEFINATION_NUMBERS
+Only in ibus-indic-table-1.3.1/indic-tables: template.txt~
diff --git a/ibus-indic-table.spec b/ibus-indic-table.spec
index a86ffeb..ba81985 100644
--- a/ibus-indic-table.spec
+++ b/ibus-indic-table.spec
@@ -1,6 +1,6 @@
 Name:       ibus-indic-table
 Version:    1.3.1
-Release:    13%{?dist}
+Release:    14%{?dist}
 Summary:    The Table engine for IBus platform
 License:    LGPLv2+
 Group:      System Environment/Libraries
@@ -17,6 +17,7 @@ Patch7:     bug-684118.patch
 Patch8:	    bug-684118-template.patch
 Patch9:	    bug-684118-inscript.patch
 Patch10:    bug-684118-capscase.patch
+Patch11:    bug-743502.patch
 Requires:       ibus
 BuildRequires:  ibus-devel
 BuildArch:  noarch
@@ -37,6 +38,7 @@ The Indic Table engine for IBus platform.
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
+%patch11 -p1
 
 %build
 %configure --disable-static --disable-additional
@@ -57,6 +59,9 @@ make DESTDIR=${RPM_BUILD_ROOT} NO_INDEX=true install pkgconfigdir=%{_datadir}/pk
 %{_datadir}/pkgconfig/%{name}.pc
 
 %changelog
+* Thu Oct 19 2011 Anish Patil <apatil at redhat.com> - 1.3.1-14
+- Fixed the #bug-743502.patch
+
 * Thu Oct 19 2011 Anish Patil <apatil at redhat.com> - 1.3.1-13
 - Fixed the #bug-684118-capscase.patch
 


More information about the scm-commits mailing list