More actions
http://scintilla.org/ScintillaDoc.html http://wiki.wxpython.org/index.cgi/wxStyledTextCtrl
Scintilla 관련 참조 도큐먼트들. (Refactoring 필요) PythonCard 의 코드를 읽어보면서 이용방법들을 익히게 되었다.
syntax hilighting 셋팅
Boa Constructor 나 Pythoncard, wxPython 의 samples 의 StyleEditor 등을 보면 STCStyleEditor 모듈이 있다. 이 모듈에서 initSTC 함수를 사용하면 된다. 환경 셋팅 다이얼로그를 띄우고 싶다면 STCStyleEditDlg 를 사용한다.
stcControl = self
language = 'python'
configFileAbsolutePath = os.path.abspath("stc-styles.rc.cfg")
STCStyleEditor.STCStyleEditDlg(stcControl, language, configFileAbsolutePath)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
stcControl.setDefaultStyles()
커서 위치 관련 메소드들
GetCurrentPos() LineFromPosition(aPos) GetColumn(aPos)
Refactor 할 것들
SetEdgeColumn(aCol) GetModify() - 수정상황인지 아닌지 표시 setEditorStyle('python') text SetSavePoint() SetUndoCollection(0) ClearAll() EmptyUndoBuffer() SetUndoCollection(1) SetSavePoint() GotoLine(lineNum - 1)
CmdKeyExecute(stc.wxSTC_CMD_TAB) CmdKeyExecute(stc.wxSTC_CMD_BACKTAB)
sel=GetSelection() LineFromPosition(sel[0]) LineFromPosition(sel[1]) if end > start and doc.GetColumn(sel[1]) == 0: end = end-1
BeginUndoAction() firstChar = PositionFromLine(lineNumber) InsertText(firstChar, "##") SetCurrentPos(PositionFromLine(start)) SetAnchor(GetLineEndPosition(end)) EndUndoAction()
SetCurrentPos(aPos) GetCharAt(aPos) DelLineLeft()
SetViewWhiteSpace(boolean) SetIndentationGuides(boolean) SetEdgeMode(stc.wxSTC_EDGE_LINE) SetEdgeMode(stc.wxSTC_EDGE_NONE) getStyleConfigPath()
SetWrapMode(boolean)
CmdKeyExecute(stc.wxSTC_CMD_NEWLINE) indent = GetLineIndentation(line) padding = " " * indent pos = GetCurrentPos()
GetStyleAt(colonPos) not in [stc.wxSTC_P_COMMENTLINE, stc.wxSTC_P_COMMENTBLOCK, stc.wxSTC_P_TRIPLEDOUBLE]: padding += " " * 4 InsertText(pos, padding) newpos = pos + len(pandding) SetCurrentPos(newpos) SetSelection(newpos, newpos)