19 from __future__
import absolute_import
39 ## This version of the editor has been set up to edit Python source
40 ## code. Here is a copy of wxPython/Code/Main.py to play with.
48 if wx.Platform ==
'__WXMSW__':
49 faces = {
'times':
'Times New Roman',
50 'mono':
'Courier New',
52 'other':
'Comic Sans MS',
56 elif wx.Platform ==
'__WXMAC__':
57 faces = {
'times':
'Times New Roman',
60 'other':
'Comic Sans MS',
65 faces = {
'times':
'Times',
68 'other':
'new century schoolbook',
76 wildcard =
"All files (*.*)|*.*|" \
77 "JASON file (*.json)|*.json|" \
78 "Python source (*.py)|*.py|" \
79 "Robot Framework (*.robot)|*.robot|" \
80 "Robot Framework (*.txt)|*.txt|" \
81 "YAML file (*.yaml)|*.yaml"
90 pos=wx.DefaultPosition, size=wx.DefaultSize,
92 stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style)
94 self.CmdKeyAssign(ord(
'B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
95 self.CmdKeyAssign(ord(
'N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
97 self.SetLexer(stc.STC_LEX_PYTHON)
98 self.SetKeyWords(0,
" ".join(keyword.kwlist))
100 self.SetProperty(
"fold",
"1")
101 self.SetProperty(
"tab.timmy.whinge.level",
"1")
104 self.SetViewWhiteSpace(
False)
110 self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
111 self.SetEdgeColumn(78)
115 self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
116 self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
117 self.SetMarginSensitive(2,
True)
118 self.SetMarginWidth(2, 12)
122 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_ARROWDOWN,
"black",
"black")
123 self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_ARROW,
"black",
"black")
124 self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY,
"black",
"black")
125 self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY,
"black",
"black")
126 self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY,
"white",
"black")
127 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,
"white",
"black")
128 self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,
"white",
"black")
132 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS,
"white",
"black")
133 self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS,
"white",
"black")
134 self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY,
"white",
"black")
135 self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY,
"white",
"black")
136 self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY,
"white",
"black")
137 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,
"white",
"black")
138 self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,
"white",
"black")
142 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS,
"white",
"#404040")
143 self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS,
"white",
"#404040")
144 self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE,
"white",
"#404040")
145 self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE,
"white",
"#404040")
146 self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED,
"white",
"#404040")
147 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED,
"white",
"#404040")
148 self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,
"white",
"#404040")
152 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS,
"white",
"#808080")
153 self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS,
"white",
"#808080")
154 self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE,
"white",
"#808080")
155 self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER,
"white",
"#808080")
156 self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_BOXPLUSCONNECTED,
"white",
"#808080")
157 self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED,
"white",
"#808080")
158 self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,
"white",
"#808080")
160 self.Bind(stc.EVT_STC_UPDATEUI, self.
OnUpdateUIOnUpdateUI)
161 self.Bind(stc.EVT_STC_MARGINCLICK, self.
OnMarginClickOnMarginClick)
162 self.Bind(wx.EVT_KEY_DOWN, self.
OnKeyPressedOnKeyPressed)
169 self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
"face:%(helv)s,size:%(size)d" % faces)
173 self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
"face:%(helv)s,size:%(size)d" % faces)
174 self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,
"back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
175 self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR,
"face:%(other)s" % faces)
176 self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,
"fore:#FFFFFF,back:#0000FF,bold")
177 self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,
"fore:#000000,back:#FF0000,bold")
181 self.StyleSetSpec(stc.STC_P_DEFAULT,
"fore:#000000,face:%(helv)s,size:%(size)d" % faces)
183 self.StyleSetSpec(stc.STC_P_COMMENTLINE,
"fore:#007F00,face:%(other)s,size:%(size)d" % faces)
185 self.StyleSetSpec(stc.STC_P_NUMBER,
"fore:#007F7F,size:%(size)d" % faces)
187 self.StyleSetSpec(stc.STC_P_STRING,
"fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
189 self.StyleSetSpec(stc.STC_P_CHARACTER,
"fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
191 self.StyleSetSpec(stc.STC_P_WORD,
"fore:#00007F,bold,size:%(size)d" % faces)
193 self.StyleSetSpec(stc.STC_P_TRIPLE,
"fore:#7F0000,size:%(size)d" % faces)
195 self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE,
"fore:#7F0000,size:%(size)d" % faces)
197 self.StyleSetSpec(stc.STC_P_CLASSNAME,
"fore:#0000FF,bold,underline,size:%(size)d" % faces)
199 self.StyleSetSpec(stc.STC_P_DEFNAME,
"fore:#007F7F,bold,size:%(size)d" % faces)
201 self.StyleSetSpec(stc.STC_P_OPERATOR,
"bold,size:%(size)d" % faces)
203 self.StyleSetSpec(stc.STC_P_IDENTIFIER,
"fore:#000000,face:%(helv)s,size:%(size)d" % faces)
205 self.StyleSetSpec(stc.STC_P_COMMENTBLOCK,
"fore:#7F7F7F,size:%(size)d" % faces)
207 self.StyleSetSpec(stc.STC_P_STRINGEOL,
"fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)
209 self.SetCaretForeground(
"BLUE")
213 self.RegisterImage(1,
214 wx.ArtProvider.GetBitmap(wx.ART_FLOPPY, size=(16,16)))
215 self.RegisterImage(2,
216 wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
217 self.RegisterImage(3,
218 wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))
221 if self.CallTipActive():
223 key = event.GetKeyCode()
225 if key == 32
and event.ControlDown():
226 pos = self.GetCurrentPos()
229 if event.ShiftDown():
230 self.CallTipSetBackground(
"yellow")
231 self.CallTipShow(pos,
'lots of of text: blah, blah, blah\n\n'
232 'show some suff, maybe parameters..\n\n'
233 'fubar(param1, param2)')
243 kw = keyword.kwlist[:]
244 kw.append(
"zzzzzz?2")
246 kw.append(
"__init__?3")
247 kw.append(
"zzaaaaa?2")
248 kw.append(
"zzbaaaa?2")
249 kw.append(
"this_is_a_longer_value")
253 self.AutoCompSetIgnoreCase(
False)
256 for i
in range(len(kw)):
257 if kw[i]
in keyword.kwlist:
260 self.AutoCompShow(0,
" ".join(kw))
269 caretPos = self.GetCurrentPos()
272 charBefore = self.GetCharAt(caretPos - 1)
273 styleBefore = self.GetStyleAt(caretPos - 1)
276 if charBefore
and chr(charBefore)
in "[]{}()" and styleBefore == stc.STC_P_OPERATOR:
277 braceAtCaret = caretPos - 1
281 charAfter = self.GetCharAt(caretPos)
282 styleAfter = self.GetStyleAt(caretPos)
284 if charAfter
and chr(charAfter)
in "[]{}()" and styleAfter == stc.STC_P_OPERATOR:
285 braceAtCaret = caretPos
287 if braceAtCaret >= 0:
288 braceOpposite = self.BraceMatch(braceAtCaret)
290 if braceAtCaret != -1
and braceOpposite == -1:
291 self.BraceBadLight(braceAtCaret)
293 self.BraceHighlight(braceAtCaret, braceOpposite)
301 if evt.GetMargin() == 2:
302 if evt.GetShift()
and evt.GetControl():
305 lineClicked = self.LineFromPosition(evt.GetPosition())
307 if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
309 self.SetFoldExpanded(lineClicked,
True)
310 self.
ExpandExpand(lineClicked,
True,
True, 1)
311 elif evt.GetControl():
312 if self.GetFoldExpanded(lineClicked):
313 self.SetFoldExpanded(lineClicked,
False)
314 self.
ExpandExpand(lineClicked,
False,
True, 0)
316 self.SetFoldExpanded(lineClicked,
True)
317 self.
ExpandExpand(lineClicked,
True,
True, 100)
319 self.ToggleFold(lineClicked)
322 lineCount = self.GetLineCount()
326 for lineNum
in range(lineCount):
327 if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
328 expanding =
not self.GetFoldExpanded(lineNum)
333 while lineNum < lineCount:
334 level = self.GetFoldLevel(lineNum)
335 if level & stc.STC_FOLDLEVELHEADERFLAG
and \
336 (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:
339 self.SetFoldExpanded(lineNum,
True)
340 lineNum = self.
ExpandExpand(lineNum,
True)
341 lineNum = lineNum - 1
343 lastChild = self.GetLastChild(lineNum, -1)
344 self.SetFoldExpanded(lineNum,
False)
346 if lastChild > lineNum:
347 self.HideLines(lineNum+1, lastChild)
349 lineNum = lineNum + 1
351 def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
352 lastChild = self.GetLastChild(line, level)
355 while line <= lastChild:
358 self.ShowLines(line, line)
360 self.HideLines(line, line)
363 self.ShowLines(line, line)
366 level = self.GetFoldLevel(line)
368 if level & stc.STC_FOLDLEVELHEADERFLAG:
371 self.SetFoldExpanded(line,
True)
373 self.SetFoldExpanded(line,
False)
375 line = self.
ExpandExpand(line, doExpand, force, visLevels-1)
378 if doExpand
and self.GetFoldExpanded(line):
379 line = self.
ExpandExpand(line,
True, force, visLevels-1)
381 line = self.
ExpandExpand(line,
False, force, visLevels-1)
392 PythonSTC.__init__(self, parent, -1, style=style)
399 val = self.GetReadOnly()
400 self.SetReadOnly(
False)
402 self.EmptyUndoBuffer()
404 self.SetReadOnly(val)
407 self.SetReadOnly(
not val)
410 return self.GetModify()
416 self.SetCurrentPos(pos)
420 line = self.LineFromPosition(pos)
425 return self.GetLength()
428 return self.PositionFromLine(line)
431 return self.GetTextRange(start, end)
434 return self.GetAnchor(), self.GetCurrentPos()
437 self.SetSelectionStart(start)
438 self.SetSelectionEnd(end)
441 start = self.PositionFromLine(line)
442 end = self.GetLineEndPosition(line)
452 self.SetLexer(stc.STC_LEX_PYTHON)
453 self.SetKeyWords(0,
" ".join(keyword.kwlist))
456 self.SetProperty(
"fold",
"1")
459 self.SetProperty(
"tab.timmy.whinge.level",
"1")
465 self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER)
467 self.SetMarginWidth(1, 40)
471 self.SetIndentationGuides(
True)
472 self.SetBackSpaceUnIndents(
True)
474 self.SetTabIndents(
True)
476 self.SetUseTabs(
False)
479 self.SetViewWhiteSpace(
False)
484 self.SetEOLMode(wx.stc.STC_EOL_LF)
485 self.SetViewEOL(
False)
488 self.SetEdgeMode(stc.STC_EDGE_NONE)
491 self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
492 self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
493 self.SetMarginSensitive(2,
True)
494 self.SetMarginWidth(2, 12)
497 if wx.Platform ==
'__WXMSW__':
499 self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
500 'fore:#000000,back:#FFFFFF,face:Space Mono')
501 elif wx.Platform ==
'__WXMAC__':
505 self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
506 'fore:#000000,back:#FFFFFF,face:Monaco')
509 defsize = wx.SystemSettings.GetFont(wx.SYS_ANSI_FIXED_FONT).GetPointSize()
510 self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
511 'fore:#000000,back:#FFFFFF,face:Hack,size:%d'%defsize)
513 self.StyleSetBackground(stc.STC_STYLE_DEFAULT, Colour(200, 222, 40))
514 self.StyleSetForeground(stc.STC_STYLE_DEFAULT, Colour(7, 0, 70))
523 self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER,
'fore:#000000,back:#99A9C2')
525 self.StyleSetSpec(wx.stc.STC_STYLE_BRACELIGHT,
'fore:#00009D,back:#FFFF00')
527 self.StyleSetSpec(wx.stc.STC_STYLE_BRACEBAD,
'fore:#00009D,back:#FF0000')
529 self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE,
"fore:#CDCDCD")
532 self.StyleSetSpec(wx.stc.STC_P_DEFAULT,
'fore:#000000')
534 self.StyleSetSpec(wx.stc.STC_P_COMMENTLINE,
'fore:#008000,back:#F0FFF0')
535 self.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK,
'fore:#008000,back:#F0FFF0')
537 self.StyleSetSpec(wx.stc.STC_P_NUMBER,
'fore:#008080')
539 self.StyleSetSpec(wx.stc.STC_P_STRING,
'fore:#800080')
540 self.StyleSetSpec(wx.stc.STC_P_CHARACTER,
'fore:#800080')
542 self.StyleSetSpec(wx.stc.STC_P_WORD,
'fore:#000080,bold')
544 self.StyleSetSpec(wx.stc.STC_P_TRIPLE,
'fore:#800080,back:#FFFFEA')
545 self.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE,
'fore:#800080,back:#FFFFEA')
547 self.StyleSetSpec(wx.stc.STC_P_CLASSNAME,
'fore:#0000FF,bold')
549 self.StyleSetSpec(wx.stc.STC_P_DEFNAME,
'fore:#008080,bold')
551 self.StyleSetSpec(wx.stc.STC_P_OPERATOR,
'fore:#800000,bold')
554 self.StyleSetSpec(wx.stc.STC_P_IDENTIFIER,
'fore:#000000')
557 self.SetCaretForeground(
"BLUE")
561 self.SetBackgroundColour(Colour(200, 222, 40))
562 self.SetForegroundColour(Colour(7, 0, 70))
565 self.SetSelBackground(
True, wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT))
566 self.SetSelForeground(
True, wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))
569 self.Bind(wx.stc.EVT_STC_CHANGE, eventHandler)
577 modDefault = modOriginal
584 decoded = data.decode(
'UTF-8')
585 except UnicodeDecodeError:
589 if 0xD800 <= ord(ch) <= 0xDFFF:
599 wx.Panel.__init__(self, parent, size=(1,1))
605 self.SetBackgroundColour(Colour(200, 222, 40))
606 self.SetOwnBackgroundColour(Colour(200, 222, 40))
607 self.SetForegroundColour(Colour(7, 0, 70))
608 self.SetOwnForegroundColour(Colour(7, 0, 70))
611 self.
btnSavebtnSave = wx.Button(self, -1,
"Save Changes")
613 self.
btnSavebtnSave.Enable(
False)
618 self.
btnOpenbtnOpen = wx.Button(self, -1,
"Open...")
621 self.
btnSaveAsbtnSaveAs = wx.Button(self, -1,
"Save as...")
624 self.
radioButtonsradioButtons = {modOriginal: wx.RadioButton(self, -1,
"Original",
625 style = wx.RB_GROUP),
626 modModified: wx.RadioButton(self, -1,
"Modified")}
629 self.
controlBoxcontrolBox.Add(wx.StaticText(self, -1,
"Active Version:"), 0,
630 wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
631 for modID, radioButton
in self.
radioButtonsradioButtons.items():
632 self.
controlBoxcontrolBox.Add(radioButton, 0, wx.EXPAND | wx.RIGHT, 5)
633 radioButton.modID = modID
634 radioButton.Bind(wx.EVT_RADIOBUTTON, self.
OnRadioButtonOnRadioButton)
641 self.
boxbox = wx.BoxSizer(wx.VERTICAL)
643 self.
boxbox.Add(wx.StaticLine(self), 0, wx.EXPAND)
644 self.
boxbox.Add(self.
editoreditor, 1, wx.EXPAND)
646 self.
boxbox.Fit(self)
647 self.SetSizer(self.
boxbox)
662 self.
LoadSourceLoadSource(self.CodeModules.GetSource())
670 self.
editoreditor.SetTextRaw(source)
672 self.
btnSavebtnSave.Enable(
False)
675 self.
editoreditor.GotoLine(line)
676 self.
editoreditor.SetFocus()
678 self.
editoreditor.SelectLine(line)
681 active = self.CodeModules.GetActiveID()
685 if moduleID == active:
690 if self.CodeModules.Exists(moduleID):
692 if moduleID == modModified:
693 self.btnRestore.Enable(
True)
696 if moduleID == modModified:
697 self.btnRestore.Enable(
False)
700 radioSelected = event.GetEventObject()
701 modSelected = radioSelected.modID
702 if modSelected != self.CodeModules.GetActiveID():
703 busy = wx.BusyInfo(
"Reloading Code module...")
704 self.CodeModules.SetActive(modSelected)
708 if self.CodeModules.name != __name__:
715 if self.
pathpath
is None:
716 self.
pathpath =
"noname"
721 if path != self.
pathpath
and os.path.isfile(path):
722 overwriteMsg =
"You are about to overwrite an existing file\n" + \
723 "Do you want to continue?"
724 dlg = wx.MessageDialog(self, overwriteMsg,
"Editor Writer",
725 wx.YES_NO | wx.NO_DEFAULT| wx.ICON_EXCLAMATION)
726 dlg.SetBackgroundColour(Colour(200, 222, 40))
727 dlg.SetForegroundColour(Colour(7, 0, 70))
728 result = dlg.ShowModal()
729 if result == wx.ID_NO:
735 f = open(self.
pathpath,
"wb")
736 source = self.
editoreditor.GetTextRaw()
747 bsource = bytearray(source)
750 for c
in range(0, len(source), chunksize):
751 data = [chr(
int(x, base=2))
for x
in source[c:c + chunksize]]
752 f.write(
''.join(data))
764 self.CodeModules.Delete(modModified)
765 os.unlink(modifiedFilename)
766 busy = wx.BusyInfo(
"Reloading Code module...")
770 self.
mainFramemainFrame.SetTreeModified(
False)
784 cwd = os.path.dirname(self.
pathpath)
788 self, message=
"Choose a file",
793 wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST |
799 if dlg.ShowModal() == wx.ID_OK:
801 paths = dlg.GetPaths()
842 cwd = os.path.dirname(self.
pathpath)
843 fname = os.path.basename(self.
pathpath)
846 self.
pathpath =
"noname"
848 self, message=
"Save file as ...", defaultDir=cwd,
849 defaultFile=fname, wildcard=wildcard, style=wx.FD_SAVE
858 if dlg.ShowModal() == wx.ID_OK:
878 self.
OnSaveOnSave(evt, path)
893 st = os.path.join(*tuple(path.split(
'/')))
895 if path.startswith(
'/'):
904 sp = wx.StandardPaths.Get()
905 return sp.GetUserDataDir()
920 if not name.endswith(
".py"):
929 if not name.endswith(
".py"):
932 if os.path.isfile(name):
935 originalDir = os.getcwd()
936 listDir = os.listdir(originalDir)
939 if not os.path.isdir(item):
942 dirFile = os.listdir(item)
945 return os.path.join(item, name)
963 config = wx.FileConfig(
964 localFilename=os.path.join(
GetDataDir(),
"options"))
971 _platformNames = [
"wxMSW",
"wxGTK",
"wxMac"]
974 def main(filepath, frame=None):
977 frame = wx.Frame(
None)
986 if __name__ ==
'__main__' and __package__
is None:
987 from os
import sys, path
988 sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
Panel for the 'Code Editor' ta.
def OnCodeModified(self, event)
def OnRestore(self, event)
def ActiveModuleChanged(self)
def LoadSource(self, source)
def UpdateControlState(self)
def OnSave(self, event, path=None)
def OnRadioButton(self, event)
def __init__(self, parent, mainFrame, path=None)
def JumpToLine(self, line, highlight=False)
def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0)
def OnUpdateUI(self, evt)
def Expand(self, line, doExpand, force=False, visLevels=0, level=-1)
def OnMarginClick(self, evt)
def OnKeyPressed(self, event)
def GetPositionFromLine(self, line)
def ShowPosition(self, pos)
def SetUpEditor(self)
This method carries out the work of setting up the Code editor.
def __init__(self, parent, style=wx.BORDER_NONE)
def GetRange(self, start, end)
def SetValue(self, value)
def SetSelection(self, start, end)
def SetInsertionPoint(self, pos)
def SelectLine(self, line)
def RegisterModifiedEvent(self, eventHandler)
def GetLastPosition(self)
def SetEditable(self, val)
def DoesModifiedExist(name)
Returns whether the specified Code has a modified copy.
def GetModifiedDirectory()
Returns the directory where modified versions of the Code files are stored.
def GetOriginalFilename(name)
Returns the filename of the original version of the specified Code.
def opj(path)
Convert paths to the platform-specific separato.
def GetModifiedFilename(name)
Returns the filename of the modified version of the specified Code.
def GetDataDir()
Return the standard location on this platform for application data.
def main(filepath, frame=None)