Ciro Santilli
unread,May 12, 2012, 9:24:52 AM5/12/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to autoke...@googlegroups.com
Hi,
As motivated by my previous post, I want to create scripts and phrases without restarting Autokey.
I have tried to copy the code of Engine.create_abbreviation().
The difference is that I have to Quit (Control Q) and restart Autokey, otherwise it crashes is I try to use the phrases I created.
Even better still, would it be possible to make the new item appear without even closing the GUI?
My function:
# test_import.py
def _create_test_item(self, engine, folder):
p = model.Phrase("asdf", 'asdf')
p.modes.append(model.TriggerMode.ABBREVIATION)
p.abbreviation = 'abr'
folder.add_item(p)
engine.configManager.config_altered()
Script:
import test_import
test_import.create_test_item(engine, engine.get_folder('gen'))
Error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 403, in execute
exec script.code in self.scope
File "<string>", line 1, in <module>
File "/home/ciro/backup/noshare/programs/python/autokey/test_import.py", line 5, in <module>
import model
File "/usr/share/pyshared/autokey/model.py", line 19, in <module>
from configmanager import *
File "/usr/share/pyshared/autokey/configmanager.py", line 798, in <module>
class GlobalHotkey(AbstractHotkey):
NameError: name 'AbstractHotkey' is not defined