From b372c5a699f9ad8e0e866df842af3a710766dca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Wed, 29 Apr 2020 21:41:58 +0200 Subject: [PATCH] [wrong_layout] Remove plugin --- wrong_layout/__init__.py | 1 - wrong_layout/manifest.ini | 9 --- wrong_layout/plugin.py | 126 ---------------------------------- wrong_layout/wrong_layout.png | Bin 1078 -> 0 bytes 4 files changed, 136 deletions(-) delete mode 100644 wrong_layout/__init__.py delete mode 100644 wrong_layout/manifest.ini delete mode 100644 wrong_layout/plugin.py delete mode 100644 wrong_layout/wrong_layout.png diff --git a/wrong_layout/__init__.py b/wrong_layout/__init__.py deleted file mode 100644 index 7202c34..0000000 --- a/wrong_layout/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .plugin import WrongLayoutPlugin diff --git a/wrong_layout/manifest.ini b/wrong_layout/manifest.ini deleted file mode 100644 index 44847a5..0000000 --- a/wrong_layout/manifest.ini +++ /dev/null @@ -1,9 +0,0 @@ -[info] -name: Wrong Layout -short_name: wrong_layout -version: 1.3.0 -description: Press Alt+R to convert chars typed in wrong layout -authors: Denis Fomin -homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/WrongLayoutPlugin -min_gajim_version: 1.2.91 -max_gajim_version: 1.3.90 diff --git a/wrong_layout/plugin.py b/wrong_layout/plugin.py deleted file mode 100644 index 2858151..0000000 --- a/wrong_layout/plugin.py +++ /dev/null @@ -1,126 +0,0 @@ -from gi.repository import Gtk -from gi.repository import Gdk - -from gajim.common import app - -from gajim.plugins import GajimPlugin -from gajim.plugins.helpers import log_calls -from gajim.plugins.plugins_i18n import _ - - -class WrongLayoutPlugin(GajimPlugin): - @log_calls('WrongLayoutPlugin') - def init(self): - self.description = _('Press alt+r to convert chars typed in ' - 'wrong layout Rus<>Eng') - self.config_dialog = None - self.gui_extension_points = { - 'chat_control_base': (self.connect_with_chat_control, - self.disconnect_from_chat_control)} - self.chat_control = None - self.controls = [] - self.dict_eng = {'`': 'ё', 'q': 'й', 'w': 'ц', 'e': 'у', 'r': 'к', - 't': 'е', - 'y': 'н', 'u': 'г', 'i': 'ш', 'o': 'щ', 'p': 'з', '[': 'х', - ']': 'ъ', 'a': 'ф', 's': 'ы', 'd': 'в', 'f': 'а', 'g': 'п', - 'h': 'р', 'j': 'о', 'k': 'л', 'l': 'д', ';': 'ж', '\'': 'э', - 'z': 'я', 'x': 'ч', 'c': 'с', 'v': 'м', 'b': 'и', 'n': 'т', - 'm': 'ь', ',': 'б', '.': 'ю', '/': '.', - '\\': '\\', '~': 'Ё', '@': '"', '$': ';', '^': ':', '&': '?', - 'Q': 'Й', 'W': 'Ц', 'E': 'У', 'R': 'К', 'T': 'Е', 'Y': 'Н', - 'U': 'Г', 'I': 'Ш', 'O': 'Щ', 'P': 'З', '{': 'Х', '}': 'Ъ', - '|': '/', 'A': 'Ф', 'S': 'Ы', 'D': 'В', 'F': 'А', 'G': 'П', - 'H': 'Р', 'J': 'О', 'K': 'Л', 'L': 'Д', '"': 'Э', 'Z': 'Я', - 'X': 'Ч', 'C': 'С', 'V': 'М', 'B': 'И', 'N': 'Т', 'M': 'Ь', - '<': 'Б', '>': 'Ю', '?': ',', ':': 'Ж'} - self.dict_ru = {} - for key in list(self.dict_eng.keys()): - self.dict_ru[self.dict_eng[key]] = key - - @log_calls('WrongLayoutPlugin') - def activate(self): - pass - - @log_calls('WrongLayoutPlugin') - def deactivate(self): - pass - - @log_calls('WrongLayoutPlugin') - def connect_with_chat_control(self, chat_control): - self.chat_control = chat_control - control = Base(self, self.chat_control) - self.controls.append(control) - - @log_calls('WrongLayoutPlugin') - def disconnect_from_chat_control(self, chat_control): - for control in self.controls: - control.disconnect_from_chat_control() - self.controls = [] - - -class Base(object): - def __init__(self, plugin, chat_control): - self.plugin = plugin - self.chat_control = chat_control - self.textview = self.chat_control.conv_textview - - self.id_ = self.chat_control.msg_textview.connect('key_press_event', - self.mykeypress_event) - self.chat_control.handlers[self.id_] = self.chat_control.msg_textview - - def disconnect_from_chat_control(self): - if self.chat_control.msg_textview.handler_is_connected(self.id_): - self.chat_control.msg_textview.disconnect(self.id_) - - def mykeypress_event(self, widget, event): - if event.keyval == Gdk.KEY_r or event.keyval == 1739: - if event.state & Gdk.ModifierType.MOD1_MASK: # alt+r - start, end, iter_ = self.get_start_end() - count_eng = count_rus = 0 - c = iter_.get_char() - while ((c != 0) & iter_.in_range(start, end)): - if ((ord(c) > 65) & (ord(c) < 122)) | \ - (c == '@') | (c == '#') | (c == '$') | (c == '^') | \ - (c == '&') | (c == '|') | (c == '~') | \ - (c == '{') | (c == '}') | (c == '[') | (c == ']') | \ - (c == '<') | (c == '>'): - count_eng += 1 - if ((ord(c) > 1040) & (ord(c) < 1103)) | (c == 'ё') | \ - (c == 'Ё') | (c == '№'): - count_rus += 1 - iter_.forward_char() - c = iter_.get_char() - is_russian = (count_rus >= count_eng) - start, end, iter_ = self.get_start_end() - c = iter_.get_char() - text = '' - while ((c != 0) & iter_.in_range(start, end)): - if not is_russian: - conv = self.plugin.dict_eng.get(c, c) - else: - conv = self.plugin.dict_ru.get(c.encode('utf-8'), c) - text = text + conv - iter_.forward_char() - c = iter_.get_char() - start, end, iter_ = self.get_start_end() - message_buffer = self.chat_control.msg_textview.get_buffer() - message_buffer.delete(start, end) - message_buffer.insert_at_cursor(text) - self.chat_control.msg_textview.grab_focus() - return True - - def get_start_end(self): - message_buffer = self.chat_control.msg_textview.get_buffer() - sel = message_buffer.get_selection_bounds() - if sel != (): - start, end = sel - else: - start = message_buffer.get_start_iter() - end = message_buffer.get_end_iter() - stext = app.config.get('gc_refer_to_nick_char') - res = start.forward_search(stext, Gtk.TextSearchFlags.TEXT_ONLY, None) - if res: - first, start = res - start.order(end) - iter_ = start - return start, end, iter_ diff --git a/wrong_layout/wrong_layout.png b/wrong_layout/wrong_layout.png deleted file mode 100644 index 40ad9e4047510084b5da3a63f651fbb512e5658c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmV-61j+k}P))u00ckTc009930`m6uJnHlG=m8K9+8Y4@2q^gYFZl%oLkkraNFx~;DjfX&4*vW5 z{=V(&-H*)7W%vC1#sdKY00M~R^Uog)e;FA5S#j~q<^TI%{OPOL&y@cD}0GVuHnkIIs%+ ziFG$dWuMXthv64MER28uGcf)B$MBEqKLd-C5QBgWP%}RpP%+R2T--og85#cl_{Q-4 z!!L%{&o~%PJ^#WW;49_9$}2wS<=*EL00IC(0KWeO<{v`<{NB?51NZg(0Q~m=?BVnP z;L`j66(;=v0TTuQ{tpNM_X->U2nJFB^bYU0suh(zW)RP z1qez7CNVbZ=;{;Lxd{N^=mY@v!}tK*s@?z^+^_&1QdIx~j+Ou!4hjJC1lRxy>-qoz z?D_!z75V`E5eE|jh$Sq@W);665BG;RpBWCnWM&YS7G_|`_{YG?!Oiez{Za<@Pp=vN z0KNbB_kV_eplJBd2*g02{b6Ka{LAxmg)rynD*PEzZTDrm4grrzp*! zprypXs;S2Ci-j2&$^RH|0e}Ev`S$I{e-Tj;MpY#_1}QNi1~yiZ$t<9dX87^*C&T}L z{~7QBfB<4)Vq#)YQj%tnmKJ6B4@?jL|NmoP=3r%D;$VaFA()Agk%66^m4Sr|XaN_{ z7o7h=Nr3?%fPe-tFmQ4LL;K%faFl^O$OzQH2s8jhvjdYWw*W5#Cot(e1%}gyTigtP zAMi4;{^4a{`p?7y5I`({|Ndj(=jUc%V`By835c`66c;PQZ59@WN56hB+}gV7|Ec|Z zzn(aC^w#Z%&n^OE`x%$WCuK%vMj?OzVtM!OE5nf^HyPf&`^3P^%mj2U1K1m4Vj>Ku z88{fa_U=6RVe5tszkmJO0W|go%S+xuEUbROumA=3 we~>pAA%05N0B-e2p6%vX`v3p{07*qoM6N<$f|j20XaE2J