def view_diff(self,difflines,filename=''): def quit(): p=diff_screen.parent_window() diff_screen.destroy() self._iface.set_screen(p) dr=DifferenceReader() dr.changeSetting('lineno',1) text=dr._createTextObj() diff=dr.parseDifference(difflines) dr.setTextToDiff(diff,text) diff_screen=self._iface.create_screen(body=text.t,menu=text.menu,name="diff screen for %r"%filename,exit=quit,title=filename) text.toLine(1) self._iface.set_screen(diff_screen)
def go(): m = appuifw.app.menu dr = DifferenceReader() f1 = open(items[0][1]) f2 = open(items[1][1]) t1 = f1.readlines() t2 = f2.readlines() f1.close() f2.close() diff = difflib.unified_diff(t1, t2) difftext = '\n'.join([l for l in diff][2:]) diffs = dr.parseDifference(difftext) dr.setTextToDiff(diffs, dr._createTextObj()) dr._lockThreadAndDisplay() appuifw.app.menu = m
def view_diff(self, difflines, filename=''): def quit(): p = diff_screen.parent_window() diff_screen.destroy() self._iface.set_screen(p) dr = DifferenceReader() dr.changeSetting('lineno', 1) text = dr._createTextObj() diff = dr.parseDifference(difflines) dr.setTextToDiff(diff, text) diff_screen = self._iface.create_screen(body=text.t, menu=text.menu, name="diff screen for %r" % filename, exit=quit, title=filename) text.toLine(1) self._iface.set_screen(diff_screen)