]>
Commit | Line | Data |
---|---|---|
1f780e48 RD |
1 | #---------------------------------------------------------------------------- |
2 | # Name: PHPEditor.py | |
3 | # Purpose: PHP Script Editor for pydocview tbat uses the Styled Text Control | |
4 | # | |
5 | # Author: Morgan Hua | |
6 | # | |
7 | # Created: 1/4/04 | |
8 | # CVS-ID: $Id$ | |
9 | # Copyright: (c) 2005 ActiveGrid, Inc. | |
10 | # License: wxWindows License | |
11 | #---------------------------------------------------------------------------- | |
12 | ||
13 | import wx | |
14 | import string | |
15 | import STCTextEditor | |
16 | import CodeEditor | |
17 | import OutlineService | |
18 | import os | |
19 | import re | |
aca310e5 RD |
20 | import FindInDirService |
21 | import activegrid.util.appdirs as appdirs | |
22 | import activegrid.util.sysutils as sysutils | |
23 | _ = wx.GetTranslation | |
1f780e48 RD |
24 | |
25 | ||
26 | class PHPDocument(CodeEditor.CodeDocument): | |
27 | ||
28 | pass | |
29 | ||
30 | ||
31 | class PHPView(CodeEditor.CodeView): | |
32 | ||
33 | ||
34 | def GetCtrlClass(self): | |
35 | """ Used in split window to instantiate new instances """ | |
36 | return PHPCtrl | |
37 | ||
38 | ||
39 | def GetAutoCompleteHint(self): | |
40 | pos = self.GetCtrl().GetCurrentPos() | |
41 | if pos == 0: | |
42 | return None, None | |
43 | ||
44 | validLetters = string.letters + string.digits + '_$' | |
45 | word = '' | |
46 | while (True): | |
47 | pos = pos - 1 | |
48 | if pos < 0: | |
49 | break | |
50 | char = chr(self.GetCtrl().GetCharAt(pos)) | |
51 | if char not in validLetters: | |
52 | break | |
53 | word = char + word | |
54 | ||
55 | return None, word | |
56 | ||
57 | ||
58 | def GetAutoCompleteDefaultKeywords(self): | |
59 | return PHPKEYWORDS | |
60 | ||
61 | #---------------------------------------------------------------------------- | |
62 | # Methods for OutlineService | |
63 | #---------------------------------------------------------------------------- | |
64 | ||
65 | def DoLoadOutlineCallback(self, force=False): | |
66 | outlineService = wx.GetApp().GetService(OutlineService.OutlineService) | |
67 | if not outlineService: | |
68 | return False | |
69 | ||
70 | outlineView = outlineService.GetView() | |
71 | if not outlineView: | |
72 | return False | |
73 | ||
74 | treeCtrl = outlineView.GetTreeCtrl() | |
75 | if not treeCtrl: | |
76 | return False | |
77 | ||
78 | view = treeCtrl.GetCallbackView() | |
79 | newCheckSum = self.GenCheckSum() | |
80 | if not force: | |
81 | if view and view is self: | |
82 | if self._checkSum == newCheckSum: | |
83 | return False | |
84 | self._checkSum = newCheckSum | |
85 | ||
86 | treeCtrl.DeleteAllItems() | |
87 | ||
88 | document = self.GetDocument() | |
89 | if not document: | |
90 | return True | |
91 | ||
92 | filename = document.GetFilename() | |
93 | if filename: | |
94 | rootItem = treeCtrl.AddRoot(os.path.basename(filename)) | |
95 | treeCtrl.SetDoSelectCallback(rootItem, self, None) | |
96 | else: | |
97 | return True | |
98 | ||
99 | text = self.GetValue() | |
100 | if not text: | |
101 | return True | |
102 | ||
103 | INTERFACE_PATTERN = 'interface[ \t]+\w+' | |
104 | CLASS_PATTERN = '((final|abstract)[ \t]+)?((public|private|protected)[ \t]+)?(static[ \t]+)?class[ \t]+\w+((implements|extends)\w+)?' | |
105 | FUNCTION_PATTERN = '(abstract[ \t]+)?((public|private|protected)[ \t]+)?(static[ \t]+)?function[ \t]+?\w+\(.*?\)' | |
106 | interfacePat = re.compile(INTERFACE_PATTERN, re.M|re.S) | |
107 | classPat = re.compile(CLASS_PATTERN, re.M|re.S) | |
108 | funcPat= re.compile(FUNCTION_PATTERN, re.M|re.S) | |
109 | pattern = re.compile('^[ \t]*('+ CLASS_PATTERN + '.*?{|' + FUNCTION_PATTERN + '|' + INTERFACE_PATTERN +'\s*?{).*?$', re.M|re.S) | |
110 | ||
111 | iter = pattern.finditer(text) | |
112 | indentStack = [(0, rootItem)] | |
113 | for pattern in iter: | |
114 | line = pattern.string[pattern.start(0):pattern.end(0)] | |
115 | foundLine = classPat.search(line) | |
116 | if foundLine: | |
117 | indent = foundLine.start(0) | |
118 | itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)] | |
119 | else: | |
120 | foundLine = funcPat.search(line) | |
121 | if foundLine: | |
122 | indent = foundLine.start(0) | |
123 | itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)] | |
124 | else: | |
125 | foundLine = interfacePat.search(line) | |
126 | if foundLine: | |
127 | indent = foundLine.start(0) | |
128 | itemStr = foundLine.string[foundLine.start(0):foundLine.end(0)] | |
129 | ||
130 | if indent == 0: | |
131 | parentItem = rootItem | |
132 | else: | |
133 | lastItem = indentStack.pop() | |
134 | while lastItem[0] >= indent: | |
135 | lastItem = indentStack.pop() | |
136 | indentStack.append(lastItem) | |
137 | parentItem = lastItem[1] | |
138 | ||
139 | item = treeCtrl.AppendItem(parentItem, itemStr) | |
140 | treeCtrl.SetDoSelectCallback(item, self, (pattern.end(0), pattern.start(0) + indent)) # select in reverse order because we want the cursor to be at the start of the line so it wouldn't scroll to the right | |
141 | indentStack.append((indent, item)) | |
142 | ||
143 | treeCtrl.Expand(rootItem) | |
144 | ||
145 | return True | |
146 | ||
147 | ||
148 | class PHPService(CodeEditor.CodeService): | |
149 | ||
150 | ||
151 | def __init__(self): | |
152 | CodeEditor.CodeService.__init__(self) | |
153 | ||
154 | ||
155 | class PHPCtrl(CodeEditor.CodeCtrl): | |
156 | ||
157 | ||
26ee3a06 RD |
158 | def __init__(self, parent, id=-1, style=wx.NO_FULL_REPAINT_ON_RESIZE): |
159 | CodeEditor.CodeCtrl.__init__(self, parent, id, style) | |
aca310e5 | 160 | self.SetLexer(wx.stc.STC_LEX_HTML) |
1f780e48 RD |
161 | self.SetStyleBits(7) |
162 | self.SetKeyWords(4, string.join(PHPKEYWORDS)) | |
163 | self.SetProperty("fold.html", "1") | |
164 | ||
165 | ||
aca310e5 RD |
166 | def CreatePopupMenu(self): |
167 | FINDCLASS_ID = wx.NewId() | |
168 | FINDDEF_ID = wx.NewId() | |
169 | ||
170 | menu = CodeEditor.CodeCtrl.CreatePopupMenu(self) | |
171 | ||
172 | self.Bind(wx.EVT_MENU, self.OnPopFindDefinition, id=FINDDEF_ID) | |
173 | menu.Insert(1, FINDDEF_ID, _("Find 'function'")) | |
174 | ||
175 | self.Bind(wx.EVT_MENU, self.OnPopFindClass, id=FINDCLASS_ID) | |
176 | menu.Insert(2, FINDCLASS_ID, _("Find 'class'")) | |
177 | ||
178 | return menu | |
179 | ||
180 | ||
181 | def OnPopFindDefinition(self, event): | |
182 | view = wx.GetApp().GetDocumentManager().GetCurrentView() | |
183 | if hasattr(view, "GetCtrl") and view.GetCtrl() and hasattr(view.GetCtrl(), "GetSelectedText"): | |
184 | pattern = view.GetCtrl().GetSelectedText().strip() | |
185 | if pattern: | |
186 | searchPattern = "function\s+%s" % pattern | |
187 | wx.GetApp().GetService(FindInDirService.FindInDirService).FindInProject(searchPattern) | |
188 | ||
189 | ||
190 | def OnPopFindClass(self, event): | |
191 | view = wx.GetApp().GetDocumentManager().GetCurrentView() | |
192 | if hasattr(view, "GetCtrl") and view.GetCtrl() and hasattr(view.GetCtrl(), "GetSelectedText"): | |
193 | definition = "class\s+%s" | |
194 | pattern = view.GetCtrl().GetSelectedText().strip() | |
195 | if pattern: | |
196 | searchPattern = definition % pattern | |
197 | wx.GetApp().GetService(FindInDirService.FindInDirService).FindInProject(searchPattern) | |
198 | ||
199 | ||
1f780e48 RD |
200 | def CanWordWrap(self): |
201 | return True | |
202 | ||
203 | ||
204 | def SetViewDefaults(self): | |
aca310e5 | 205 | CodeEditor.CodeCtrl.SetViewDefaults(self, configPrefix = "PHP", hasWordWrap = True, hasTabs = True, hasFolding=True) |
1f780e48 RD |
206 | |
207 | ||
208 | def GetFontAndColorFromConfig(self): | |
209 | return CodeEditor.CodeCtrl.GetFontAndColorFromConfig(self, configPrefix = "PHP") | |
210 | ||
211 | ||
212 | def UpdateStyles(self): | |
213 | CodeEditor.CodeCtrl.UpdateStyles(self) | |
214 | ||
215 | if not self.GetFont(): | |
216 | return | |
217 | ||
218 | faces = { 'font' : self.GetFont().GetFaceName(), | |
219 | 'size' : self.GetFont().GetPointSize(), | |
220 | 'size2': self.GetFont().GetPointSize() - 2, | |
221 | 'color' : "%02x%02x%02x" % (self.GetFontColor().Red(), self.GetFontColor().Green(), self.GetFontColor().Blue()) | |
222 | } | |
223 | ||
224 | ||
225 | # HTML Styles | |
226 | # White space | |
227 | self.StyleSetSpec(wx.stc.STC_H_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces) | |
228 | # Comment | |
229 | self.StyleSetSpec(wx.stc.STC_H_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces) | |
230 | # Number | |
231 | self.StyleSetSpec(wx.stc.STC_H_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces) | |
232 | # String | |
233 | self.StyleSetSpec(wx.stc.STC_H_SINGLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces) | |
234 | self.StyleSetSpec(wx.stc.STC_H_DOUBLESTRING, "face:%(font)s,fore:#7F007F,face:%(font)s,size:%(size)d" % faces) | |
235 | # Tag | |
236 | self.StyleSetSpec(wx.stc.STC_H_TAG, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces) | |
237 | # Attributes | |
238 | self.StyleSetSpec(wx.stc.STC_H_ATTRIBUTE, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces) | |
239 | ||
240 | ||
241 | # PHP Styles | |
242 | self.StyleSetSpec(wx.stc.STC_HPHP_DEFAULT, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces) | |
243 | self.StyleSetSpec(wx.stc.STC_HPHP_COMMENT, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces) | |
244 | self.StyleSetSpec(wx.stc.STC_HPHP_COMMENTLINE, "face:%(font)s,fore:#007F00,italic,face:%(font)s,size:%(size)d" % faces) | |
245 | self.StyleSetSpec(wx.stc.STC_HPHP_NUMBER, "face:%(font)s,fore:#007F7F,size:%(size)d" % faces) | |
246 | self.StyleSetSpec(wx.stc.STC_HPHP_SIMPLESTRING, "face:%(font)s,fore:#7F007F,size:%(size)d" % faces) | |
247 | self.StyleSetSpec(wx.stc.STC_HPHP_HSTRING, "face:%(font)s,fore7F007F,face:%(font)s,size:%(size)d" % faces) | |
248 | self.StyleSetSpec(wx.stc.STC_HPHP_HSTRING_VARIABLE, "face:%(font)s,fore:#007F7F,italic,bold,face:%(font)s,size:%(size)d" % faces) | |
249 | self.StyleSetSpec(wx.stc.STC_HPHP_VARIABLE, "face:%(font)s,fore:#000000,face:%(font)s,size:%(size)d" % faces) | |
250 | self.StyleSetSpec(wx.stc.STC_HPHP_OPERATOR, "face:%(font)s,size:%(size)d" % faces) | |
251 | self.StyleSetSpec(wx.stc.STC_HPHP_WORD, "face:%(font)s,fore:#00007F,bold,size:%(size)d" % faces) # keyword | |
252 | ||
253 | ||
254 | class PHPOptionsPanel(STCTextEditor.TextOptionsPanel): | |
255 | ||
256 | def __init__(self, parent, id): | |
aca310e5 RD |
257 | wx.Panel.__init__(self, parent, id) |
258 | mainSizer = wx.BoxSizer(wx.VERTICAL) | |
259 | ||
260 | config = wx.ConfigBase_Get() | |
261 | ||
262 | pathLabel = wx.StaticText(self, -1, _("PHP Executable Path:")) | |
263 | path = config.Read("ActiveGridPHPLocation") | |
264 | self._pathTextCtrl = wx.TextCtrl(self, -1, path, size = (150, -1)) | |
265 | self._pathTextCtrl.SetToolTipString(self._pathTextCtrl.GetValue()) | |
266 | self._pathTextCtrl.SetInsertionPointEnd() | |
267 | choosePathButton = wx.Button(self, -1, _("Browse...")) | |
268 | pathSizer = wx.BoxSizer(wx.HORIZONTAL) | |
269 | HALF_SPACE = 5 | |
270 | SPACE = 10 | |
271 | pathSizer.Add(pathLabel, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.TOP, HALF_SPACE) | |
272 | pathSizer.Add(self._pathTextCtrl, 1, wx.EXPAND|wx.LEFT|wx.TOP, HALF_SPACE) | |
273 | pathSizer.Add(choosePathButton, 0, wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT|wx.TOP, HALF_SPACE) | |
274 | wx.EVT_BUTTON(self, choosePathButton.GetId(), self.OnChoosePath) | |
275 | mainSizer.Add(pathSizer, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, SPACE) | |
276 | ||
277 | iniLabel = wx.StaticText(self, -1, _("php.ini Path:")) | |
278 | ini = config.Read("ActiveGridPHPINILocation") | |
279 | if not ini: | |
280 | if sysutils.isRelease(): | |
281 | ini = os.path.normpath(os.path.join(appdirs.getSystemDir(), "php.ini")) | |
282 | else: | |
283 | tmp = self._pathTextCtrl.GetValue().strip() | |
284 | if tmp and len(tmp) > 0: | |
285 | ini = os.path.normpath(os.path.join(os.path.dirname(tmp), "php.ini")) | |
286 | ||
287 | self._iniTextCtrl = wx.TextCtrl(self, -1, ini, size = (150, -1)) | |
288 | self._iniTextCtrl.SetToolTipString(self._iniTextCtrl.GetValue()) | |
289 | self._iniTextCtrl.SetInsertionPointEnd() | |
290 | chooseIniButton = wx.Button(self, -1, _("Browse...")) | |
291 | iniSizer = wx.BoxSizer(wx.HORIZONTAL) | |
292 | HALF_SPACE = 5 | |
293 | SPACE = 10 | |
294 | iniSizer.Add(iniLabel, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.TOP, HALF_SPACE) | |
295 | iniSizer.Add(self._iniTextCtrl, 1, wx.EXPAND|wx.LEFT|wx.TOP, HALF_SPACE) | |
296 | iniSizer.Add(chooseIniButton, 0, wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT|wx.TOP, HALF_SPACE) | |
297 | wx.EVT_BUTTON(self, chooseIniButton.GetId(), self.OnChooseIni) | |
298 | mainSizer.Add(iniSizer, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, SPACE) | |
299 | ||
300 | self._otherOptions = STCTextEditor.TextOptionsPanel(self, -1, configPrefix = "PHP", label = "PHP", hasWordWrap = True, hasTabs = True, addPage=False, hasFolding=False) | |
301 | #STCTextEditor.TextOptionsPanel.__init__(self, parent, id, configPrefix = "PHP", label = "PHP", hasWordWrap = True, hasTabs = True) | |
302 | mainSizer.Add(self._otherOptions, 0, wx.EXPAND|wx.BOTTOM, SPACE) | |
303 | ||
304 | self.SetSizer(mainSizer) | |
305 | parent.AddPage(self, _("PHP")) | |
306 | ||
307 | def OnChoosePath(self, event): | |
308 | defaultDir = os.path.dirname(self._pathTextCtrl.GetValue().strip()) | |
309 | defaultFile = os.path.basename(self._pathTextCtrl.GetValue().strip()) | |
310 | if wx.Platform == '__WXMSW__': | |
311 | wildcard = _("Executable (*.exe)|*.exe|All|*.*") | |
312 | if not defaultFile: | |
313 | defaultFile = "php-cgi.exe" | |
314 | else: | |
315 | wildcard = _("*") | |
316 | dlg = wx.FileDialog(wx.GetApp().GetTopWindow(), | |
317 | _("Select a File"), | |
318 | defaultDir=defaultDir, | |
319 | defaultFile=defaultFile, | |
320 | wildcard=wildcard, | |
321 | style=wx.OPEN|wx.FILE_MUST_EXIST|wx.HIDE_READONLY) | |
322 | # dlg.CenterOnParent() # wxBug: caused crash with wx.FileDialog | |
323 | if dlg.ShowModal() == wx.ID_OK: | |
324 | path = dlg.GetPath() | |
325 | if path: | |
326 | self._pathTextCtrl.SetValue(path) | |
327 | self._pathTextCtrl.SetToolTipString(self._pathTextCtrl.GetValue()) | |
328 | self._pathTextCtrl.SetInsertionPointEnd() | |
329 | dlg.Destroy() | |
330 | ||
331 | def OnChooseIni(self, event): | |
332 | defaultDir = os.path.dirname(self._iniTextCtrl.GetValue().strip()) | |
333 | defaultFile = os.path.basename(self._iniTextCtrl.GetValue().strip()) | |
334 | if wx.Platform == '__WXMSW__': | |
335 | wildcard = _("Ini (*.ini)|*.ini|All|*.*") | |
336 | if not defaultFile: | |
337 | defaultFile = "php.ini" | |
338 | else: | |
339 | wildcard = _("*") | |
340 | dlg = wx.FileDialog(wx.GetApp().GetTopWindow(), | |
341 | _("Select a File"), | |
342 | defaultDir=defaultDir, | |
343 | defaultFile=defaultFile, | |
344 | wildcard=wildcard, | |
345 | style=wx.OPEN|wx.FILE_MUST_EXIST|wx.HIDE_READONLY) | |
346 | # dlg.CenterOnParent() # wxBug: caused crash with wx.FileDialog | |
347 | if dlg.ShowModal() == wx.ID_OK: | |
348 | ini = dlg.GetPath() | |
349 | if ini: | |
350 | self._iniTextCtrl.SetValue(ini) | |
351 | self._iniTextCtrl.SetToolTipString(self._iniTextCtrl.GetValue()) | |
352 | self._iniTextCtrl.SetInsertionPointEnd() | |
353 | dlg.Destroy() | |
354 | ||
355 | def OnOK(self, optionsDialog): | |
356 | config = wx.ConfigBase_Get() | |
357 | config.Write("ActiveGridPHPLocation", self._pathTextCtrl.GetValue().strip()) | |
358 | config.Write("ActiveGridPHPINILocation", self._iniTextCtrl.GetValue().strip()) | |
359 | ||
360 | self._otherOptions.OnOK(optionsDialog) | |
1f780e48 | 361 | |
02b800ce RD |
362 | def GetIcon(self): |
363 | return getPHPIcon() | |
364 | ||
365 | ||
1f780e48 RD |
366 | PHPKEYWORDS = [ |
367 | "and", "or", "xor", "__FILE__", "exception", "__LINE__", "array", "as", "break", "case", | |
368 | "class", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif", | |
369 | "empty", "enddeclare", "endfor", "endforeach", "endif", "endswith", "endwhile", "eval", | |
370 | "exit", "extends", "for", "foreach", "function", "global", "if", "include", "include_once", | |
371 | "isset", "list", "new", "print", "require", "require_once", "return", "static", "switch", | |
372 | "unset", "use", "var", "while", "__FUNCTION__", "__CLASS__", "__METHOD__", "final", "php_user_filter", | |
373 | "interface", "implements", "extends", "public", "private", "protected", "abstract", "clone", "try", "catch", | |
374 | "throw", "cfunction", "old_function", | |
375 | "$_SERVER", "$_ENV", "$_COOKIE", "$_GET", "$_POST", "$_FILES", "$_REQUEST", "$_SESSION", "$GLOBALS", "$php_errormsg", | |
376 | "PHP_VERSION", "PHP_OS", "PHP_EOL", "DEFAULT_INCLUDE_PATH", "PEAR_INSTALL_DIR", "PEAR_EXTENSION_DIR", | |
377 | "PHP_EXTENSION_DIR", "PHP_BINDIR", "PHP_LIBDIR", "PHP_DATADIR", "PHP_SYSCONFDIR", "PHP_LOCALSTATEDIR", | |
378 | "PHP_CONFIG_FILE_PATH", "PHP_OUTPUT_HANDLER_START", "PHP_OUTPUT_HANDLER_CONT", "PHP_OUTPUT_HANDLER_END", | |
379 | "E_ERROR", "E_WARNING", "E_PARSE", "E_NOTICE", "E_CORE_ERROR", "E_CORE_WARNING", "E_COMPILE_ERROR", | |
380 | "E_COMPILE_WARNING", "E_USER_ERROR", "E_USER_WARNING", "E_USER_NOTICE", "E_ALL", "E_STRICT", | |
381 | "TRUE", "FALSE", "NULL", "ZEND_THREAD_SAFE", | |
382 | "EXTR_OVERWRITE", "EXTR_SKIP", "EXTR_PREFIX_SAME", "EXTR_PREFIX_ALL", "EXTR_PREFIX_INVALID", | |
383 | "EXTR_PREFIX_IF_EXISTS", "EXTR_IF_EXISTS", "SORT_ASC", "SORT_DESC", "SORT_REGULAR", "SORT_NUMERIC", | |
384 | "SORT_STRING", "CASE_LOWER", "CASE_UPPER", "COUNT_NORMAL", "COUNT_RECURSIVE", "ASSERT_ACTIVE", | |
385 | "ASSERT_CALLBACK", "ASSERT_BAIL", "ASSERT_WARNING", "ASSERT_QUIET_EVAL", "CONNECTION_ABORTED", | |
386 | "CONNECTION_NORMAL", "CONNECTION_TIMEOUT", "INI_USER", "INI_PERDIR", "INI_SYSTEM", "INI_ALL", | |
387 | "M_E", "M_LOG2E", "M_LOG10E", "M_LN2", "M_LN10", "M_PI", "M_PI_2", "M_PI_4", "M_1_PI", "M_2_PI", | |
388 | "M_2_SQRTPI", "M_SQRT2", "M_SQRT1_2", "CRYPT_SALT_LENGTH", "CRYPT_STD_DES", "CRYPT_EXT_DES", "CRYPT_MD5", | |
389 | "CRYPT_BLOWFISH", "DIRECTORY_SEPARATOR", "SEEK_SET", "SEEK_CUR", "SEEK_END", "LOCK_SH", "LOCK_EX", "LOCK_UN", | |
390 | "LOCK_NB", "HTML_SPECIALCHARS", "HTML_ENTITIES", "ENT_COMPAT", "ENT_QUOTES", "ENT_NOQUOTES", "INFO_GENERAL", | |
391 | "INFO_CREDITS", "INFO_CONFIGURATION", "INFO_MODULES", "INFO_ENVIRONMENT", "INFO_VARIABLES", "INFO_LICENSE", | |
392 | "INFO_ALL", "CREDITS_GROUP", "CREDITS_GENERAL", "CREDITS_SAPI", "CREDITS_MODULES", "CREDITS_DOCS", | |
393 | "CREDITS_FULLPAGE", "CREDITS_QA", "CREDITS_ALL", "STR_PAD_LEFT", "STR_PAD_RIGHT", "STR_PAD_BOTH", | |
394 | "PATHINFO_DIRNAME", "PATHINFO_BASENAME", "PATHINFO_EXTENSION", "PATH_SEPARATOR", "CHAR_MAX", "LC_CTYPE", | |
395 | "LC_NUMERIC", "LC_TIME", "LC_COLLATE", "LC_MONETARY", "LC_ALL", "LC_MESSAGES", "ABDAY_1", "ABDAY_2", | |
396 | "ABDAY_3", "ABDAY_4", "ABDAY_5", "ABDAY_6", "ABDAY_7", "DAY_1", "DAY_2", "DAY_3", "DAY_4", "DAY_5", | |
397 | "DAY_6", "DAY_7", "ABMON_1", "ABMON_2", "ABMON_3", "ABMON_4", "ABMON_5", "ABMON_6", "ABMON_7", "ABMON_8", | |
398 | "ABMON_9", "ABMON_10", "ABMON_11", "ABMON_12", "MON_1", "MON_2", "MON_3", "MON_4", "MON_5", "MON_6", "MON_7", | |
399 | "MON_8", "MON_9", "MON_10", "MON_11", "MON_12", "AM_STR", "PM_STR", "D_T_FMT", "D_FMT", "T_FMT", "T_FMT_AMPM", | |
400 | "ERA", "ERA_YEAR", "ERA_D_T_FMT", "ERA_D_FMT", "ERA_T_FMT", "ALT_DIGITS", "INT_CURR_SYMBOL", "CURRENCY_SYMBOL", | |
401 | "CRNCYSTR", "MON_DECIMAL_POINT", "MON_THOUSANDS_SEP", "MON_GROUPING", "POSITIVE_SIGN", "NEGATIVE_SIGN", | |
402 | "INT_FRAC_DIGITS", "FRAC_DIGITS", "P_CS_PRECEDES", "P_SEP_BY_SPACE", "N_CS_PRECEDES", "N_SEP_BY_SPACE", | |
403 | "P_SIGN_POSN", "N_SIGN_POSN", "DECIMAL_POINT", "RADIXCHAR", "THOUSANDS_SEP", "THOUSEP", "GROUPING", | |
404 | "YESEXPR", "NOEXPR", "YESSTR", "NOSTR", "CODESET", "LOG_EMERG", "LOG_ALERT", "LOG_CRIT", "LOG_ERR", | |
405 | "LOG_WARNING", "LOG_NOTICE", "LOG_INFO", "LOG_DEBUG", "LOG_KERN", "LOG_USER", "LOG_MAIL", "LOG_DAEMON", | |
406 | "LOG_AUTH", "LOG_SYSLOG", "LOG_LPR", "LOG_NEWS", "LOG_UUCP", "LOG_CRON", "LOG_AUTHPRIV", "LOG_LOCAL0", | |
407 | "LOG_LOCAL1", "LOG_LOCAL2", "LOG_LOCAL3", "LOG_LOCAL4", "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7", | |
408 | "LOG_PID", "LOG_CONS", "LOG_ODELAY", "LOG_NDELAY", "LOG_NOWAIT", "LOG_PERROR" | |
409 | ] | |
410 | ||
411 | ||
412 | #---------------------------------------------------------------------------- | |
413 | # Icon Bitmaps - generated by encode_bitmaps.py | |
414 | #---------------------------------------------------------------------------- | |
415 | from wx import ImageFromStream, BitmapFromImage | |
1f780e48 RD |
416 | import cStringIO |
417 | ||
418 | ||
419 | def getPHPData(): | |
420 | return \ | |
02b800ce | 421 | "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ |
1f780e48 | 422 | \x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\ |
02b800ce RD |
423 | \x00\x01GIDAT8\x8d\x8d\x931O\xc2@\x14\xc7\x7fW\xfa\x11\x1c\xe430\xb88\x18'\ |
424 | \x8c\x89\x0e\x0c\xc4\xd9\xdd\x85\xc9\xc5`\x82\x1b\t\x84\x98\x98\xe0\xa4_\x01\ | |
425 | cd`t$\xb8h\xd0\xb8\xabD0\xd4\xd0\xb4%H $\xe7P\x0e{@\xa9\xff\xe4\r\xf7\xee~\ | |
426 | \xff\xf7\xee^+\x1a\xcd\x8ed*\xab\xef\x02\xd0\xea\xda\x00\xb8\xce\x90\xb3\xa3\ | |
427 | }\xc1*5\x9a\x1d\xf9\xf6#g\xf1\xea\xf9qyS\x97\xf5o)\x8f\xcfo\xa50b\x84\x85\ | |
428 | \xb1\xca\xdc\x9b\xc0\xde\xe1\x01'\xa7U\x19v\xc6\xb4\xfa.\xeb\xc4\x01\x18L\ | |
429 | \xfc\xa4;\xf2\xdb\x7f\xac\xdd\xd3s<\xda\x03+\xb4\x88\x19\x04\x15\x0c\xb0\x93\ | |
430 | \xde\xc5\x9b\x80=\x86\xf6\xc5U\xa8\x81v\x05\x05\xab\xf6\xedq(\xf7\xd7A\xabk\ | |
431 | \xb36\xd2\x93A\xd8\x1aF\x18\xcc\x83\xb0\x08\x7f\xbc\xb7\xc2\r\\g8\x03\x97\ | |
432 | \xc1Q2{\x8e\xa7\x81/\xd7\xb5\x85C\xc9\xc46\xc9\x84>\xcaR!-`\xfa\x88\xab\xe0b\ | |
433 | >\xb5\xb4\xb2\xfa6\xcc\xf6\xa7\xc5f\x00V\xc0\xc3\xf3\x17w\x95\xa7YN\xad\x83\ | |
434 | \xfbP\x95\x06@un\xce\xd9\\\x8d\xad\x8d\xf8\xbf\xd6F\xa5\x9c\x11\x95rF\xfbaT\ | |
435 | \xc50\x15\xf3)\xb29\xbfc!\x8c\x98v\xaf\xe0f\x14\\*\xa4\x85f\x10|\x9c(\xa9)\ | |
436 | \xfc\x02?r\xb8\xfc~J.\xd0\x00\x00\x00\x00IEND\xaeB`\x82" | |
1f780e48 RD |
437 | |
438 | def getPHPBitmap(): | |
439 | return BitmapFromImage(getPHPImage()) | |
440 | ||
441 | def getPHPImage(): | |
442 | stream = cStringIO.StringIO(getPHPData()) | |
443 | return ImageFromStream(stream) | |
444 | ||
445 | def getPHPIcon(): | |
bbf7159c | 446 | return wx.IconFromBitmap(getPHPBitmap()) |