Repository :
http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
---------------------------------------------------------------
commit 0fe515996c7dcc6414ba35a9a56a369dcf176c01
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Thu Dec 17 10:46:17 2015 +0100
Some more debug output
---------------------------------------------------------------
ibus-typing-booster/engine/factory.py | 17 +++++++++++++++++
ibus-typing-booster/engine/hunspell_suggest.py | 2 +-
ibus-typing-booster/engine/hunspell_table.py | 9 ++++++---
ibus-typing-booster/engine/main.py | 16 ++++++++++++++++
ibus-typing-booster/engine/tabsqlitedb.py | 3 ++-
5 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/ibus-typing-booster/engine/factory.py
b/ibus-typing-booster/engine/factory.py
index ca077c3..75cfd99 100755
--- a/ibus-typing-booster/engine/factory.py
+++ b/ibus-typing-booster/engine/factory.py
@@ -22,14 +22,26 @@ from gi.repository import IBus
import hunspell_table
import tabsqlitedb
import re
+import os
+import sys
from gettext import dgettext
_ = lambda a : dgettext ("ibus-typing-booster", a)
N_ = lambda a : a
+debug_level = int(0)
+
class EngineFactory (IBus.Factory):
"""Table IM Engine Factory"""
def __init__(self, bus, db="", icon=""):
+ global debug_level
+ try:
+ debug_level = int(os.getenv('IBUS_TYPING_BOOSTER_DEBUG_LEVEL'))
+ except (TypeError, ValueError):
+ debug_level = int(0)
+ if debug_level > 1:
+ sys.stderr.write("EngineFactory.__init__(bus=%s, db=%s,
icon=%s)\n"
+ % (bus, db, icon))
if db:
self.db = tabsqlitedb.tabsqlitedb(config_filename=db)
else:
@@ -43,6 +55,9 @@ class EngineFactory (IBus.Factory):
self.engine_id = 0
def do_create_engine(self, engine_name):
+ if debug_level > 1:
+
sys.stderr.write("EngineFactory.do_create_engine(engine_name=%s)\n"
+ % engine_name)
engine_base_path = "/com/redhat/IBus/engines/table/%s/engine/"
path_patt = re.compile(r'[^a-zA-Z0-9_/]')
self.engine_path = engine_base_path % path_patt.sub ('_', engine_name)
@@ -70,6 +85,8 @@ class EngineFactory (IBus.Factory):
def do_destroy (self):
'''Destructor, which finish some task for IME'''
+ if debug_level > 1:
+ sys.stderr.write("EngineFactory.do_destroy()\n")
for _db in self.dbdict:
self.dbdict[_db].sync_usrdb()
super(EngineFactory, self).destroy()
diff --git a/ibus-typing-booster/engine/hunspell_suggest.py
b/ibus-typing-booster/engine/hunspell_suggest.py
index ce66513..8e3a85c 100755
--- a/ibus-typing-booster/engine/hunspell_suggest.py
+++ b/ibus-typing-booster/engine/hunspell_suggest.py
@@ -51,7 +51,7 @@ class Dictionary:
def __init__(self, name=u'en_US'):
if debug_level > 1:
sys.stderr.write(
- "Dictionary.__init__(name=%s)" %name)
+ "Dictionary.__init__(name=%s)\n" %name)
self.loc = '/usr/share/myspell'
self.name = name
self.encoding = 'UTF-8'
diff --git a/ibus-typing-booster/engine/hunspell_table.py
b/ibus-typing-booster/engine/hunspell_table.py
index 1ff0052..cdbd995 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -107,7 +107,8 @@ class editor(object):
def __init__ (self, config, database):
if debug_level > 1:
- sys.stderr.write("editor __init__()\n")
+ sys.stderr.write("editor __init__(config=%s, database=%s)\n"
+ %(config, database))
self.db = database
self._config = config
self._name = self.db.ime_properties.get('name')
@@ -165,7 +166,7 @@ class editor(object):
try:
if debug_level > 1:
sys.stderr.write(
- "calling Transliterator(%(cur)s)\n"
+ "instantiating Transliterator(%(cur)s)\n"
%{'cur': self._current_ime})
self.trans = Transliterator(self._current_ime)
except ValueError as e:
@@ -571,7 +572,9 @@ class tabengine (IBus.Engine):
except (TypeError, ValueError):
debug_level = int(0)
if debug_level > 1:
- sys.stderr.write("tabengine.__init__() obj_path=%s\n" %obj_path)
+ sys.stderr.write(
+ "tabengine.__init__(bus=%s, obj_path=%s, db=%s)\n"
+ % (bus, obj_path, db))
super(tabengine, self).__init__(
connection=bus.get_connection(), object_path=obj_path)
self._input_purpose = 0
diff --git a/ibus-typing-booster/engine/main.py b/ibus-typing-booster/engine/main.py
index de16183..35cf362 100755
--- a/ibus-typing-booster/engine/main.py
+++ b/ibus-typing-booster/engine/main.py
@@ -27,6 +27,12 @@ from signal import signal, SIGTERM, SIGINT
import factory
import tabsqlitedb
+debug_level = int(0)
+try:
+ debug_level = int(os.getenv('IBUS_TYPING_BOOSTER_DEBUG_LEVEL'))
+except (TypeError, ValueError):
+ debug_level = int(0)
+
try:
config_file_dir = os.path.join(
os.getenv('IBUS_TYPING_BOOSTER_LOCATION'),
@@ -80,6 +86,10 @@ if options.profile:
class IMApp:
def __init__(self, dbfile, exec_by_ibus):
+ if debug_level > 1:
+ sys.stderr.write(
+ "IMApp.__init__(dbfile=%s, exec_by_ibus=%s)\n"
+ % (dbfile, exec_by_ibus))
self.__mainloop = GLib.MainLoop()
self.__bus = IBus.Bus()
self.__bus.connect("disconnected", self.__bus_destroy_cb)
@@ -125,15 +135,21 @@ class IMApp:
def run(self):
+ if debug_level > 1:
+ sys.stderr.write("IMApp.run()\n")
if options.profile:
profile.enable()
self.__mainloop.run()
self.__bus_destroy_cb()
def quit(self):
+ if debug_level > 1:
+ sys.stderr.write("IMApp.quit()\n")
self.__bus_destroy_cb()
def __bus_destroy_cb(self, bus=None):
+ if debug_level > 1:
+ sys.stderr.write("IMApp.__bus_destroy_cb(bus=%s)\n" % bus)
if self.destroyed:
return
print("finalizing:)")
diff --git a/ibus-typing-booster/engine/tabsqlitedb.py
b/ibus-typing-booster/engine/tabsqlitedb.py
index 89b9364..8784270 100755
--- a/ibus-typing-booster/engine/tabsqlitedb.py
+++ b/ibus-typing-booster/engine/tabsqlitedb.py
@@ -89,7 +89,8 @@ class tabsqlitedb:
except (TypeError, ValueError):
debug_level = int(0)
if debug_level > 1:
- sys.stderr.write("tabsqlitedb.__init__()")
+ sys.stderr.write("tabsqlitedb.__init__(config_filename=%s)\n"
+ %config_filename)
self._phrase_table_column_names = [
'id',
'input_phrase',