source: trunk/synapse/Puzzlebox/Synapse/Configuration.py @ 259

Last change on this file since 259 was 259, checked in by sc, 10 years ago

trunk/synapse/Puzzlebox/Synapse/Interface.py:

  • Now supports configurable interface tab positioning

trunk/synapse/Puzzlebox/Synapse/Configuration.py:

  • Now supports configurable interface tab positioning

trunk/synapse/puzzlebox_synapse_configuration.ini:

  • Now supports configurable interface tab positioning

trunk/brainstorms/Puzzlebox/Brainstorms/Interface.py:

  • additional To Do updates
File size: 6.2 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright Puzzlebox Productions, LLC (2010)
5#
6# This code is released under the GNU Pulic License (GPL) version 2
7# For more information please refer to http://www.gnu.org/copyleft/gpl.html
8
9__changelog__ = """\
10Last Update: 2010.08.09
11
12"""
13
14import os, sys
15
16#####################################################################
17# General configuration
18#####################################################################
19
20DEBUG = 1
21
22CONFIGURATION_FILE_PATH = 'puzzlebox_synapse_configuration.ini'
23
24if (sys.platform != 'win32'):
25        if not os.path.exists(CONFIGURATION_FILE_PATH):
26                CONFIGURATION_FILE_PATH = \
27                        os.path.join('/etc/puzzlebox_synapse', CONFIGURATION_FILE_PATH)
28
29INTERFACE_CHART_STYLES = { \
30        'attention': 'r-', \
31        'meditation': 'b-', \
32        'delta': 'g-', \
33        'theta': 'y-', \
34        'lowAlpha': 'c-', \
35        'highAlpha': 'b-', \
36        'lowBeta': 'r-', \
37        'highBeta': 'm-', \
38        'lowGamma': 'k-', \
39        'highGamma': 'k-', \
40}
41
42INTERFACE_TAB_POSITION = 'North'
43
44#The following color abbreviations are supported:
45#character      color
46#‘b’        blue
47#‘g’        green
48#‘r’        red
49#‘c’        cyan
50#‘m’        magenta
51#‘y’        yellow
52#‘k’        black
53#‘w’        white
54
55#The following format string characters are accepted to control the line style or marker:
56#character      description
57#'-'    solid line style
58#'--'   dashed line style
59#'-.'   dash-dot line style
60#':'    dotted line style
61#'.'    point marker
62#','    pixel marker
63#'o'    circle marker
64#'v'    triangle_down marker
65#'^'    triangle_up marker
66#'<'    triangle_left marker
67#'>'    triangle_right marker
68#'1'    tri_down marker
69#'2'    tri_up marker
70#'3'    tri_left marker
71#'4'    tri_right marker
72#'s'    square marker
73#'p'    pentagon marker
74#'*'    star marker
75#'h'    hexagon1 marker
76#'H'    hexagon2 marker
77#'+'    plus marker
78#'x'    x marker
79#'D'    diamond marker
80#'d'    thin_diamond marker
81#'|'    vline marker
82#'_'    hline marker
83
84
85#####################################################################
86# Network addresses
87#####################################################################
88
89THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
90#THINKGEAR_SERVER_HOST = '127.0.0.1'
91THINKGEAR_SERVER_HOST = '*'
92THINKGEAR_SERVER_PORT = 13854
93
94
95#####################################################################
96# ThinkGear Device configuration
97#####################################################################
98
99DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS = 'COM2'
100DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX = '/dev/rfcomm0'
101
102if (sys.platform == 'win32'):
103        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_WINDOWS
104else:
105        THINKGEAR_DEVICE_SERIAL_PORT = DEFAULT_THINKGEAR_DEVICE_SERIAL_PORT_LINUX
106
107# Use Bluetooth MAC address for Linux
108THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = ''
109# THINKGEAR_DEVICE_BLUETOOTH_ADDRESS = '00:13:EF:xx:xx:xx' # Linux example
110
111
112#####################################################################
113# Server configuration
114#####################################################################
115
116CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
117
118
119#####################################################################
120# ThinkGear Connect configuration
121#####################################################################
122
123THINKGEAR_DELIMITER = '\r'
124
125THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
126
127ENABLE_THINKGEAR_AUTHORIZATION = False
128
129THINKGEAR_AUTHORIZATION_REQUEST = { \
130        "appName": "Puzzlebox Brainstorms", \
131        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
132        }
133
134THINKGEAR_EEG_POWER_BAND_ORDER = ['delta', \
135                                  'theta', \
136                                  'lowAlpha', \
137                                  'highAlpha', \
138                                  'lowBeta', \
139                                  'highBeta', \
140                                  'lowGamma', \
141                                  'highGamma']
142
143THINKGEAR_EMULATION_MAX_ESENSE_VALUE = 100
144THINKGEAR_EMULATION_MAX_EEG_POWER_VALUE = 16384
145
146THINKGEAR_ATTENTION_MULTIPLIER = 1.0
147THINKGEAR_MEDITATION_MULTIPLIER = 1.0
148
149THINKGEAR_EEG_POWER_MULTIPLIERS = { \
150        'delta': 1.0, \
151        'theta': 1.0, \
152        'lowAlpha': 1.0, \
153        'highAlpha': 1.0, \
154        'lowBeta': 1.0, \
155        'highBeta': 1.0, \
156        'lowGamma': 1.0, \
157        'highGamma': 1.0, \
158}
159
160
161#####################################################################
162# ThinkGear Connect Server Emulator configuration
163#####################################################################
164
165THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
166
167THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
168                                    # (6 seconds is listed by Wikipedia
169                                    # as being the average number of times
170                                    # an adult blinks in a laboratory setting)
171
172THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
173                                         # and back to 0 for any given
174                                         # detection value below
175
176
177#####################################################################
178# Flash socket policy handling
179#####################################################################
180
181FLASH_POLICY_FILE_REQUEST = \
182        '<policy-file-request/>%c' % 0 # NULL byte termination
183FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
184<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
185<cross-domain-policy>
186   <site-control permitted-cross-domain-policies="all" />
187   <allow-access-from domain="*" to-ports="%i" />
188</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
189
190
191#####################################################################
192# Configuration File Parser
193#####################################################################
194
195if os.path.exists(CONFIGURATION_FILE_PATH):
196       
197        file = open(CONFIGURATION_FILE_PATH, 'r')
198       
199        for line in file.readlines():
200                line = line.strip()
201                if len(line) == 0:
202                        continue
203                if line[0] == '#':
204                        continue
205                if line.find('=') == -1:
206                        continue
207                if (line == "THINKGEAR_DEVICE_SERIAL_PORT = ''"):
208                        # use operating system default if device not set manually
209                        continue
210                try:
211                        exec line
212                except:
213                        if DEBUG:
214                                print "Error recognizing configuration option:",
215                                print line
216
Note: See TracBrowser for help on using the repository browser.