def __init__(self, lines): """""" ## Basic application setup. self.app = wx.PySimpleApp() self.app.frame = wx.Frame(None, title="Hvergelmir") self.app.frame.SetSize(wx.Size(1200, 900)) self.app.frame.CreateStatusBar(1) self.frameSizer = wx.BoxSizer(wx.VERTICAL) self.frameContents = wx.SplitterWindow(self.app.frame) ## Parse Valgrind log file. parser = ErrorParser() errors, unknowns, pid = parser.parse(lines) if errors is None: print("Could not read any errors.") sys.exit(1) self.errorTreeFromBottom = SharedStackError(errors, 0, Stack.FROM_BOTTOM) self.errorTreeFromTop = SharedStackError(errors, 0, Stack.FROM_TOP) if unknowns is not None: print("The parser didn't recognize the following error types:") for unknown in unknowns: print(" " + unknown) ## Create GUI. self.treePanel = TreePanel(self.frameContents, self.errorTreeFromBottom, self.errorTreeFromTop) self.errorPanel = ErrorPanel(self.frameContents) self.frameContents.SplitVertically(self.treePanel, self.errorPanel) self.frameSizer.Add(self.frameContents, 1, flag=wx.EXPAND) self.app.frame.SetSizer(self.frameSizer) self.app.frame.Center() self.app.frame.Show() ## Define GUI callbacks. self.treePanel.setItemSelectedCallback(self.treeItemSelected) self.errorPanel.sourceCode.setSourceCode(["Select an error from the list."], None) self.app.MainLoop()
from operations.ErrorParser import ErrorParser valgrindLogFileName = "../valgrind.errors" try: with open(valgrindLogFileName, "r") as valgrindLogFile: lines = valgrindLogFile.read().splitlines() except: sys.exit("Could not read Valgrind log file '" + valgrindLogFileName + "'.") if lines == None or len(lines) == 0: sys.exit("Did not get any lines from '" + valgrindLogFileName + "'.") parser = ErrorParser() errors, unknowns, id = parser.parse(lines) assert errors != None, "Get None error list from parser." assert unknowns != None, "Got None unknowns list from parser." if "--verbose" in sys.argv: print("Got " + str(len(errors)) + " errors and " + str(len(unknowns)) + " unknowns.") print("Errors:") for error in errors: print(str(error)) print("unknowns:")