author | Radek Brich <radek.brich@devl.cz> |
Wed, 03 Sep 2014 08:57:06 +0200 | |
changeset 107 | 1822c37b2688 |
parent 96 | 68c562e0eb1f |
permissions | -rw-r--r-- |
96
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
1 |
# Path to root directory containing tuikit package |
92 | 2 |
import sys |
3 |
sys.path.append('..') |
|
4 |
||
96
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
5 |
# Set system locale (needed for ncurses) |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
6 |
import locale |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
7 |
locale.setlocale(locale.LC_ALL, '') |
92 | 8 |
|
9 |
# Setup logging |
|
96
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
10 |
import logging |
92 | 11 |
logger = logging.getLogger('tuikit') |
12 |
logger.setLevel(logging.DEBUG) |
|
13 |
handler = logging.FileHandler(filename='tuikit.log') |
|
14 |
handler.setLevel(logging.DEBUG) |
|
15 |
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s') |
|
16 |
handler.setFormatter(formatter) |
|
17 |
logger.addHandler(handler) |
|
96
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
18 |
|
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
19 |
# Escape key code is also used for escape sequences. After escape code, |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
20 |
# terminal waits for rest of sequence. This delay is 1 second by default. |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
21 |
# Let's hope that our terminal is fast enough to handle the sequences in 200ms. |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
22 |
import os |
68c562e0eb1f
Add TextBox, text editor demo. Update demobase.
Radek Brich <radek.brich@devl.cz>
parents:
92
diff
changeset
|
23 |
os.environ['ESCDELAY'] = '200' |