]> git.sthu.org Git - pygdb.git/commitdiff
add view file button
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:36:51 +0000 (22:36 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 20:36:51 +0000 (22:36 +0200)
StatusWindow.py

index c6c29cfdedc61c74683962e93fddefbbcd952691..72ee3caf712294439fcbd0eae4030a6e20035840 100644 (file)
@@ -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
+
+
+