Commit 7032cf7b by Anwar_N

setting liblouis language enabled

1 parent 46ec83a1
......@@ -96,6 +96,7 @@ class EngineSharadaBraille(IBus.Engine):
self.language_iter = int(Config.get('cfg',"default-language"))
self.conventional_braille = int(Config.get('cfg',"conventional-braille"))
self.liblouis_mode = int(Config.get('cfg',"liblouis-mode"))
self.liblouis_table_list = Config.get('cfg',"liblouis-table-list").split(",")
except:
self.checked_languages = ["english-en","hindi-hi"]
self.simple_mode = 0
......@@ -105,6 +106,7 @@ class EngineSharadaBraille(IBus.Engine):
self.language_iter = 0
self.conventional_braille = False;
self.liblouis_mode = False;
self.liblouis_table_list = ['unicode.dis','en-us-g2.ctb'];
self.conventional_braille_dot_4 = False;
......@@ -279,7 +281,7 @@ class EngineSharadaBraille(IBus.Engine):
count = len(string_up_to_cursor.split()[-1])
last_word = string_up_to_cursor.split()[-1]
if (string_up_to_cursor[-1] != " "):
word = louis.backTranslate(['unicode.dis','ml-in-g1.utb'],last_word,None,0)
word = louis.backTranslate(self.liblouis_table_list,last_word,None,0)
self.delete_surrounding_text(-(count),count);
self.__commit_string(word[0])
else:
......
......@@ -37,8 +37,14 @@ class ibus_sharada_braille_preferences():
self.window = self.guibuilder.get_object("window")
self.combobox_default_languge = self.guibuilder.get_object("combobox_default_languge")
self.box_ibus_table = self.guibuilder.get_object("box_ibus_table")
self.entry_liblouis_table_list = self.guibuilder.get_object("entry_liblouis_table_list")
self.combobox_liblouis_table_list = self.guibuilder.get_object("combobox_liblouis_table_list")
self.liblouis_table_liststore = Gtk.ListStore(str)
for item in os.listdir("/usr/share/liblouis/tables/"):
if(".ctb" in item or ".utb" in item):
self.liblouis_table_liststore.append([item])
self.combobox_liblouis_table_list.set_model(self.liblouis_table_liststore)
self.config = configparser.ConfigParser()
self.default_key_dict = { "dot-1":33,"dot-2":32,"dot-3":31,"dot-4":36,"dot-5":37,"dot-6":38,
......@@ -50,6 +56,8 @@ class ibus_sharada_braille_preferences():
self.checked_languages = self.config.get('cfg',"checked_languages").split(",")
self.key_dict = {}
default_language = int(self.config.get('cfg',"default-language"))
liblouis_table_list = self.config.get('cfg',"liblouis-table-list")
print(liblouis_table_list)
for key in self.default_key_dict.keys():
self.key_dict[key] = int(self.config.get('cfg',key))
# The following are for a try only
......@@ -71,6 +79,8 @@ class ibus_sharada_braille_preferences():
self.config.set('cfg',"liblouis-mode",str(0))
self.config.set('cfg',"default-language",str(0))
default_language = 0;
liblouis_table_list = "unicode.dis,en-us-g2.ctb";
self.config.set('cfg',"liblouis-table-list",str(liblouis_table_list))
self.key_dict = self.default_key_dict.copy()
self.checked_languages_liststore = Gtk.ListStore(str)
......@@ -120,6 +130,9 @@ class ibus_sharada_braille_preferences():
self.box_liblouis.set_visible(value)
self.box_ibus_table.set_visible(not value)
#set liblouis_table_list entry
self.entry_liblouis_table_list.set_text(liblouis_table_list)
self.guibuilder.connect_signals(self)
self.window.show()
......@@ -138,6 +151,22 @@ class ibus_sharada_braille_preferences():
self.config.set('cfg',"liblouis-mode",str(value))
self.box_liblouis.set_visible(value)
self.box_ibus_table.set_visible(not value)
def liblouis_add_to_list_button_clicked(self,widget,data=None):
cur_list = self.entry_liblouis_table_list.get_text()
active = self.combobox_liblouis_table_list.get_active()
new_item = self.liblouis_table_liststore[active][0]
table_list = cur_list+","+new_item
self.entry_liblouis_table_list.set_text(table_list)
self.config.set('cfg',"liblouis-table-list",str(table_list))
def liblouis_clear_list_button_clicked(self,widget,data=None):
self.entry_liblouis_table_list.set_text("unicode.dis")
def liblouis_reset_list_button_clicked(self,widget,data=None):
table_list = "unicode.dis,en-us-g2.ctb";
self.entry_liblouis_table_list.set_text(table_list)
self.config.set('cfg',"liblouis-table-list",str(table_list))
def reset_keys_and_shorcuts(self,widget,data=None):
......
......@@ -36,6 +36,12 @@ along with . If not, see <http://www.gnu.org/licenses/>.
</row>
</data>
</object>
<object class="GtkListStore" id="liststore2">
<columns>
<!-- column-name table -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">IBus-Sharada-Braille Preferences</property>
......@@ -209,9 +215,12 @@ along with . If not, see <http://www.gnu.org/licenses/>.
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_table_list">
<object class="GtkEntry" id="entry_liblouis_table_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="editable">False</property>
</object>
<packing>
<property name="expand">True</property>
......@@ -219,6 +228,20 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_clear_list">
<property name="label" translatable="yes">Clear List</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="liblouis_clear_list_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -234,6 +257,15 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<object class="GtkComboBox" id="combobox_liblouis_table_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="model">liststore2</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="expand">True</property>
......@@ -248,6 +280,7 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image_position">right</property>
<signal name="clicked" handler="liblouis_add_to_list_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
......@@ -255,6 +288,20 @@ along with . If not, see <http://www.gnu.org/licenses/>.
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button5">
<property name="label" translatable="yes">Reset to default</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="liblouis_reset_list_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!