~ubuntu-branches/ubuntu/trusty/spyder/trusty-proposed

« back to all changes in this revision

Viewing changes to spyderlib/config.py

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Aubry
  • Date: 2010-06-28 23:43:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100628234302-3xnz0gcu0w83282r
Tags: 1.1.1-1
* New upstream release
* New maintainer address (Closes: #586833)
* Build with python 2.6 (Closes: #586824)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
"""
8
8
Spyder configuration management
 
9
 
 
10
Important note regarding shortcuts:
 
11
    For compatibility with QWERTZ keyboards, one must avoid using the following
 
12
    shortcuts:
 
13
        Ctrl + Alt + Q, W, F, G, Y, X, C, V, B, N
9
14
"""
10
15
 
11
16
import os, sys
21
26
 
22
27
# The two following lines are patched when making the debian package:
23
28
DATA_PATH = DATA_DEV_PATH # @@@DATA_PATH@@@
24
 
DOC_PATH = DOC_DEV_PATH # @@@DOC_PATH@@@
 
29
DOC_PATH = "/usr/share/doc/spyder/doc"
25
30
 
26
31
FILTERS = [int, long, float, list, dict, tuple, str, unicode, date]
27
32
try:
29
34
    FILTERS.append(ndarray)
30
35
except ImportError:
31
36
    pass
 
37
try:
 
38
    from PIL.Image import Image
 
39
    FILTERS.append(Image)
 
40
except ImportError:
 
41
    pass
32
42
 
33
43
# Max number of filter iterations for worskpace display:
34
44
# (for workspace saving, itermax == -1, see Workspace.save)
35
45
ITERMAX = -1 #XXX: To be adjusted if it takes too much to compute... 2, 3?
36
46
 
37
 
EXCLUDED = ['nan', 'inf', 'infty', 'little_endian', 'colorbar_doc', 'e', 'pi',
38
 
            'typecodes', '__builtins__', '__main__', '__doc__']
 
47
EXCLUDED = ['nan', 'inf', 'infty', 'little_endian', 'colorbar_doc', 'typecodes',
 
48
            '__builtins__', '__main__', '__doc__']
39
49
 
40
50
def type2str(types):
41
51
    """Convert types to strings"""
45
55
    """Convert strings to types"""
46
56
    return tuple( [eval(string) for string in strings] )
47
57
 
48
 
SANS_SERIF = ['Sans Serif', 'DejaVu Sans', 'Bitstream Vera Sans',
49
 
              'Bitstream Charter', 'Lucida Grande', 'Verdana', 'Geneva',
 
58
SANS_SERIF = ['Sans Serif', 'DejaVu Sans', 'Bitstream Vera Sans',
 
59
              'Bitstream Charter', 'Lucida Grande', 'Verdana', 'Geneva',
50
60
              'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif']
51
61
SANS_SERIF.insert(0, unicode(QFont().family()))
52
62
 
53
 
MONOSPACE = ['Monospace', 'DejaVu Sans Mono', 'Courier New',
54
 
             'Bitstream Vera Sans Mono', 'Andale Mono', 'Liberation Mono',
 
63
MONOSPACE = ['Monospace', 'DejaVu Sans Mono', 'Courier New',
 
64
             'Bitstream Vera Sans Mono', 'Andale Mono', 'Liberation Mono',
55
65
             'Monaco', 'Courier', 'monospace', 'Fixed', 'Terminal']
56
66
MEDIUM = 10
57
67
SMALL = 9
58
68
 
59
 
STATE1 = '000000ff00000000fd00000002000000000000027400000271fc0200000009fb000000120045006400690074006f0072005f00640077010000003700000271000000bb00fffffffb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f00640077020000001a000000330000029200000215fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f00640077020000001a000000330000029200000215fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770200000030000000500000029200000215fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770200000030000000500000029200000215fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f0064007702000000460000006d0000029200000215000000010000027400000271fc0200000002fc00000037000000e1000000b101000015fa000000010100000005fb000000180044006f0063005600690065007700650072005f006400770100000000ffffffff0000011200fffffffb000000180057006f0072006b00730070006100630065005f006400770100000000ffffffff0000005000fffffffb00000016004500780070006c006f007200650072005f006400770100000000ffffffff0000007400fffffffb0000001c00460069006e00640049006e00460069006c00650073005f006400770000000000ffffffff000001ca00fffffffb0000001200500079006c0069006e0074005f0064007701000002b800000234000000e400fffffffc0000011c0000018c0000009701000015fa000000010100000004fb0000002400450078007400650072006e0061006c0043006f006e0073006f006c0065005f006400770100000000ffffffff000000a800fffffffb000000140043006f006e0073006f006c0065005f006400770100000000ffffffff0000005000fffffffb0000001a0048006900730074006f00720079004c006f0067005f006400770100000000ffffffff000000d700fffffffb0000001c00530061006600650043006f006e0073006f006c0065005f006400770100000000ffffffff0000000000000000000000000000027100000004000000040000000800000008fc000000020000000000000000000000020000000800000018006d00610069006e005f0074006f006f006c00620061007201000000000000003700000000000000000000001800660069006c0065005f0074006f006f006c0062006100720100000037000000780000000000000000000000200061006e0061006c0079007300690073005f0074006f006f006c00620061007201000000af0000007400000000000000000000001600720075006e005f0074006f006f006c00620061007201000001230000003b0000000000000000000000180065006400690074005f0074006f006f006c006200610072010000015e0000005800000000000000000000001800660069006e0064005f0074006f006f006c00620061007201000001b60000005800000000000000000000001400770073005f0074006f006f006c006200610072010000020e0000005800000000000000000000002a005200e90070006500720074006f0069007200650020006400650020007400720061007600610069006c0100000266000002080000000000000000'
60
 
STATE2 = '000000ff00000000fd00000002000000000000050e00000365fc0200000006fc0000003800000365000001a300100018fc0200000002fc0000003800000213000000bf0007fffffc0100000002fb00000016004500780070006c006f007200650072005f006400770100000000000000f10000009d0007fffffc000000f500000419000000f20007fffffa000000000100000002fb000000120045006400690074006f0072005f00640077010000000000000184000000f20007fffffb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000000ffffffff0000000000000000fc0000024f0000014e000000e000080015fc0100000002fc00000000000002c4000001ca0007fffffa000000020100000004fb0000001c00460069006e00640049006e00460069006c00650073005f006400770100000000ffffffff000001ca0007fffffb0000002400450078007400650072006e0061006c0043006f006e0073006f006c0065005f006400770100000000ffffffff000000a80007fffffb000000140043006f006e0073006f006c0065005f006400770100000000ffffffff000000590007fffffb0000001a0048006900730074006f00720079004c006f0067005f006400770100000000ffffffff000000590007fffffc000002c8000002460000013c0007fffffa000000010200000002fb000000180057006f0072006b00730070006100630065005f006400770100000000ffffffff0000005d0007fffffb000000180044006f0063005600690065007700650072005f00640077010000028d000001460000008b0007fffffc0000015b000000b80000000000fffffffa000000000200000002fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f00640077020000030a00000111000001d70000019dfb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000000ffffffff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff000000000000000000000001fffffffc00000365fc0200000002fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f0064007700000000380000039b0000000000fffffffc000001e4000001ef0000000000fffffffa000000000100000001fb0000001c00530061006600650043006f006e0073006f006c0065005f006400770100000000ffffffff0000000000000000000000000000036500000004000000040000000800000008fc00000001000000020000000800000018006d00610069006e005f0074006f006f006c00620061007201000000000000002b00000000000000000000001800660069006c0065005f0074006f006f006c006200610072010000002b000000880000000000000000000000200061006e0061006c0079007300690073005f0074006f006f006c00620061007201000000b30000006900000000000000000000001600720075006e005f0074006f006f006c006200610072010000011c000000750000000000000000000000180065006400690074005f0074006f006f006c00620061007201000001910000005600000000000000000000001800660069006e0064005f0074006f006f006c00620061007201000001e70000006d00000000000000000000001400770073005f0074006f006f006c00620061007201000002540000006d00000000000000000000002a005200e90070006500720074006f0069007200650020006400650020007400720061007600610069006c01000002c10000024d0000000000000000'
 
69
# Note: These default hexstates are no longer used --> too much bugs
 
70
#       Now, the default window layout is done programmatically (see spyder.py)
 
71
#       when the .ini file doesn't exist or when the --reset option is passed
 
72
#STATE1 = '000000ff00000000fd0000000100000001000004ec0000026ffc0200000001fc000000380000026f0000018700fffffffc0100000002fb000000120045006400690074006f0072005f00640077010000000000000280000000db00fffffffc0000028400000268000001ca00fffffffc0200000002fc0000003800000161000000e001000015fa000000010100000006fb0000001200500079006c0069006e0074005f006400770000000000ffffffff000000e400fffffffb0000001a004f006e006c0069006e006500480065006c0070005f006400770100000000ffffffff0000017800fffffffb00000024004f0062006a0065006300740049006e00730070006500630074006f0072005f006400770100000000ffffffff0000019000fffffffb000000180057006f0072006b00730070006100630065005f006400770100000000ffffffff0000005000fffffffb00000016004500780070006c006f007200650072005f006400770100000000ffffffff0000007400fffffffb0000001c00460069006e00640049006e00460069006c00650073005f006400770100000328000001c4000001ca00fffffffc0000019d0000010a000000a301000015fa000000000100000003fb000000140043006f006e0073006f006c0065005f006400770100000000ffffffff0000005900fffffffb0000002400450078007400650072006e0061006c0043006f006e0073006f006c0065005f006400770100000000ffffffff0000009100fffffffb0000001a0048006900730074006f00720079004c006f0067005f00640077010000026900000283000000d700ffffff000000000000026f00000004000000040000000800000008fc00000001000000020000000800000018006d00610069006e005f0074006f006f006c00620061007201000000000000003700000000000000000000001800660069006c0065005f0074006f006f006c0062006100720100000037000000750000000000000000000000200061006e0061006c0079007300690073005f0074006f006f006c00620061007201000000ac0000006d00000000000000000000001600720075006e005f0074006f006f006c0062006100720100000119000000390000000000000000000000180065006400690074005f0074006f006f006c00620061007201000001520000005800000000000000000000001800660069006e0064005f0074006f006f006c00620061007201000001aa0000008c00000000000000000000001400770073005f0074006f006f006c00620061007201000002360000006d00000000000000000000002a005200e90070006500720074006f0069007200650020006400650020007400720061007600610069006c01000002a3000002370000000000000000'
 
73
#STATE2 = '000000ff00000000fd0000000200000000000004ec0000035efc0200000006fc000000380000035e000001c100fffffffc0200000002fc00000038000001d1000000dd00fffffffc0100000002fb00000016004500780070006c006f007200650072005f0064007701000000000000011d0000007400fffffffc00000121000003cb000000db00fffffffa000000000100000002fb000000120045006400690074006f0072005f00640077010000000000000184000000db00fffffffb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000000ffffffff0000000000000000fc0000020d00000189000000e000fffffffc0100000002fc00000000000002b1000001ca00fffffffa000000020100000004fb0000001c00460069006e00640049006e00460069006c00650073005f006400770100000000ffffffff000001ca00fffffffb0000002400450078007400650072006e0061006c0043006f006e0073006f006c0065005f006400770100000000ffffffff0000009100fffffffb000000140043006f006e0073006f006c0065005f006400770100000000ffffffff0000005900fffffffb0000001a0048006900730074006f00720079004c006f0067005f006400770100000000ffffffff000000d700fffffffc000002b5000002370000019000fffffffa000000000200000005fb0000001a004f006e006c0069006e006500480065006c0070005f006400770100000000ffffffff0000004400fffffffb00000024004f0062006a0065006300740049006e00730070006500630074006f0072005f006400770100000000ffffffff0000008b00fffffffb000000180057006f0072006b00730070006100630065005f006400770100000000ffffffff0000005d00fffffffb0000001200500079006c0069006e0074005f006400770100000000ffffffff000000a700fffffffb000000180044006f0063005600690065007700650072005f00640077010000028d000001460000000000000000fc0000015b000000b80000000000fffffffa000000000200000002fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f00640077020000030a00000111000001d70000019dfb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000000ffffffff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff0000000000000000fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f006400770000000114000000ff000000000000000000000001fffffffc00000365fc0200000002fb00000026004d006100740070006c006f0074006c00690062004600690067007500720065005f0064007700000000380000039b0000000000000000fc000001e4000001ef0000000000fffffffa000000000100000001fb0000001c00530061006600650043006f006e0073006f006c0065005f006400770100000000ffffffff0000000000000000000000000000035e00000004000000040000000800000008fc00000001000000020000000800000018006d00610069006e005f0074006f006f006c00620061007201000000000000003700000000000000000000001800660069006c0065005f0074006f006f006c0062006100720100000037000000880000000000000000000000200061006e0061006c0079007300690073005f0074006f006f006c00620061007201000000bfffffffff00000000000000000000001600720075006e005f0074006f006f006c0062006100720100000128000000750000000000000000000000180065006400690074005f0074006f006f006c006200610072010000019d0000005600000000000000000000001800660069006e0064005f0074006f006f006c00620061007201000001f30000006d00000000000000000000001400770073005f0074006f006f006c00620061007201000002600000006d00000000000000000000002a005200e90070006500720074006f0069007200650020006400650020007400720061007600610069006c01000002cd0000024d0000000000000000'
61
74
 
62
75
try:
63
76
    from matplotlib import rcParams
71
84
            ('main',
72
85
             {
73
86
              'translation': True,
74
 
              'window/size': (1260, 700),
 
87
              'window/size': (1260, 740),
75
88
              'window/is_maximized': False,
76
89
              'window/is_fullscreen': False,
77
90
              'window/position': (10, 10),
78
 
              'window/state': STATE1,
 
91
#              'window/state': STATE1,
79
92
              'lightwindow/size': (650, 400),
80
93
              'lightwindow/position': (30, 30),
81
94
              'workaround/gnome_qscintilla': False,
114
127
              'calltips/font/italic': False,
115
128
              'calltips/font/bold': False,
116
129
              'calltips/size': 600,
117
 
              # This only applys to QTextEdit-based widgets:
 
130
              # This only applys to QPlainTextEdit-based widgets:
118
131
              'completion/font/family': MONOSPACE,
119
132
              'completion/font/size': SMALL,
120
133
              'completion/font/italic': False,
124
137
            ('shell',
125
138
             {
126
139
              'shortcut': "Ctrl+Shift+C",
 
140
              'max_line_count': 300,
127
141
              'working_dir_history': 30,
128
142
              'working_dir_adjusttocontents': False,
129
143
              'font/family': MONOSPACE,
132
146
              'font/bold': False,
133
147
              'wrap': True,
134
148
              'calltips': True,
135
 
              'autocompletion/enabled': True,
136
 
              'autocompletion/enter-key': True,
137
 
              'autocompletion/case-sensitivity': True,
138
 
              'autocompletion/select-single': True,
139
 
              'autocompletion/from-document': False,
 
149
              'codecompletion/auto': False,
 
150
              'codecompletion/enter-key': True,
 
151
              'codecompletion/case-sensitivity': True,
 
152
              'codecompletion/select-single': True,
 
153
              'codecompletion/from-document': False,
140
154
              'external_editor/path': 'SciTE',
141
155
              'external_editor/gotoline': '-goto:',
142
 
              'rollback_importer': False,
 
156
              'rollback_importer': True,
 
157
              'rollback_importer/blacklist': ['guidata', 'guiqwt'],
143
158
              }),
144
159
            ('external_shell',
145
160
             {
146
161
              'shortcut': "Ctrl+Shift+X",
 
162
              'max_line_count': 300,
147
163
              'font/family': MONOSPACE,
148
164
              'font/size': MEDIUM,
149
165
              'font/italic': False,
151
167
              'wrap': True,
152
168
              'single_tab': True,
153
169
              'calltips': True,
154
 
              'autocompletion/enabled': True,
155
 
              'autocompletion/enter-key': True,
156
 
              'autocompletion/case-sensitivity': True,
157
 
              'autocompletion/select-single': True,
158
 
              'autocompletion/from-document': False,
 
170
              'codecompletion/auto': False,
 
171
              'codecompletion/enter-key': True,
 
172
              'codecompletion/case-sensitivity': True,
 
173
              'codecompletion/select-single': True,
 
174
              'codecompletion/from-document': False,
159
175
              'filters': type2str(FILTERS),
160
176
              'itermax': ITERMAX,
161
177
              'excluded_names': EXCLUDED,
166
182
              'truncate': True,
167
183
              'minmax': True,
168
184
              'collvalue': False,
 
185
              'show_icontext': False,
169
186
              }),
170
187
            ('editor',
171
188
             {
185
202
              'toolbox_panel': True,
186
203
              'code_folding': True,
187
204
              'check_eol_chars': True,
188
 
              'show_eol_chars': False,
189
 
              'show_whitespace': False,
190
205
              'tab_always_indent': True,
 
206
              'fullpath_sorting': True,
191
207
              'api': osp.join(DATA_PATH, 'python.api'),
192
208
              'max_recent_files': 20,
 
209
              'currentline/backgroundcolor': "#EEFFDD",
 
210
              'foundline/backgroundcolor': "#DDFFDD",
193
211
              }),
194
212
            ('historylog',
195
213
             {
202
220
              'font/bold': False,
203
221
              'wrap': True,
204
222
              }),
205
 
            ('docviewer',
 
223
            ('inspector',
 
224
             {
 
225
              'shortcut': "Ctrl+Shift+I",
 
226
              'enable': True,
 
227
              'max_history_entries': 20,
 
228
              'font/family': MONOSPACE,
 
229
              'font/size': SMALL,
 
230
              'font/italic': False,
 
231
              'font/bold': False,
 
232
              'wrap': True,
 
233
              'automatic_import': True,
 
234
              }),
 
235
            ('onlinehelp',
206
236
             {
207
237
              'shortcut': "Ctrl+Shift+D",
208
238
              'enable': True,
 
239
              'zoom_factor': .8,
209
240
              'max_history_entries': 20,
210
 
              'font/family': MONOSPACE,
211
 
              'font/size': SMALL,
212
 
              'font/italic': False,
213
 
              'font/bold': False,
214
 
              'wrap': True,
215
 
              'automatic_import': True,
 
241
              }),
 
242
            ('project_explorer',
 
243
             {
 
244
              'shortcut': "Ctrl+Shift+P",
 
245
              'enable': True,
216
246
              }),
217
247
            ('workspace',
218
248
             {
219
 
              'shortcut': "Ctrl+Shift+W",
 
249
              'shortcut': "Ctrl+Shift+K",
220
250
              'enable': True,
221
251
              'autorefresh': True,
222
252
              'filters': type2str(FILTERS),
265
295
              }),
266
296
            ('explorer',
267
297
             {
268
 
              'shortcut': "Ctrl+Shift+F",
269
298
              'enable': True,
270
299
              'wrap': True,
271
300
              'name_filters': ['*.py', '*.pyw', '*.pth',
281
310
             {
282
311
              'enable': True,
283
312
              'supported_encodings': ["utf-8", "iso-8859-1", "cp1252"],
284
 
              'include': ['.', r'\.pyw?$|\.txt$|\.c$|\.cpp$|\.h$|\.f$|\.ini$'],
 
313
              'include': [r'\.pyw?$|\.txt$|\.c$|\.cpp$|\.h$|\.hpp$|\.f$|\.ini$', '.'],
285
314
              'include_regexp': True,
286
 
              'exclude': [r'\.pyc$|\.orig$|\.hg|\.svn'],
 
315
              'exclude': [r'\.pyc$|\.pyo$|\.orig$|\.hg|\.svn'],
287
316
              'exclude_regexp': True,
288
317
              'search_text_regexp': True,
289
318
              'search_text': [''],
290
319
              'search_text_samples': [r'# ?TODO|# ?FIXME|# ?XXX'],
 
320
              'in_python_path': False,
 
321
              'more_options': True,
291
322
              }),
292
323
            ('pylint',
293
324
             {
299
330
DEV = not __file__.startswith(sys.prefix)
300
331
DEV = False
301
332
CONF = UserConfig('spyder', defaults=DEFAULTS, load=(not DEV),
302
 
                  version='1.0.6', subfolder='.spyder')
 
333
                  version='1.1.0', subfolder='.spyder')
303
334
# Removing old .spyder.ini location:
304
335
old_location = osp.join(get_home_dir(), '.spyder.ini')
305
336
if osp.isfile(old_location):
395
426
    CONF.set(section, option+'/italic', int(font.italic()))
396
427
    CONF.set(section, option+'/bold', int(font.bold()))
397
428
    FONT_CACHE[(section, option)] = font
398
 
    
 
429