From 101eafe13e746f2a95d0d91ca3e0e7b30ebfdb7d Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 3 Sep 2005 10:07:34 +0000 Subject: [PATCH] Double-click on a line in the stacktrace display of the debug box to open the source code in Edit. git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/ROX-Lib2@4158 66de3db3-b00d-0410-b41b-f4738ad19bea --- Help/Errors | 3 +++ python/rox/debug.py | 23 +++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Help/Errors b/Help/Errors index 7d367b6..8420ac1 100644 --- a/Help/Errors +++ b/Help/Errors @@ -56,6 +56,9 @@ frame. The stack trace also shows the file and line number of the instruction in each function that was being executed (for all but the last one, this is the instruction that called the function on the line below). +Double-click on a line in the stack trace to load the source file into Edit, +with the cursor on that line. + If after looking at all this information you still don't understand what the problem is, click on Bug Report and save the stack trace somewhere, then email it to the author of the program. diff --git a/python/rox/debug.py b/python/rox/debug.py index 324b6c0..b5e38bf 100644 --- a/python/rox/debug.py +++ b/python/rox/debug.py @@ -103,10 +103,11 @@ def show_exception(type, value, tb, auto_details = False): class ExceptionExplorer(g.Frame): """Displays details from a traceback object.""" - FILE = 0 + LEAF = 0 LINE = 1 FUNC = 2 CODE = 3 + FILE = 4 def __init__(self, tb): g.Frame.__init__(self, _('Stack trace (innermost last)')) @@ -122,13 +123,14 @@ class ExceptionExplorer(g.Frame): self.tb = tb self.model = g.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT, - gobject.TYPE_STRING, gobject.TYPE_STRING) + gobject.TYPE_STRING, gobject.TYPE_STRING, + gobject.TYPE_STRING) tree = g.TreeView(self.model) inner.add(tree) cell = g.CellRendererText() - column = g.TreeViewColumn('File', cell, text = ExceptionExplorer.FILE) + column = g.TreeViewColumn('File', cell, text = ExceptionExplorer.LEAF) cell.set_property('xalign', 1) tree.append_column(column) @@ -162,13 +164,14 @@ class ExceptionExplorer(g.Frame): name = co.co_name line = linecache.getline(filename, lineno).strip() - filename = os.path.basename(filename) + leafname = os.path.basename(filename) new = self.model.append() - self.model.set(new, ExceptionExplorer.FILE, filename, + self.model.set(new, ExceptionExplorer.LEAF, leafname, ExceptionExplorer.LINE, lineno, ExceptionExplorer.FUNC, name, - ExceptionExplorer.CODE, line) + ExceptionExplorer.CODE, line, + ExceptionExplorer.FILE, filename) def selected_frame(): selected = sel.get_selected() @@ -189,6 +192,14 @@ class ExceptionExplorer(g.Frame): new = vars.append() vars.set(new, 0, str(n), 1, value) sel.connect('changed', select_frame) + def show_source(tree, path, column): + line = self.model[path][ExceptionExplorer.LINE] + file = self.model[path][ExceptionExplorer.FILE] + import launch + launch.launch('http://rox.sourceforge.net/2005/interfaces/Edit', + '-l%d' % line, file) + + tree.connect('row-activated', show_source) # Area to show the local variables tree = g.TreeView(vars) -- 2.11.4.GIT