def go(starget, starget2, targettable): out = iface_verifydocs.go(target, targettable,modifyEntries = True) for o in out: o.sortkey = iface_verifydocs.parseArgs(o) o.sortkey.insert(0, o.type) # look for . also verify correct args in the out.sort(key = lambda o: (tuple(o.sortkey))) for o in out: print o.sortkey, o.name
def go(starget, starget2, targettable): stdoutStd = sys.stdout stdoutFile = PrintToFile('docs_out.txt') sys.stdout = stdoutFile print ''' # ScApp methods ScApp.Trace(s) ScApp.MsgBox(s) ScApp.OpenFile(s) ScApp.GetProperty(s) ScApp.SetProperty(s, v) ScApp.UnsetProperty(s) ScApp.UpdateStatusBar(bUpdateSlowData) # Menu commands''' f=open(starget2,'r') isStart=False out = [] for line in f: if not isStart: if 'rgFriendlyNamedIDMConstants[] =' in line: isStart = True else: if '};' in line: break else: out.append(line.split('",')[0].replace('{"','')) assert isStart for part in out: #~ print 'void\tScApp.fn'+part+'()' print 'ScApp.'+part+'()' f.close() print ''' # Pane methods (can be used with ScEditor or ScOutput) ScEditor.Write(txt) to write text to the current position ScEditor.GetAllText() returns all text in the file ScEditor.Append(txt) ScEditor.Insert(npos, txt) ScEditor.Remove(npos1, npos2) ScEditor.Textrange(npos1, npos2) ScEditor.FindText(s,n1=0,n2=-1,wholeWord=False,matchCase=False,regExp=False, nFlags=0) ScEditor.GetCurLine() get text in current line ''' sys.stdout = stdoutStd out = iface_verifydocs.go(target, targettable,modifyEntries = True) sys.stdout = stdoutFile for o in out: if o.type == 'get': assert o.name.startswith('Get') if o.type == 'set': assert o.name.startswith('Set') # exceptions.... if o.name=='FindText': continue #we don't document these if o.name in dictDoNotDocument: continue sname = o.name if 'stringresult' not in o.args: rettype=o.returntype.replace('position','pos') sargs = o.args.replace(',)',')') if sname in dictOverrideRemoveEmptyFirstArg: assert sargs.startswith('(,'); sargs=sargs.replace('(,','(') print rettype + '\tScEditor.'+sname + sargs else: assert o.returntype=='int' sargs = o.args.split(',')[0] + ')' print 'string' + '\tScEditor.'+ sname+ sargs if o.docs: print o.docs.replace('#','') print ''' # Constants, from IFaceTable.cxx ScApp.SCFIND_WHOLEWORD ScApp.SCFIND_MATCHCASE ScApp.SCFIND_WORDSTART ScApp.SCFIND_REGEXP ScApp.SCFIND_POSIX ...many others...''' stdoutFile.close()