def checkSTC(stc, before, after): stc.showStyle() # change cursor to "|" stc.ReplaceSelection("|") text = stc.GetText() if after == text: print "Matched:\n*** stc ***\n%s\n***\n%s\n***" % (text, after) return True print "Not matched:\n*** stc ***: repr=%s\n%s\n***\n*** should be ***: repr=%s\n%s\n***" % (repr(text), text, repr(after), after) return False
def checkSTC(stc, before, after): stc.showStyle() # change cursor to "|" stc.ReplaceSelection("|") text = stc.GetText() if after == text: print "Matched:\n*** stc ***\n%s\n***\n%s\n***" % (text, after) return True print "Not matched:\n*** stc ***: repr=%s\n%s\n***\n*** should be ***: repr=%s\n%s\n***" % ( repr(text), text, repr(after), after) return False
def prepareSTC(stc, before): print "*** before *** repr=%s\n%s" % (repr(before), before) cursor = before.find("|") stc.SetText(before) # change "|" to the cursor stc.SetTargetStart(cursor) stc.SetTargetEnd(cursor+1) stc.ReplaceTarget("") stc.GotoPos(cursor) stc.Colourise(0, stc.GetTextLength()) stc.showStyle()
def prepareSTC(stc, before): print "*** before *** repr=%s\n%s" % (repr(before), before) cursor = before.find("|") stc.SetText(before) # change "|" to the cursor stc.SetTargetStart(cursor) stc.SetTargetEnd(cursor + 1) stc.ReplaceTarget("") stc.GotoPos(cursor) stc.Colourise(0, stc.GetTextLength()) stc.showStyle()