-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathibus-braille-abbreviation-editor
executable file
·74 lines (56 loc) · 2.22 KB
/
ibus-braille-abbreviation-editor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/python3
###########################################################################
# IBus-Braille - Braille input engine for IBus
#
# Copyright (C) 2014-2015 Nalin Sathyan <nalin.x.linux@gmail.com>
# Copyright (C) 2016-2017 Anwar N <anwar3746@gmail.com>
# Copyright (C) 2022-2023 Nalin Sathyan <nalin.x.linux@gmail.com>
#
# This project was developed twice under Google Summer of Code program
# GSoC 2014 and 2016 under the guidance of Samuel Thibault.
#
# Entire project rewritten by Zendalona (2022-2023)
# wwww.zendalona.com
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###########################################################################
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
gi.require_version('IBus', '1.0')
from gi.repository import IBus
from brailleinput.engine import BrailleInputEngine
from IBusBraille import user_abbreviation_manager
from IBusBraille import global_var
from IBusBraille import localization
_ = localization._
class UserAbbreviationEditor():
def __init__(self):
self.uam = user_abbreviation_manager.UserAbbreviationManager()
self.uam.set_on_apply_abbreviations_callback(self.apply_abbreviations)
self.uam.import_from_file(global_var.abbreviations_file_path)
# opening dialog
self.uam.show()
Gtk.main();
def apply_abbreviations(self):
# Saving to file
self.uam.save_to_file(global_var.abbreviations_file_path)
# Quiting
Gtk.main_quit()
# Restarting IBus-Braille
bus = IBus.Bus()
bus.set_global_engine("IBus-Braille");
if __name__ == "__main__":
UserAbbreviationEditor()