root/projects/2008/pyogp/pyogp.lib.base/branches/kotler_tests/pyogp/lib/base/settings.py

Revision 2468, 6.3 kB (checked in by kotler.linden, 5 months ago)

some more refactoring

Line 
1 class Settings(object):
2
3     def __init__(self, quiet_logging = False):
4         """ some lovely configurable settings
5
6         These are applied application wide, and can be
7         overridden at any time in a specific instance
8         """
9
10         self.quiet_logging = quiet_logging
11
12         #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13         # Application behavior settings
14         #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
16         # default start location to use in login
17         self.DEFAULT_START_LOCATION = 'last'
18
19         # toggle handling udp packets
20         self.HANDLE_PACKETS = True
21
22         # Inventory related
23
24         # enable inventory management
25         self.ENABLE_INVENTORY_MANAGEMENT = True
26
27         # enable accepting inventory offers
28         self.ACCEPT_INVENTORY_OFFERS = False
29
30         # enable library
31         self.ENABLE_LIBRARY = True
32
33         # enable object tracking
34         self.ENABLE_OBJECT_TRACKING = True
35
36         # enable communications monitoring
37         self.ENABLE_COMMUNICATIONS_TRACKING = True
38
39         # toggle parsing all/handled packets
40         self.ENABLE_DEFERRED_PACKET_PARSING = True
41
42         # toggle group chat handling
43         self.ENABLE_GROUP_CHAT = True
44
45         # enable the appearance manager
46         self.ENABLE_APPEARANCE_MANAGEMENT = True
47         self.ENABLE_LOOK_LIKE_NEARBY_AVATAR = False
48        
49         # ~~~~~~
50         # Camera
51         # ~~~~~~
52
53         # these defaults are for facing due east
54         self.DEFAULT_CAMERA_DRAW_DISTANCE = 128
55         self.DEFAULT_CAMERA_AT_AXIS = (1.0, 0.0, 0.0)
56         self.DEFAULT_CAMERA_LEFT_AXIS = (0.0, 1.0, 0.0)
57         self.DEFAULT_CAMERA_UP_AXIS = (0.0, 0.0, 1.0)
58
59         #~~~~~~~~~~~~~~~~~~~~~~~
60         # Extended Login Options
61         #~~~~~~~~~~~~~~~~~~~~~~~
62
63         # self.ENABLE_INVENTORY_MANAGEMENT is set above, and triggers the use of these options in the login params
64         self.INVENTORY_LOGIN_OPTIONS = ["inventory-root", "inventory-skeleton", "inventory-skel-lib"]
65
66         # self.ENABLE_LIBRARY is set above, and triggers the use of these options in the login params
67         self.LIBRARY_LOGIN_OPTIONS = ["inventory-lib-root", "inventory-lib-owner"]
68
69         self.ALEXANDRIA_LINDEN = 'ba2a564a-f0f1-4b82-9c61-b7520bfcd09f'
70
71         # ToDo: handle this!
72         self.ENABLE_EXTENDED_LOGIN_OPTIONS = False
73         self.EXTENDED_LOGIN_OPTIONS = ["gestures", "event_categories", "event_notifications", "classified_categories", "buddy_list", "ui-config", "login-flags", "global-textures" ]
74
75         #~~~~~~~~~~~~~~~~~~~
76         # Simulator specific
77         #~~~~~~~~~~~~~~~~~~~
78
79         # toggle handling a region's event queue
80         self.ENABLE_REGION_EVENT_QUEUE = True
81
82         # shall we handle the eq data?
83         self.HANDLE_EVENT_QUEUE_DATA = True
84
85         # how many seconds to wait between polling
86         # a region's event queue
87         self.REGION_EVENT_QUEUE_POLL_INTERVAL = 1
88
89         # allow connecting to multiple simulators
90         self.MULTIPLE_SIM_CONNECTIONS = False
91
92         # enabled the tracking of region parcels
93         self.ENABLE_PARCEL_TRACKING = True
94
95         #~~~~~~~~~~~~~~~~~~~~~~
96         # Agent Domain specific
97         #~~~~~~~~~~~~~~~~~~~~~~
98
99         # toggle handling an agent domain's event queue
100         self.ENABLE_AGENTDOMAIN_EVENT_QUEUE = True
101         # how many seconds to wait between polling
102         # a agent doamins's event queue
103         self.AGENT_DOMAIN_EVENT_QUEUE_POLL_INTERVAL = 15
104
105         #~~~~~~~~~~~~~~~~~~
106         # Logging behaviors
107         #~~~~~~~~~~~~~~~~~~
108         # being a test tool, and an immature one at that,
109         # enable fine granularity in the logging, but
110         # make sure we can tone it down as well
111
112         self.LOG_VERBOSE = True
113         self.ENABLE_BYTES_TO_HEX_LOGGING = False
114         self.ENABLE_CAPS_LOGGING = True
115         self.ENABLE_CAPS_LLSD_LOGGING = False
116         self.ENABLE_EQ_LOGGING = True
117         self.ENABLE_UDP_LOGGING = True
118         self.ENABLE_OBJECT_LOGGING = True
119         self.LOG_SKIPPED_PACKETS = True
120         self.ENABLE_HOST_LOGGING = True
121         self.LOG_COROUTINE_SPAWNS = True
122
123         # allow disabling logging of certain packets
124         self.DISABLE_SPAMMERS = True
125         self.UDP_SPAMMERS = ['PacketAck', 'AgentUpdate']
126
127         # override the defaults
128         if self.quiet_logging:
129             self.LOG_VERBOSE = False
130             self.ENABLE_BYTES_TO_HEX_LOGGING = False
131             self.ENABLE_CAPS_LOGGING = False
132             self.ENABLE_CAPS_LLSD_LOGGING = False
133             self.ENABLE_EQ_LOGGING = False
134             self.ENABLE_UDP_LOGGING = False
135             self.LOG_SKIPPED_PACKETS = False
136             self.ENABLE_OBJECT_LOGGING = False
137             self.ENABLE_HOST_LOGGING = False
138             self.LOG_COROUTINE_SPAWNS = False
139
140         #~~~~~~~~~~~~~~~~~~~~~~
141         # Test related settings
142         #~~~~~~~~~~~~~~~~~~~~~~
143
144         self.ENABLE_LOGGING_IN_TESTS = True
145
146     # parameters for xmplrpc login
147     def get_default_xmlrpc_login_parameters(self):
148         """ returns some default login params """
149
150         login_options = []
151
152         if self.ENABLE_INVENTORY_MANAGEMENT:
153             for option in self.INVENTORY_LOGIN_OPTIONS:
154                 login_options.append(option)
155
156         if self.ENABLE_LIBRARY:
157             for option in self.LIBRARY_LOGIN_OPTIONS:
158                 login_options.append(option)
159
160         if self.ENABLE_EXTENDED_LOGIN_OPTIONS:
161             for option in self.EXTENDED_LOGIN_OPTIONS:
162                 login_options.append(option)
163
164         params = {   
165             'major': '1',
166             'minor': '22',
167             'patch': '9',
168             'build': '1',
169             'platform': 'Win',
170             'options': login_options,
171             'user-agent': 'pyogp 0.1',
172             'id0': '',
173             'viewer_digest': '09d93740-8f37-c418-fbf2-2a78c7b0d1ea',
174             'version': 'pyogp 0.1',
175             'channel': 'pyogp',
176             'mac': '',
177             'agree_to_tos': True,
178             'read_critical': True
179         }
180
181         return params
182
183 """
184 Contributors can be viewed at:
185 http://svn.secondlife.com/svn/linden/projects/2008/pyogp/CONTRIBUTORS.txt
186
187 $LicenseInfo:firstyear=2008&license=apachev2$
188
189 Copyright 2009, Linden Research, Inc.
190
191 Licensed under the Apache License, Version 2.0 (the "License").
192 You may obtain a copy of the License at:
193     http://www.apache.org/licenses/LICENSE-2.0
194 or in
195     http://svn.secondlife.com/svn/linden/projects/2008/pyogp/LICENSE.txt
196
197 $/LicenseInfo$
198 """
199
Note: See TracBrowser for help on using the browser.