demos/demobase.py
changeset 96 68c562e0eb1f
parent 92 b97c4e25ed6d
equal deleted inserted replaced
95:05392e369ede 96:68c562e0eb1f
       
     1 # Path to root directory containing tuikit package
     1 import sys
     2 import sys
     2 sys.path.append('..')
     3 sys.path.append('..')
     3 
     4 
     4 import logging
     5 # Set system locale (needed for ncurses)
       
     6 import locale
       
     7 locale.setlocale(locale.LC_ALL, '')
     5 
     8 
     6 # Setup logging
     9 # Setup logging
       
    10 import logging
     7 logger = logging.getLogger('tuikit')
    11 logger = logging.getLogger('tuikit')
     8 logger.setLevel(logging.DEBUG)
    12 logger.setLevel(logging.DEBUG)
     9 handler = logging.FileHandler(filename='tuikit.log')
    13 handler = logging.FileHandler(filename='tuikit.log')
    10 handler.setLevel(logging.DEBUG)
    14 handler.setLevel(logging.DEBUG)
    11 formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
    15 formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
    12 handler.setFormatter(formatter)
    16 handler.setFormatter(formatter)
    13 logger.addHandler(handler)
    17 logger.addHandler(handler)
       
    18 
       
    19 # Escape key code is also used for escape sequences. After escape code,
       
    20 # terminal waits for rest of sequence. This delay is 1 second by default.
       
    21 # Let's hope that our terminal is fast enough to handle the sequences in 200ms.
       
    22 import os
       
    23 os.environ['ESCDELAY'] = '200'