4
# Presage, an extensible predictive text entry system
5
# ---------------------------------------------------
7
# Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License along
20
# with this program; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27
PROGRAM_NAME = 'pyprompter'
34
Copyright (C) 2004 Matteo Vescovi.
35
This is free software; see the source for copying conditions. There is NO
36
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
37
to the extent permitted by law.
38
""" % (PROGRAM_NAME, 'presage', '0.8.6')
45
-h, --help display this help and exit
46
-v, --version output version information and exit
48
Prompter is a simple predictive text editor, written to demonstrate
49
the use of presage, the intelligent predictive text entry system.
51
Begin editing. While editing, prompter uses presage to generate
52
predictions and displays them in a pop-up prediction list. If the
53
desired text is displayed in the prediction list, select it by double
54
clicking on it or by highlighting it with the arrow keys and then
55
pressing ENTER; the desired text will be automatically entered.
57
Direct your bug reports to: %s
58
""" % (PROGRAM_NAME, 'matteo.vescovi@yahoo.co.uk')
60
def parse_cmd_line_args():
61
short_options = "c:s:hv"
62
long_options = ["config=", "suggestions=", "help", "version"]
65
opts, args = getopt.getopt(sys.argv[1:], short_options, long_options)
66
except getopt.GetoptError, err:
71
if opt in ('-v', '--version'):
74
elif opt in ('-h', '--help'):
77
elif opt in ('-c', '--config'):
80
elif opt in ('-s', '--suggestions'):
85
if __name__ == "__main__":
89
import prompter.prompter
90
except ImportError, e:
92
Error: failed to import module prompter.
94
Check that prompter is properly installed (if installed in a
95
non-standard location, please set PYTHONPATH accordingly).
100
# try to locate presage.xml config file
101
scriptdir = os.path.dirname(sys.argv[0])
103
conffile = os.path.join(scriptdir, 'etc', 'presage.xml')
104
if os.path.isfile(conffile):
107
# in scriptdir/../etc
108
conffile = os.path.join(scriptdir, '..', 'etc', 'presage.xml')
109
if os.path.isfile(conffile):
111
print 'Configuration file: ' + str(config)
113
app = prompter.prompter.Prompter("0.8.6", config, suggestions)