caldurza / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

Substitution blocks the application #211

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Installed with setup.py install Autokey
2. Open autokey-gtk
3. New >> Phrase
4. Enter a new name: stupen
5. In the textbox I put: stupeň
6. Paste using Clipboard (Ctrl+V)
7. Abbreviation: stupen

What is the expected output? What do you see instead?
When writing "stupen", it should substitute it for "stupeň", however, the app 
gets blocked and white spaces are displayed instead of the substitution.

If a second time is written "stupen", then the keyboard gets blocked.

What version of the product are you using? On what operating system?
0.71.2
Ubuntu 12.04

Please provide any additional information below.

$ tail .config/autokey/autokey.log

2012-07-15 20:07:43,162 ERROR - interface - Error in X event loop thread
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/autokey/interface.py", line 116, in __eventLoop
    method(*args)
  File "/usr/local/lib/python2.7/dist-packages/autokey/interface.py", line 500, in __sendStringClipboard
    self.__fillClipboard(string)
  File "/usr/local/lib/python2.7/dist-packages/autokey/interface.py", line 537, in __fillClipboard
    self.clipBoard.set_text(string.encode("utf-8"))
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
TypeError: set_text() takes exactly 3 arguments (2 given)

Original issue reported on code.google.com by byme...@gmail.com on 15 Jul 2012 at 6:13

GoogleCodeExporter commented 8 years ago
OK, I made a little patch to solve this issue.

$ diff -u interface.py interface.py~
--- interface.py    2012-07-15 20:32:36.232074570 +0200
+++ interface.py~   2012-07-15 20:36:37.195672244 +0200
@@ -521,7 +521,7 @@
             self.sem.release()
         else:
             Gdk.threads_enter()
-            self.selection.set_text(string.encode("utf-8"), -1)
+            self.selection.set_text(string.encode("utf-8"))
             Gdk.threads_leave()

     def __fillClipboard(self, string):
@@ -534,7 +534,7 @@
             text = self.clipBoard.wait_for_text()
             self.__savedClipboard = ''
             if text is not None: self.__savedClipboard = text
-            self.clipBoard.set_text(string.encode("utf-8"), -1)
+            self.clipBoard.set_text(string.encode("utf-8"))
             Gdk.threads_leave()

     def begin_send(self):

Greetings,
Rafael Muñoz Cárdenas.

Original comment by byme...@gmail.com on 15 Jul 2012 at 6:47

GoogleCodeExporter commented 8 years ago
I just ran this and found many more references to set_text() that should 
probably also have the "-1" argument added to them:
grep -rIF '.set_text(' /usr/lib/python2.7/dist-packages/autokey

Original comment by paul...@gmail.com on 5 Dec 2012 at 10:51