| 1 |
#!/usr/bin/env python |
|---|
| 2 |
# |
|---|
| 3 |
# WinDictator: |
|---|
| 4 |
# Dictate in Windows, have the text typed in Linux via X faked keystroke events |
|---|
| 5 |
# |
|---|
| 6 |
# Copyright (C) 2005-2006 by Edwin A. Suominen, http://www.eepatents.com |
|---|
| 7 |
# |
|---|
| 8 |
# This program is free software; you can redistribute it and/or modify it under |
|---|
| 9 |
# the terms of the GNU General Public License as published by the Free Software |
|---|
| 10 |
# Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 11 |
# version. |
|---|
| 12 |
# |
|---|
| 13 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 14 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 15 |
# FOR A PARTICULAR PURPOSE. See the file COPYING for more details. |
|---|
| 16 |
# |
|---|
| 17 |
# You should have received a copy of the GNU General Public License along with |
|---|
| 18 |
# this program; if not, write to the Free Software Foundation, Inc., 51 |
|---|
| 19 |
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
NAME = "WinDictator" |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
### Imports and support |
|---|
| 26 |
import sys |
|---|
| 27 |
from subprocess import call |
|---|
| 28 |
from distutils.core import setup |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
class Commands: |
|---|
| 32 |
def __init__(self): |
|---|
| 33 |
self.cmds = {} |
|---|
| 34 |
|
|---|
| 35 |
def add(self, mode, *args, **kw): |
|---|
| 36 |
""" |
|---|
| 37 |
Adds a command to the queue for the specified mode |
|---|
| 38 |
""" |
|---|
| 39 |
cmdTuple = (args, kw) |
|---|
| 40 |
self.cmds.setdefault(mode, []).append(cmdTuple) |
|---|
| 41 |
|
|---|
| 42 |
def run(self): |
|---|
| 43 |
""" |
|---|
| 44 |
Runs the queued commands for the current setup mode |
|---|
| 45 |
""" |
|---|
| 46 |
if "install" in sys.argv: |
|---|
| 47 |
mode = 'install' |
|---|
| 48 |
else: |
|---|
| 49 |
mode = None |
|---|
| 50 |
for args, kw in self.cmds.get(mode, []): |
|---|
| 51 |
call(args, **kw) |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
### Define setup options |
|---|
| 55 |
kw = {'version':'0.1', |
|---|
| 56 |
'license':'GPL', |
|---|
| 57 |
'platforms':'OS Independent', |
|---|
| 58 |
|
|---|
| 59 |
'url':"http://foss.eepatents.com/%s/" % NAME, |
|---|
| 60 |
'author':'Edwin A. Suominen', |
|---|
| 61 |
'author_email':'ed@eepatents.com', |
|---|
| 62 |
|
|---|
| 63 |
'maintainer':'Edwin A. Suominen', |
|---|
| 64 |
'maintainer_email':'ed@eepatents.com', |
|---|
| 65 |
|
|---|
| 66 |
'packages':['windictator'], |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
kw['keywords'] = [ |
|---|
| 70 |
'dictation', 'voice recognition', 'speech recognition', |
|---|
| 71 |
'X', 'Xlib', 'keyboard', |
|---|
| 72 |
'Twisted', 'asynchronous'] |
|---|
| 73 |
|
|---|
| 74 |
kw['classifiers'] = [ |
|---|
| 75 |
'Environment :: Win32 (MS Windows)', |
|---|
| 76 |
'Operating System :: Microsoft :: Windows', |
|---|
| 77 |
'Environment :: X11 Applications', |
|---|
| 78 |
'Operating System :: POSIX :: Linux', |
|---|
| 79 |
'Development Status :: 4 - Beta', |
|---|
| 80 |
'Intended Audience :: End Users/Desktop', |
|---|
| 81 |
'License :: OSI Approved :: GNU General Public License (GPL)', |
|---|
| 82 |
'Programming Language :: Python', |
|---|
| 83 |
'Programming Language :: C', |
|---|
| 84 |
'Topic :: Multimedia :: Sound/Audio :: Speech', |
|---|
| 85 |
'Topic :: Office/Business', |
|---|
| 86 |
'Topic :: Text Editors :: Word Processors' |
|---|
| 87 |
] |
|---|
| 88 |
|
|---|
| 89 |
kw['description'] = """ |
|---|
| 90 |
Dictate in Windows, have the text typed in Linux via X faked keystroke events |
|---|
| 91 |
""" |
|---|
| 92 |
|
|---|
| 93 |
kw['long_description'] = """ |
|---|
| 94 |
The WinDictator application gives desktop users of the GNU/Linux operating |
|---|
| 95 |
system a convenient way to make use of speech recognition software that runs |
|---|
| 96 |
only under the Microsoft Windows operating system in their day-to-day |
|---|
| 97 |
work. With it, your dictation software (e.g., Dragon NaturallySpeaking) runs on |
|---|
| 98 |
a separate computer (virtual or real) that is running the Windows OS and |
|---|
| 99 |
networked to your Linux-based desktop. |
|---|
| 100 |
|
|---|
| 101 |
One half of WinDictator is a server that runs on the computer you're using for |
|---|
| 102 |
dictation. The other half is a client, running on your Linux-based desktop, |
|---|
| 103 |
that establishes a TCP connection to the server and obtains the text you're |
|---|
| 104 |
dictating via the connection. The client 'types' that text into whatever X |
|---|
| 105 |
window you're working with using faked X keystroke events. |
|---|
| 106 |
""" |
|---|
| 107 |
|
|---|
| 108 |
# Windows vs. Linux variations |
|---|
| 109 |
cmds = Commands() |
|---|
| 110 |
if sys.platform.startswith('win'): |
|---|
| 111 |
msgTuple = ("Windows", "Linux") |
|---|
| 112 |
kw['scripts'] = ['wdwin.pyw'] |
|---|
| 113 |
kw['packages'].append('windictator.windows') |
|---|
| 114 |
else: |
|---|
| 115 |
msgTuple = ("Linux", "Windows") |
|---|
| 116 |
kw['scripts'] = ['wdlin'] |
|---|
| 117 |
kw['packages'].append('windictator.linux') |
|---|
| 118 |
cmds.add('install', 'make', 'install', cwd='bin/typist/') |
|---|
| 119 |
cmds.add('install', 'make', 'install', cwd='bin/reporter/') |
|---|
| 120 |
|
|---|
| 121 |
### Finally, run the setup |
|---|
| 122 |
mp = "Beginning %s Installation. Make sure you install on %s as well." |
|---|
| 123 |
print mp % msgTuple |
|---|
| 124 |
print "-" * 50 |
|---|
| 125 |
setup(name=NAME, **kw) |
|---|
| 126 |
if "install" in sys.argv: |
|---|
| 127 |
cmds.run() |
|---|