Debian Codegraph @

autokey-shell

raw
1 #! /usr/bin/env python3
2
3 # -*- coding: utf-8 -*-
4 # -*- mode: python -*-
5 import distutils.spawn
6 import subprocess
7 import sys
8
9 start_script = '''
10 import autokey.iomediator
11 import autokey.configmanager.configmanager
12 import autokey.scripting as scripting
13 import autokey.scripting.highlevel as hl
14 system = scripting.System()
15 print("""
16 AutoKey functions from “autokey.scripting.highlevel” (under name “hl”)
17 and “autokey.scripting.System()” (under name “system”) are imported.
18 You can try the functions on the interpreter. For example:
19 help(hl.click_on_pat)
20 print(system.exec_command('ls'))
21 """)
22 '''
23
24 ipython3_cmd = distutils.spawn.find_executable('ipython3')
25 if ipython3_cmd is not None:
26 retcode = subprocess.call([ipython3_cmd, '-ic', start_script])
27 raise SystemExit(retcode)
28
29 python3_path = distutils.spawn.find_executable('python3')
30 if python3_path is not None:
31 retcode = subprocess.call([python3_path, '-ic', start_script])
32 raise SystemExit(retcode)
33
34 print('\033[91m' + 'Error! No Python 3 shell found.' + '\033[0m')
35 sys.exit(1)