Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[6fe32e]: configuration.py Maximize Restore History

Download this file

configuration.py    204 lines (183 with data), 7.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#----------------------------- configuration.py ------------------------------
#----------------------- Settings for configuring PyPE -----------------------
collapse_style = 0
#CTRL-T swaps two lines. Setting the below to 1 disables this hotkey.
REM_SWAP = 1
import os
import sys
#from wxPython.wx import *
from wxPython.stc import wxSTC_EOL_CRLF, wxSTC_EOL_LF, wxSTC_EOL_CR
from parsers import *
fmt_mode = {"\r\n":wxSTC_EOL_CRLF,
"\n":wxSTC_EOL_LF,
"\r":wxSTC_EOL_CR}
fmt_Rmode = {}
for i,j in fmt_mode.items():
fmt_Rmode[j] = i
eol = os.linesep
eolmode = fmt_mode[eol]
def fp(path):
if sys.platform=='win32':
if ' ' in path:
return '"%s"'%path
return path
return path.replace(' ', '\\ ')
def fixpath(path):
return os.path.normpath(fp(path))
try:
sorted
except NameError:
def sorted(foo):
a = list(foo)
a.sort()
return a
se = fixpath(sys.executable)
spawnargs = [se]
if sys.executable[-8:].lower() == 'pype.exe':
runme = se
runpath = se
else:
runpath = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
b = fixpath(os.path.join(runpath, sys.argv[0]))
runme = "%s %s"%(se,b)
spawnargs.append(b)
runpath = __file__
#toss all the " marks in path names if necessary
runpath = ''.join(runpath.split('"'))
runpath = os.path.dirname(os.path.normpath(os.path.abspath(runpath)))
nosocket = os.path.exists(os.path.join(runpath, 'nosocket'))
stylefile = os.path.join(runpath, 'stc-styles.rc.cfg')
#for open/save dialogs
wildcard = "All python files (*.py *.pyw)|*.py;*.pyw|"\
"Pyrex files (*.pyi *.pyx)|*.pyi;*.pyx|"\
"C/C++ files (*.c* *.h)|*.c*;*.h|"\
"HTML/XML files (*.htm* *.shtm* *.xml)|*.htm*;*.shtm*;*.xml|"\
"Latex files (*.tex *.bib)|*.tex;*.bib|"\
"All Files (*.*)|*.*"
#for style mappings from extensions
extns = {'py' : 'python',
'pyw' : 'python',
'pyi' : 'pyrex',
'pyx' : 'pyrex',
'c' : 'cpp',
'cc' : 'cpp',
'cpp' : 'cpp',
'c++' : 'cpp',
'cxx' : 'cpp',
'h' : 'cpp',
'htm' : 'html',
'html' : 'html',
'shtm' : 'html',
'shtml' : 'html',
'xml' : 'xml',
'tex' : 'tex',
'bib' : 'tex',
'txt' : 'text'}
default_homedir = os.path.dirname(os.path.abspath(__file__))
if hasattr(sys, 'frozen'):
default_homedir = os.path.split(default_homedir)[0]
try:
#all user-based OSes
thd = os.path.expanduser("~")
if thd == "~": raise
homedir = os.path.join(thd, ".pype")
except:
try:
#*nix fallback
homedir = os.path.join(os.environ['HOME'], ".pype")
except:
try:
#windows NT,2k,XP,etc. fallback
homedir = os.path.join(os.environ['USERPROFILE'], ".pype")
except:
#What os are people using?
homedir = os.path.join(default_homedir, ".pype")
try:
# create the config directory if it
# doesn't already exist
def expandfull(var, rem=3):
if not rem:
return os.path.expandvars(var)
a = os.path.expandvars(var)
b = []
d = [b.extend(i.split('\\')) for i in a.split('/')]
c = []
for i in b:
if '%' in i:
c.append(expandfull(i, rem-1))
else:
c.append(i)
return '\\'.join(c)
if eol == "\r\n" and '%' in homedir:
homedir = expandfull(homedir)
if not os.path.exists(homedir):
os.mkdir(homedir)
except:
#print "unable to create config directory", homedir
homedir = default_homedir
for fil in os.listdir(homedir):
if fil.find('.tmp.') > -1:
try: os.remove(os.path.join(homedir, fil))
except: pass
def validate(value, orig):
try:
a = int(value)
except:
a = 0
if a < 1:
return orig
return a
def getData():
import zlib
a = zlib.decompress(
'x\xda\x01\xf4\x04\x0b\xfb\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \
\x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\x00\x00\x00\x04sBIT\x08\x08\x08\x08\
|\x08d\x88\x00\x00\x04\xabIDATx\x9c\xb5\x97\xcdk\x1bG\x18\xc6\x7f\x93f\x9d \
\xc5\xd2\xacI\x94\x14Y\x91\xe3B\x1a\xb0\x14(-!\x10\xd5\xd4\xa4\x1fid\x8a/=\
\xd4\xb9\xf4Tj\x9f\n=\xd4\xfe\x0b\xd2K\xae=\xe4n\xe5TP\x8b\x95@\xd3\x90b\xcb\
\xd4\x18\xd2\x84:\x854\x07G\xb6%bKP\xad\x94nh\xbd\x84\xe9a\xbd\xab]}Y\xf9\
\xe8\x03\x02\xed\xec\xec<\xcf\xfb\xcc;\xef\xcc\x08)%\x9d\x106\x0cU\x03\xc2@M\
J\xd1\xb1\xe3K`\x7f7\xf2\x82R\xee\xf3\x90\x10\xea\xff\x10\xd1V@39@A)\x86\x84\
\xf05>\xaf \xcb\n\xa9Xt\x9c\xc8\x91\x14\xba~\x1a\xd3\\o\x15\x106\x0c\x97D\
\x17\xf6\xf8\xd5]15\xcf\x7f\xe8\xdd\x15\xcb\n\xa9\xe4\xc8,\xc3C\x93\x9e\xb6:\
Ec\xb5!\xc0%\xceBm\x02\x1f\xb1#\xa6\xda\xc1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