From: Stefan Huber Date: Mon, 9 Jun 2008 20:36:51 +0000 (+0200) Subject: add view file button X-Git-Tag: v0.99.0~23 X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=3f09e7c00c7baa277245cf817bc70ed06fe81b1d;p=pygdb.git add view file button --- 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 + + +