source: trunk/papywizard/common/config.py @ 2227

Revision 2227, 7.2 KB checked in by fma, 3 years ago (diff)

Moved DRIVER_TIMEOUT and RETRY to ConfigManager?

  • Property svn:keywords set to Id
Line 
1# -*- coding: utf-8 -*-
2
3""" Panohead remote control.
4
5License
6=======
7
8 - B{Papywizard} (U{http://www.papywizard.org}) is Copyright:
9  - (C) 2007-2009 Frédéric Mantegazza
10
11This software is governed by the B{CeCILL} license under French law and
12abiding by the rules of distribution of free software.  You can  use,
13modify and/or redistribute the software under the terms of the CeCILL
14license as circulated by CEA, CNRS and INRIA at the following URL
15U{http://www.cecill.info}.
16
17As a counterpart to the access to the source code and  rights to copy,
18modify and redistribute granted by the license, users are provided only
19with a limited warranty  and the software's author,  the holder of the
20economic rights,  and the successive licensors  have only  limited
21liability.
22
23In this respect, the user's attention is drawn to the risks associated
24with loading,  using,  modifying and/or developing or reproducing the
25software by the user in light of its specific status of free software,
26that may mean  that it is complicated to manipulate,  and  that  also
27therefore means  that it is reserved for developers  and  experienced
28professionals having in-depth computer knowledge. Users are therefore
29encouraged to load and test the software's suitability as regards their
30requirements in conditions enabling the security of their systems and/or
31data to be ensured and,  more generally, to use and operate it in the
32same conditions as regards security.
33
34The fact that you are presently reading this means that you have had
35knowledge of the CeCILL license and that you accept its terms.
36
37Module purpose
38==============
39
40Configurations.
41
42@author: Frédéric Mantegazza
43@copyright: (C) 2007-2009 Frédéric Mantegazza
44@license: CeCILL
45"""
46
47__revision__ = "$Id$"
48
49import sys
50import os.path
51
52# Version
53VERSION_MAJOR = 2
54VERSION_MINOR = 1  # Odd means dev. release
55VERSION_UPDATE = 15
56VERSION = "%d.%d.%d" % (VERSION_MAJOR, VERSION_MINOR, VERSION_UPDATE)
57VERSION_XML = "b"
58
59# Paths
60HOME_DIR = os.path.expanduser("~")
61if sys.platform == 'win32':
62    USER_CONFIG_DIR = os.path.join(os.path.expandvars("$APPDATA"), "papywizard2")
63    DATA_STORAGE_DIR = HOME_DIR  # Find a way to retreive the "My Documents" dir in all languages
64    TMP_DIR = os.path.expandvars("$TEMP")
65else:
66    USER_CONFIG_DIR = os.path.join(HOME_DIR, ".config", "papywizard2")  # OpenDesktop standard
67    try:
68        import hildon
69        DATA_STORAGE_DIR = os.path.join(HOME_DIR, "MyDocs")
70    except ImportError:
71        DATA_STORAGE_DIR = HOME_DIR
72    TMP_DIR = "/tmp"
73USER_PLUGINS_DIR = os.path.join(USER_CONFIG_DIR, "plugins")
74try:
75    #os.makedirs(USER_CONFIG_DIR)
76    os.makedirs(USER_PLUGINS_DIR)
77except OSError, (errno, errmsg):
78    if errno in (17, 183): # dir already exists
79        pass
80    else:
81        raise
82CONFIG_FILE = "papywizard.conf"
83USER_CONFIG_FILE = os.path.join(USER_CONFIG_DIR, CONFIG_FILE)
84PRESET_FILE = "presets.xml"
85USER_PRESET_FILE = os.path.join(USER_CONFIG_DIR, PRESET_FILE)
86if VERSION_MINOR % 2:
87    USER_GUIDE_URL = "http://www.papywizard.org/wiki/UserGuideSvn"
88else:
89    USER_GUIDE_URL = "http://www.papywizard.org/wiki/UserGuide2.x"
90STYLESHEET_FILE = "papywizard.css"
91USER_STYLESHEET_FILE = os.path.join(USER_CONFIG_DIR, STYLESHEET_FILE)
92SPLASHCREEN_FILE = "splashscreen.png"
93
94# Model
95SENSOR_RATIOS = {'3:2': 3./2., '4:3': 4./3., '5:4': 5./4., '16:9': 16./9.}
96
97# View
98COLOR_SCHEME = 'default'
99ALPHA = 224
100SHOOTING_COLOR_SCHEME = {'default': {'background': (224, 224, 224, 255),
101                                     'head': (0, 0, 255, 255),
102                                     'border': (64, 64, 64, ALPHA),
103                                     'preview': (128, 128, 128, ALPHA),
104                                     'preview-next': (255, 255, 0, ALPHA),
105                                     'preview-toshoot': (160, 160, 160, ALPHA),
106                                     'ok': (0, 255, 0, ALPHA),
107                                     'ok-next': (255, 255, 0, ALPHA),
108                                     'ok-toshoot': (160, 255, 160, ALPHA),
109                                     'invalid': (160, 0, 255, ALPHA),
110                                     'invalid-next': (255, 255, 0, ALPHA),
111                                     'invalid-toshoot': (255, 160, 255, ALPHA),
112                                     'error': (255, 0, 0, ALPHA),
113                                     'error-next': (255, 255, 0, ALPHA),
114                                     'error-toshoot': (255, 160, 160, ALPHA),
115                                     },
116                         'dark': {'background': (32, 32, 32, 255),
117                                  'head': (0, 0, 128, 255),
118                                  'border': (160, 160, 160, ALPHA),
119                                  'preview': (64, 64, 64, ALPHA),
120                                  'preview-next': (128, 128, 0, ALPHA),
121                                  'preview-toshoot': (96, 96, 96, ALPHA),
122                                  'ok': (0, 128, 0, ALPHA),
123                                  'ok-next': (128, 128, 0, ALPHA),
124                                  'ok-toshoot': (96, 160, 96, ALPHA),
125                                  'invalid': (96, 0, 160, ALPHA),
126                                  'invalid-next': (128, 64, 255, ALPHA),
127                                  'invalid-toshoot': (128, 96, 0, ALPHA),
128                                  'error': (160, 0, 0, ALPHA),
129                                  'error-next': (128, 128, 0, ALPHA),
130                                  'error-toshoot': (128, 96, 96, ALPHA),
131                              }
132                        }
133
134# GUI index for controller
135HEAD_ORIENTATION_INDEX = {'up': 0, 'left': 1, 'right': 2, 'down': 3,
136                          0: 'up', 1: 'left', 2: 'right', 3: 'down'}
137CAMERA_ORIENTATION_INDEX = {'portrait': 0, 'landscape': 1, 'custom': 2,
138                            0: 'portrait', 1: 'landscape', 2: 'custom'}
139MOSAIC_START_FROM_INDEX = {'top-left': 0, 'top-right': 1, 'bottom-left': 2, 'bottom-right': 3,
140                           0: 'top-left', 1 : 'top-right', 2: 'bottom-left', 3: 'bottom-right'}
141MOSAIC_INITIAL_DIR_INDEX = {'yaw': 0, 'pitch': 1,
142                            0: 'yaw', 1: 'pitch'}
143SENSOR_RATIO_INDEX = {'3:2': 0, '4:3': 1, '5:4': 2, '16:9': 3,
144                      0: '3:2', 1: '4:3', 2: '5:4', 3: '16:9'}
145LENS_TYPE_INDEX = {'rectilinear': 0, 'fisheye': 1,
146                   0: 'rectilinear', 1: 'fisheye'}
147DRIVER_INDEX = {'bluetooth': 0, 'serial': 1, 'ethernet': 2,
148                0: 'bluetooth', 1: 'serial', 2: 'ethernet'}
149LOGGER_INDEX = {'trace': 0, 'debug': 1, 'info': 2, 'warning' :3, 'error': 4, 'exception': 5, 'critical': 6,
150                0: 'trace', 1: 'debug', 2: 'info', 3: 'warning', 4: 'error', 5: 'exception', 6: 'critical'}
151
152# Logger
153LOGGER_FORMAT = "%(asctime)s::%(threadName)s::%(levelname)s::%(message)s"
154LOGGER_MAX_COUNT_LINE = 1000
155LOGGER_FILENAME = "papywizard.log"
156LOGGER_MAX_BYTES = 100 * 1024
157LOGGER_BACKUP_COUNT = 3
158
159# Hardware
160BLUETOOTH_DRIVER_CONNECT_DELAY = 8.
161SERIAL_BAUDRATE = 9600
162
163# Spy
164SPY_REFRESH_DELAY = 200 # ms
165
166# Low-level simulator
167SIMUL_DEFAULT_CONNEXION = 'ethernet'
168SIMUL_DEFAULT_SERIAL_PORT = "/dev/ttyS0"
169#SIMUL_DEFAULT_SERIAL_PORT = "COM1"
170SIMUL_DEFAULT_ETHERNET_HOST = "127.0.0.1"
171SIMUL_DEFAULT_ETHERNET_PORT = 7165
172SIMUL_DEFAULT_LOGGER_LEVEL = 'debug'
Note: See TracBrowser for help on using the repository browser.