gauravkr2108 / autokey

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

GTK crash after loop #291

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make a script that contains a while true loop
2. Make a script that stops said loop
3. Run both scripts

What is the expected output? What do you see instead?
The gtk version works correctly but the program always freezes after running 
the scripts

What version of the product are you using? On what operating system?
0.90.4 Linux Mint 17 x64 Cinnamon

Please provide any additional information below.

Script 1:
# Enter script code
import time
if clipboard.get_clipboard() == "stop":
    clipboard.fill_clipboard("dontstop")
while True:
    mouse.click_absolute(285,449,1)
    time.sleep(0.25)
    if clipboard.get_clipboard() == "stop":
        break

Script 2:
# Enter script code
clipboard.fill_clipboard("stop")

Original issue reported on code.google.com by xmiqdb...@gmail.com on 22 Sep 2014 at 7:58

GoogleCodeExporter commented 9 years ago
It was the clipboard that crashed it, solved it by using the solution found in 
issue 208 suggested by Paul and Ranju:

in /usr/lib/python2.7/dist-packages/autokey/scripting.py, change the following:

* Change this line in GtkClipboard's __fillSelection():
        self.selection.set_text(string.encode("utf-8"))
  to this:
        self.selection.set_text(string.encode("utf-8"), -1)

* Change this line in GtkClipboard's fill_clipboard():
        self.clipBoard.set_text(contents.encode("utf-8"))
  to this:
        self.clipBoard.set_text(contents.encode("utf-8"), -1)

Original comment by xmiqdb...@gmail.com on 22 Sep 2014 at 8:10