[pywin32-checkins] pywin32/Pythonwin/pywin/scintilla control.py, 1.17.2.1, 1.17.2.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-02 22:02:42
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26290 Modified Files: Tag: py3k control.py Log Message: Remove import * Index: control.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/control.py,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -C2 -d -r1.17.2.1 -r1.17.2.2 *** control.py 29 Aug 2008 06:16:42 -0000 1.17.2.1 --- control.py 2 Sep 2008 22:02:51 -0000 1.17.2.2 *************** *** 14,18 **** import string import os ! from .scintillacon import * # Load Scintilla.dll to get access to the control. --- 14,18 ---- import string import os ! from . import scintillacon # Load Scintilla.dll to get access to the control. *************** *** 33,36 **** --- 33,37 ---- dllid = win32api.LoadLibrary("Scintilla.DLL") + ## These are from Richedit.h - need to add to win32con or commctrl EM_GETTEXTRANGE = 1099 EM_EXLINEFROMCHAR = 1078 *************** *** 59,63 **** def SCIAddText(self, text): ! self.SendMessage(SCI_ADDTEXT, text.encode(default_scintilla_encoding)) def SCIAddStyledText(self, text, style = None): # If style is None, text is assumed to be a "native" Scintilla buffer. --- 60,64 ---- def SCIAddText(self, text): ! self.SendMessage(scintillacon.SCI_ADDTEXT, text.encode(default_scintilla_encoding)) def SCIAddStyledText(self, text, style = None): # If style is None, text is assumed to be a "native" Scintilla buffer. *************** *** 67,98 **** text = list(map(lambda char, style=style: char+chr(style), text)) text = ''.join(text) ! self.SendMessage(SCI_ADDSTYLEDTEXT, text.encode(default_scintilla_encoding)) def SCIInsertText(self, text, pos=-1): ## sma = array.array('u', text+"\0") ## (a,l) = sma.buffer_info() buff=(text+'\0').encode(default_scintilla_encoding) ! self.SendScintilla(SCI_INSERTTEXT, pos, buff) def SCISetSavePoint(self): ! self.SendScintilla(SCI_SETSAVEPOINT) def SCISetUndoCollection(self, collectFlag): ! self.SendScintilla(SCI_SETUNDOCOLLECTION, collectFlag) def SCIBeginUndoAction(self): ! self.SendScintilla(SCI_BEGINUNDOACTION) def SCIEndUndoAction(self): ! self.SendScintilla(SCI_ENDUNDOACTION) def SCIGetCurrentPos(self): ! return self.SendScintilla(SCI_GETCURRENTPOS) def SCIGetCharAt(self, pos): # Must ensure char is unsigned! ! return chr(self.SendScintilla(SCI_GETCHARAT, pos) & 0xFF) def SCIGotoLine(self, line): ! self.SendScintilla(SCI_GOTOLINE, line) def SCIBraceMatch(self, pos, maxReStyle): ! return self.SendScintilla(SCI_BRACEMATCH, pos, maxReStyle) def SCIBraceHighlight(self, pos, posOpposite): ! return self.SendScintilla(SCI_BRACEHIGHLIGHT, pos, posOpposite) def SCIBraceBadHighlight(self, pos): ! return self.SendScintilla(SCI_BRACEBADLIGHT, pos) #################################### --- 68,99 ---- text = list(map(lambda char, style=style: char+chr(style), text)) text = ''.join(text) ! self.SendMessage(scintillacon.SCI_ADDSTYLEDTEXT, text.encode(default_scintilla_encoding)) def SCIInsertText(self, text, pos=-1): ## sma = array.array('u', text+"\0") ## (a,l) = sma.buffer_info() buff=(text+'\0').encode(default_scintilla_encoding) ! self.SendScintilla(scintillacon.SCI_INSERTTEXT, pos, buff) def SCISetSavePoint(self): ! self.SendScintilla(scintillacon.SCI_SETSAVEPOINT) def SCISetUndoCollection(self, collectFlag): ! self.SendScintilla(scintillacon.SCI_SETUNDOCOLLECTION, collectFlag) def SCIBeginUndoAction(self): ! self.SendScintilla(scintillacon.SCI_BEGINUNDOACTION) def SCIEndUndoAction(self): ! self.SendScintilla(scintillacon.SCI_ENDUNDOACTION) def SCIGetCurrentPos(self): ! return self.SendScintilla(scintillacon.SCI_GETCURRENTPOS) def SCIGetCharAt(self, pos): # Must ensure char is unsigned! ! return chr(self.SendScintilla(scintillacon.SCI_GETCHARAT, pos) & 0xFF) def SCIGotoLine(self, line): ! self.SendScintilla(scintillacon.SCI_GOTOLINE, line) def SCIBraceMatch(self, pos, maxReStyle): ! return self.SendScintilla(scintillacon.SCI_BRACEMATCH, pos, maxReStyle) def SCIBraceHighlight(self, pos, posOpposite): ! return self.SendScintilla(scintillacon.SCI_BRACEHIGHLIGHT, pos, posOpposite) def SCIBraceBadHighlight(self, pos): ! return self.SendScintilla(scintillacon.SCI_BRACEBADLIGHT, pos) #################################### *************** *** 101,158 **** # NOTE - dependent on of we use builtin lexer, so handled below. def SCIGetEndStyled(self): ! return self.SendScintilla(SCI_GETENDSTYLED) def SCIStyleSetFore(self, num, v): ! return self.SendScintilla(SCI_STYLESETFORE, num, v) def SCIStyleSetBack(self, num, v): ! return self.SendScintilla(SCI_STYLESETBACK, num, v) def SCIStyleSetEOLFilled(self, num, v): ! return self.SendScintilla(SCI_STYLESETEOLFILLED, num, v) def SCIStyleSetFont(self, num, name, characterset=0): buff = (name + "\0").encode(default_scintilla_encoding) ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_STYLESETFONT, num, buff) ! self.SendScintilla(SCI_STYLESETCHARACTERSET, num, characterset) def SCIStyleSetBold(self, num, bBold): ! self.SendScintilla(SCI_STYLESETBOLD, num, bBold) def SCIStyleSetItalic(self, num, bItalic): ! self.SendScintilla(SCI_STYLESETITALIC, num, bItalic) def SCIStyleSetSize(self, num, size): ! self.SendScintilla(SCI_STYLESETSIZE, num, size) def SCIGetViewWS(self): ! return self.SendScintilla(SCI_GETVIEWWS) def SCISetViewWS(self, val): ! self.SendScintilla(SCI_SETVIEWWS, not (val==0)) self.InvalidateRect() def SCISetIndentationGuides(self, val): ! self.SendScintilla(SCI_SETINDENTATIONGUIDES, val) def SCIGetIndentationGuides(self): ! return self.SendScintilla(SCI_GETINDENTATIONGUIDES) def SCISetIndent(self, val): ! self.SendScintilla(SCI_SETINDENT, val) def SCIGetIndent(self, val): ! return self.SendScintilla(SCI_GETINDENT) def SCIGetViewEOL(self): ! return self.SendScintilla(SCI_GETVIEWEOL) def SCISetViewEOL(self, val): ! self.SendScintilla(SCI_SETVIEWEOL, not(val==0)) self.InvalidateRect() def SCISetTabWidth(self, width): ! self.SendScintilla(SCI_SETTABWIDTH, width, 0) def SCIStartStyling(self, pos, mask): ! self.SendScintilla(SCI_STARTSTYLING, pos, mask) def SCISetStyling(self, pos, attr): ! self.SendScintilla(SCI_SETSTYLING, pos, attr) def SCISetStylingEx(self, ray): # ray is an array. address, length = ray.buffer_info() ! self.SendScintilla(SCI_SETSTYLINGEX, length, address) def SCIGetStyleAt(self, pos): ! return self.SendScintilla(SCI_GETSTYLEAT, pos) def SCISetMarginWidth(self, width): ! self.SendScintilla(SCI_SETMARGINWIDTHN, 1, width) def SCISetMarginWidthN(self, n, width): ! self.SendScintilla(SCI_SETMARGINWIDTHN, n, width) def SCISetFoldFlags(self, flags): ! self.SendScintilla(SCI_SETFOLDFLAGS, flags) # Markers def SCIMarkerDefineAll(self, markerNum, markerType, fore, back): --- 102,159 ---- # NOTE - dependent on of we use builtin lexer, so handled below. def SCIGetEndStyled(self): ! return self.SendScintilla(scintillacon.SCI_GETENDSTYLED) def SCIStyleSetFore(self, num, v): ! return self.SendScintilla(scintillacon.SCI_STYLESETFORE, num, v) def SCIStyleSetBack(self, num, v): ! return self.SendScintilla(scintillacon.SCI_STYLESETBACK, num, v) def SCIStyleSetEOLFilled(self, num, v): ! return self.SendScintilla(scintillacon.SCI_STYLESETEOLFILLED, num, v) def SCIStyleSetFont(self, num, name, characterset=0): buff = (name + "\0").encode(default_scintilla_encoding) ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(scintillacon.SCI_STYLESETFONT, num, buff) ! self.SendScintilla(scintillacon.SCI_STYLESETCHARACTERSET, num, characterset) def SCIStyleSetBold(self, num, bBold): ! self.SendScintilla(scintillacon.SCI_STYLESETBOLD, num, bBold) def SCIStyleSetItalic(self, num, bItalic): ! self.SendScintilla(scintillacon.SCI_STYLESETITALIC, num, bItalic) def SCIStyleSetSize(self, num, size): ! self.SendScintilla(scintillacon.SCI_STYLESETSIZE, num, size) def SCIGetViewWS(self): ! return self.SendScintilla(scintillacon.SCI_GETVIEWWS) def SCISetViewWS(self, val): ! self.SendScintilla(scintillacon.SCI_SETVIEWWS, not (val==0)) self.InvalidateRect() def SCISetIndentationGuides(self, val): ! self.SendScintilla(scintillacon.SCI_SETINDENTATIONGUIDES, val) def SCIGetIndentationGuides(self): ! return self.SendScintilla(scintillacon.SCI_GETINDENTATIONGUIDES) def SCISetIndent(self, val): ! self.SendScintilla(scintillacon.SCI_SETINDENT, val) def SCIGetIndent(self, val): ! return self.SendScintilla(scintillacon.SCI_GETINDENT) def SCIGetViewEOL(self): ! return self.SendScintilla(scintillacon.SCI_GETVIEWEOL) def SCISetViewEOL(self, val): ! self.SendScintilla(scintillacon.SCI_SETVIEWEOL, not(val==0)) self.InvalidateRect() def SCISetTabWidth(self, width): ! self.SendScintilla(scintillacon.SCI_SETTABWIDTH, width, 0) def SCIStartStyling(self, pos, mask): ! self.SendScintilla(scintillacon.SCI_STARTSTYLING, pos, mask) def SCISetStyling(self, pos, attr): ! self.SendScintilla(scintillacon.SCI_SETSTYLING, pos, attr) def SCISetStylingEx(self, ray): # ray is an array. address, length = ray.buffer_info() ! self.SendScintilla(scintillacon.SCI_SETSTYLINGEX, length, address) def SCIGetStyleAt(self, pos): ! return self.SendScintilla(scintillacon.SCI_GETSTYLEAT, pos) def SCISetMarginWidth(self, width): ! self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, 1, width) def SCISetMarginWidthN(self, n, width): ! self.SendScintilla(scintillacon.SCI_SETMARGINWIDTHN, n, width) def SCISetFoldFlags(self, flags): ! self.SendScintilla(scintillacon.SCI_SETFOLDFLAGS, flags) # Markers def SCIMarkerDefineAll(self, markerNum, markerType, fore, back): *************** *** 161,181 **** self.SCIMarkerSetBack(markerNum, back) def SCIMarkerDefine(self, markerNum, markerType): ! self.SendScintilla(SCI_MARKERDEFINE, markerNum, markerType) def SCIMarkerSetFore(self, markerNum, fore): ! self.SendScintilla(SCI_MARKERSETFORE, markerNum, fore) def SCIMarkerSetBack(self, markerNum, back): ! self.SendScintilla(SCI_MARKERSETBACK, markerNum, back) def SCIMarkerAdd(self, lineNo, markerNum): ! self.SendScintilla(SCI_MARKERADD, lineNo, markerNum) def SCIMarkerDelete(self, lineNo, markerNum): ! self.SendScintilla(SCI_MARKERDELETE, lineNo, markerNum) def SCIMarkerDeleteAll(self, markerNum=-1): ! self.SendScintilla(SCI_MARKERDELETEALL, markerNum) def SCIMarkerGet(self, lineNo): ! return self.SendScintilla(SCI_MARKERGET, lineNo) def SCIMarkerNext(self, lineNo, markerNum): ! return self.SendScintilla(SCI_MARKERNEXT, lineNo, markerNum) def SCICancel(self): ! self.SendScintilla(SCI_CANCEL) # AutoComplete def SCIAutoCShow(self, text): --- 162,182 ---- self.SCIMarkerSetBack(markerNum, back) def SCIMarkerDefine(self, markerNum, markerType): ! self.SendScintilla(scintillacon.SCI_MARKERDEFINE, markerNum, markerType) def SCIMarkerSetFore(self, markerNum, fore): ! self.SendScintilla(scintillacon.SCI_MARKERSETFORE, markerNum, fore) def SCIMarkerSetBack(self, markerNum, back): ! self.SendScintilla(scintillacon.SCI_MARKERSETBACK, markerNum, back) def SCIMarkerAdd(self, lineNo, markerNum): ! self.SendScintilla(scintillacon.SCI_MARKERADD, lineNo, markerNum) def SCIMarkerDelete(self, lineNo, markerNum): ! self.SendScintilla(scintillacon.SCI_MARKERDELETE, lineNo, markerNum) def SCIMarkerDeleteAll(self, markerNum=-1): ! self.SendScintilla(scintillacon.SCI_MARKERDELETEALL, markerNum) def SCIMarkerGet(self, lineNo): ! return self.SendScintilla(scintillacon.SCI_MARKERGET, lineNo) def SCIMarkerNext(self, lineNo, markerNum): ! return self.SendScintilla(scintillacon.SCI_MARKERNEXT, lineNo, markerNum) def SCICancel(self): ! self.SendScintilla(scintillacon.SCI_CANCEL) # AutoComplete def SCIAutoCShow(self, text): *************** *** 183,200 **** text = ' '.join(text) buff = (text + "\0").encode(default_scintilla_encoding) ! return self.SendScintilla(SCI_AUTOCSHOW, 0, buff) def SCIAutoCCancel(self): ! self.SendScintilla(SCI_AUTOCCANCEL) def SCIAutoCActive(self): ! return self.SendScintilla(SCI_AUTOCACTIVE) def SCIAutoCComplete(self): ! return self.SendScintilla(SCI_AUTOCCOMPLETE) def SCIAutoCStops(self, stops): buff = (stops + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_AUTOCSTOPS, 0, buff) def SCIAutoCSetAutoHide(self, hide): ! self.SendScintilla(SCI_AUTOCSETAUTOHIDE, hide) def SCIAutoCSetFillups(self, fillups): ! self.SendScintilla(SCI_AUTOCSETFILLUPS, fillups) # Call tips def SCICallTipShow(self, text, pos=-1): --- 184,201 ---- text = ' '.join(text) buff = (text + "\0").encode(default_scintilla_encoding) ! return self.SendScintilla(scintillacon.SCI_AUTOCSHOW, 0, buff) def SCIAutoCCancel(self): ! self.SendScintilla(scintillacon.SCI_AUTOCCANCEL) def SCIAutoCActive(self): ! return self.SendScintilla(scintillacon.SCI_AUTOCACTIVE) def SCIAutoCComplete(self): ! return self.SendScintilla(scintillacon.SCI_AUTOCCOMPLETE) def SCIAutoCStops(self, stops): buff = (stops + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(scintillacon.SCI_AUTOCSTOPS, 0, buff) def SCIAutoCSetAutoHide(self, hide): ! self.SendScintilla(scintillacon.SCI_AUTOCSETAUTOHIDE, hide) def SCIAutoCSetFillups(self, fillups): ! self.SendScintilla(scintillacon.SCI_AUTOCSETFILLUPS, fillups) # Call tips def SCICallTipShow(self, text, pos=-1): *************** *** 209,225 **** buff = (text + "\0").encode(default_scintilla_encoding) ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_CALLTIPSHOW, pos, buff) def SCICallTipCancel(self): ! self.SendScintilla(SCI_CALLTIPCANCEL) def SCICallTipActive(self): ! return self.SendScintilla(SCI_CALLTIPACTIVE) def SCICallTipPosStart(self): ! return self.SendScintilla(SCI_CALLTIPPOSSTART) def SCINewline(self): ! self.SendScintilla(SCI_NEWLINE) # Lexer etc def SCISetKeywords(self, keywords, kw_list_no = 0): buff = (keywords+"\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_SETKEYWORDS, kw_list_no, buff) def SCISetProperty(self, name, value): name_buff = array.array('b', (name + '\0').encode('utf-8')) --- 210,226 ---- buff = (text + "\0").encode(default_scintilla_encoding) ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(scintillacon.SCI_CALLTIPSHOW, pos, buff) def SCICallTipCancel(self): ! self.SendScintilla(scintillacon.SCI_CALLTIPCANCEL) def SCICallTipActive(self): ! return self.SendScintilla(scintillacon.SCI_CALLTIPACTIVE) def SCICallTipPosStart(self): ! return self.SendScintilla(scintillacon.SCI_CALLTIPPOSSTART) def SCINewline(self): ! self.SendScintilla(scintillacon.SCI_NEWLINE) # Lexer etc def SCISetKeywords(self, keywords, kw_list_no = 0): buff = (keywords+"\0").encode(default_scintilla_encoding) ! self.SendScintilla(scintillacon.SCI_SETKEYWORDS, kw_list_no, buff) def SCISetProperty(self, name, value): name_buff = array.array('b', (name + '\0').encode('utf-8')) *************** *** 227,264 **** address_name_buffer = name_buff.buffer_info()[0] address_val_buffer = val_buff.buffer_info()[0] ! self.SendScintilla(SCI_SETPROPERTY, address_name_buffer, address_val_buffer) def SCISetStyleBits(self, nbits): ! self.SendScintilla(SCI_SETSTYLEBITS, nbits) # Folding def SCIGetFoldLevel(self, lineno): ! return self.SendScintilla(SCI_GETFOLDLEVEL, lineno) def SCIToggleFold(self, lineno): ! return self.SendScintilla(SCI_TOGGLEFOLD, lineno) def SCIEnsureVisible(self, lineno): ! self.SendScintilla(SCI_ENSUREVISIBLE, lineno) def SCIGetFoldExpanded(self, lineno): ! return self.SendScintilla(SCI_GETFOLDEXPANDED, lineno) # right edge def SCISetEdgeColumn(self, edge): ! self.SendScintilla(SCI_SETEDGECOLUMN, edge) def SCIGetEdgeColumn(self): ! return self.SendScintilla(SCI_GETEDGECOLUMN) def SCISetEdgeMode(self, mode): ! self.SendScintilla(SCI_SETEDGEMODE, mode) def SCIGetEdgeMode(self): ! return self.SendScintilla(SCI_GETEDGEMODE) def SCISetEdgeColor(self, color): ! self.SendScintilla(SCI_SETEDGECOLOUR, color) def SCIGetEdgeColor(self): ! return self.SendScintilla(SCI_GETEDGECOLOR) # Multi-doc def SCIGetDocPointer(self): ! return self.SendScintilla(SCI_GETDOCPOINTER) def SCISetDocPointer(self, p): ! return self.SendScintilla(SCI_SETDOCPOINTER, 0, p) def SCISetWrapMode(self, mode): ! return self.SendScintilla(SCI_SETWRAPMODE, mode) def SCIGetWrapMode(self): ! return self.SendScintilla(SCI_GETWRAPMODE) class CScintillaEditInterface(ScintillaControlInterface): --- 228,265 ---- address_name_buffer = name_buff.buffer_info()[0] address_val_buffer = val_buff.buffer_info()[0] ! self.SendScintilla(scintillacon.SCI_SETPROPERTY, address_name_buffer, address_val_buffer) def SCISetStyleBits(self, nbits): ! self.SendScintilla(scintillacon.SCI_SETSTYLEBITS, nbits) # Folding def SCIGetFoldLevel(self, lineno): ! return self.SendScintilla(scintillacon.SCI_GETFOLDLEVEL, lineno) def SCIToggleFold(self, lineno): ! return self.SendScintilla(scintillacon.SCI_TOGGLEFOLD, lineno) def SCIEnsureVisible(self, lineno): ! self.SendScintilla(scintillacon.SCI_ENSUREVISIBLE, lineno) def SCIGetFoldExpanded(self, lineno): ! return self.SendScintilla(scintillacon.SCI_GETFOLDEXPANDED, lineno) # right edge def SCISetEdgeColumn(self, edge): ! self.SendScintilla(scintillacon.SCI_SETEDGECOLUMN, edge) def SCIGetEdgeColumn(self): ! return self.SendScintilla(scintillacon.SCI_GETEDGECOLUMN) def SCISetEdgeMode(self, mode): ! self.SendScintilla(scintillacon.SCI_SETEDGEMODE, mode) def SCIGetEdgeMode(self): ! return self.SendScintilla(scintillacon.SCI_GETEDGEMODE) def SCISetEdgeColor(self, color): ! self.SendScintilla(scintillacon.SCI_SETEDGECOLOUR, color) def SCIGetEdgeColor(self): ! return self.SendScintilla(scintillacon.SCI_GETEDGECOLOR) # Multi-doc def SCIGetDocPointer(self): ! return self.SendScintilla(scintillacon.SCI_GETDOCPOINTER) def SCISetDocPointer(self, p): ! return self.SendScintilla(scintillacon.SCI_SETDOCPOINTER, 0, p) def SCISetWrapMode(self, mode): ! return self.SendScintilla(scintillacon.SCI_SETWRAPMODE, mode) def SCIGetWrapMode(self): ! return self.SendScintilla(scintillacon.SCI_GETWRAPMODE) class CScintillaEditInterface(ScintillaControlInterface): *************** *** 290,295 **** def GetSel(self): ! currentPos = self.SendScintilla(SCI_GETCURRENTPOS) ! anchorPos = self.SendScintilla(SCI_GETANCHOR) if currentPos < anchorPos: return (currentPos, anchorPos) --- 291,296 ---- def GetSel(self): ! currentPos = self.SendScintilla(scintillacon.SCI_GETCURRENTPOS) ! anchorPos = self.SendScintilla(scintillacon.SCI_GETANCHOR) if currentPos < anchorPos: return (currentPos, anchorPos) *************** *** 359,363 **** def ReplaceSel(self, str): buff = (str + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_REPLACESEL, 0, buff) def GetLine(self, line=-1): --- 360,364 ---- def ReplaceSel(self, str): buff = (str + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(scintillacon.SCI_REPLACESEL, 0, buff) def GetLine(self, line=-1): |