Esempio n. 1
0
def main():
    global_variables.init()

    ###########################################################################################################
    # Enumerate all P_ subdirectories if not yet done
    regex = re.compile('P_[0-9][0-9]')

    global_variables.participantDirList = []
    for root, dirs, files in os.walk('.'):
        for d in dirs:
            if regex.match(d):
               global_variables.participantDirList.append(d)

    global_variables.participantDirList = sorted( global_variables.participantDirList )

    # NOTE: This would be the point to filter any participants from the processing

    ###########################################################################################################
    # Setup webserver
    #
    listen_address = ''
    listen_port = 8000
    try:
        if len(sys.argv) == 2:
            listen_port = int(sys.argv[1])
        elif len(sys.argv) == 3:
            listen_address = sys.argv[1]
            listen_port = int(sys.argv[2])
        assert 0 <= listen_port <= 65535
    except (AssertionError, ValueError):
        raise ValueError('Port must be a number between 0 and 65535')

    args = sys.argv
    args.append("--log_file_prefix=myapp.log")
    tornado.log.enable_pretty_logging()
    tornado.options.parse_command_line(args)
    
    ws_app = Application()
    http_server = tornado.httpserver.HTTPServer(ws_app)
    http_server.listen(listen_port)

    # Logging
    logging.info('Listening on %s:%s' % (listen_address or '[::]' if ':' not in listen_address else '[%s]' % listen_address, listen_port))
    # [James]
    # Uncomment these lines to suppress normal webserver output
    #logging.getLogger('tornado.access').disabled = True
    #logging.getLogger('tornado.application').disabled = True
    #logging.getLogger('tornado.general').disabled = True

    # Message
    print( "WebGazer ETRA2018 Dataset Extractor server started; please open http://localhost:8000/webgazerExtractClient.html" )

    #################################
    # Start webserver
    tornado.ioloop.IOLoop.instance().start()
Esempio n. 2
0
def main():
    global_variables.init()

    try:
        global_variables.osc.serve_server()

        while True:
            time.sleep(1000)
    except (KeyboardInterrupt, SystemExit):
        print("leaving")
        global_variables.quit_flag = True
Esempio n. 3
0
def main():
    """ Module to generate Distribution Agnostic Wine icon, .desktop and .menu data files. """
    global_variables.init()
    parser = argparse.ArgumentParser(description=('Python script to generate Wine .svg/.ico icon,'
                                                  '.desktop and .menu data files.'),
                                     usage='%(prog)s [options]')
    parser.add_argument('-t', '--target', nargs='?', default=os.getcwd(),
                        help='Root directory target for building')
    parser.add_argument('-w', '--wine', nargs='?',
                        help='Wine Source directory')
    args = parser.parse_args()
    target_directory = args.target
    target_directory = os.path.realpath(target_directory)
    if not os.path.isdir(target_directory):
        parser.print_help()
        print(f'\nTarget: {target_directory} is not a valid, pre-existing directory')
        exit(1)
    wine_source_directory = args.wine
    if wine_source_directory is None:
        parser.print_help()
        print(f'\nWine Source directory not specified')
        exit(2)
    wine_source_directory = os.path.realpath(wine_source_directory)
    if not os.path.isdir(wine_source_directory):
        parser.print_help()
        print(f'\nWine Source directory: '
              +wine_source_directory
              +' is not a valid, pre-existing directory')
        exit(2)
    print('Pre-translate (non-)technical, (un)protected terms...')
    pre_translate_terms()
    print('Clean all subdirectories and files...')
    clean_all(target_directory)
    print('Create all subdirectories...')
    create_subdirectories(target_directory)
    print('Clone and modify Wine icons... ', end='')
    xml_register_svg_ns()
    process_wine_icon(wine_source_directory, target_directory)
    process_apps_svg_files(wine_source_directory, target_directory)
    process_places_svg_files(wine_source_directory, target_directory)
    print('\nCreate Wine Desktop files... ', end='')
    sys.stdout.flush()
    create_wine_desktop_files(os.path.join(target_directory, "applications"))
    print('\nCreate Wine XDG Menu files...', end='')
    sys.stdout.flush()
    create_menu_file(os.path.join(target_directory, "xdg"), "")
    print('\nCreate Wine Menu files... ', end='')
    sys.stdout.flush()
    create_wine_menu_files(os.path.join(target_directory, "desktop-directories"), "")
    print('\nCreate Makefile...')
    create_makefile(target_directory)
Esempio n. 4
0
def main():
    global_variables.init()
    print('Board initialised')
    # _thread.start_new_thread(sensors.fusion_read, ())
    _thread.start_new_thread(global_variables.pid_test.start_pid, ())

    i = 0
    while True:
        if global_variables.uart.any() > 0:
            cmd.command()
        elif global_variables.uart_gps.any() > 0:
            global_variables.gps_device.update()
        i += 1
        if i % 100 == 0:
            gc.collect()
Esempio n. 5
0
##################################
# LOADING FUNCTIONS & CLASSES    #
##################################

from functions import *
from score_model import *
from decision_model_functions import *
from gameover_model import *

##################################
#              MAIN              #
##################################

import global_variables

global_variables.init()

if __name__ == '__main__':

    print(
        'First of all is to use the command as following:\n\n#chmod +0777 /dev/uinput\n\n\n\n'
    )
    """
    ARGV`S OPTIONS
    """

    try:
        opts, args = getopt.getopt(sys.argv[1:], "hi:s:r:")
    except getopt.GetoptError:
        print(
            'Usage: train.py -i <IP:PORT> -s <save_queue_epoch=true|false> -r <playRandom=true|false>'