From 3f09e7c00c7baa277245cf817bc70ed06fe81b1d Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Mon, 9 Jun 2008 22:36:51 +0200 Subject: [PATCH] add view file button --- StatusWindow.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/StatusWindow.py b/StatusWindow.py index c6c29cf..72ee3ca 100644 --- a/StatusWindow.py +++ b/StatusWindow.py @@ -5,6 +5,9 @@ __author__ = "shuber" import gtk +import re +import string +import os import vte import BreakpointsFrame @@ -27,8 +30,15 @@ class StatusWindow (gtk.Window): vbox = gtk.VBox(False, 5) self.add(vbox) + hbox = gtk.HBox(False, 5) + vbox.pack_start(hbox, False, False) + + self.viewBtn = gtk.Button("View") + self.viewBtn.connect("clicked", self.viewBtnClicked) + hbox.pack_start(self.viewBtn, False, False) self.status = gtk.Label("Not Running") - vbox.pack_start(self.status, False, False) + hbox.pack_start(self.status, False, False) + self.paned1 = gtk.VPaned() vbox.add(self.paned1) @@ -87,3 +97,21 @@ class StatusWindow (gtk.Window): f.updateValues(pos) + def viewBtnClicked(self, btn): + + status = self.status.get_label().strip() + rx = re.compile("\S+:\d+") + + #It is a path + if rx.search(status): + try: + [file,lineno] = string.split(status,":") + lineno = int(lineno) + + os.system('gvim -R -c ":%d" %s' % (lineno,file)) + + except OSError: + pass + + + -- 2.39.5