new feature: selecting on breakpoint sets entry-ctrl-text
authorStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 19:44:20 +0000 (21:44 +0200)
committerStefan Huber <shuber2@gmail.com>
Mon, 9 Jun 2008 19:44:20 +0000 (21:44 +0200)
BreakpointsFrame.py
StatusWindow.py
WatchesFrame.py

index 3093fbbe18c047c2e44361dfa75a8d4c560732df..1a24574423477034bbcee8dbdc39139c8828f8e7 100644 (file)
@@ -49,6 +49,7 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
                self.tv = gtk.TreeView(self.model)
                self.tv.set_rules_hint(True)
                self.tv.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
+               self.tv.get_selection().connect("changed", self.selChanged)
 
                self.__addColumns(self.tv)      
                sw.add(self.tv)
@@ -85,40 +86,15 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
                tv.append_column(col)
 
 
+       def selChanged(self, sel):
+               model, paths = sel.get_selected_rows()
 
-       def addBtnClicked(self, btn):
-
-               if not self.debugger.isActive():
-                       return
-
-
-               bpspec = self.bpEntry.get_text()
-               bpspec = bpspec.strip()
-               rx = re.compile("^[\w\._\-]+:\d+(\s+if\s+\S+.*)?$")
-
-               #Check if format is correct
-               if not rx.search(bpspec):
-                       dialog = gtk.MessageDialog(None, \
-                               gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, \
-                               gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, \
-                               "Invalid format!") 
-                       dialog.run()
-                       dialog.destroy()
-                       return
-
-
-               ifsplit = string.split(bpspec, "if")
-
-               if len(ifsplit)>1:
-                       cond = ifsplit[1].strip()
-               else:
-                       cond = None
-
-               pos = ifsplit[0].strip()        
-               [file,lineno] = string.split(pos, ":")
+               if len(paths) > 0:
+                       path = paths[0]
+                       iter = model.get_iter(path)
+                       bpspec, = model.get(iter, 1)
+                       self.bpEntry.set_text(bpspec)
 
-               self.addBreakpoint(file, lineno, cond)
-       
 
 
        def addBreakpoint(self, file, lineno, cond=None):
@@ -159,6 +135,41 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
                        self.model.set(iter, 1, "%s:%s if %s" % (str(file), str(lineno), str(cond)))
 
 
+       def addBtnClicked(self, btn):
+
+               if not self.debugger.isActive():
+                       return
+
+
+               bpspec = self.bpEntry.get_text()
+               bpspec = bpspec.strip()
+               rx = re.compile("^[\w\._\-]+:\d+(\s+if\s+\S+.*)?$")
+
+               #Check if format is correct
+               if not rx.search(bpspec):
+                       dialog = gtk.MessageDialog(None, \
+                               gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, \
+                               gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, \
+                               "Invalid format!") 
+                       dialog.run()
+                       dialog.destroy()
+                       return
+
+
+               ifsplit = string.split(bpspec, "if")
+
+               if len(ifsplit)>1:
+                       cond = ifsplit[1].strip()
+               else:
+                       cond = None
+
+               pos = ifsplit[0].strip()        
+               [file,lineno] = string.split(pos, ":")
+
+               self.addBreakpoint(file, lineno, cond)
+
+
+
 
        def delBtnClicked(self, btn):
 
@@ -168,7 +179,7 @@ class BreakpointsFrame (StatusFrame.StatusFrame):
                selection = self.tv.get_selection()
                model, paths = selection.get_selected_rows()
 
-               for path in paths:
+               for path in reversed(paths):
                        iter = model.get_iter(path)
                        bpno, = self.model.get(iter, 0)
                        self.debugger.delBreakpoint(bpno)
index 4a08b54f068f771f801b9733fa2cdb50adaead6e..c6c29cfdedc61c74683962e93fddefbbcd952691 100644 (file)
@@ -52,7 +52,6 @@ class StatusWindow (gtk.Window):
                h = conf.findInt("statuswnd-height")
                paned1 = conf.findInt("statuswnd-paned1")
 
-               print w, h, paned1
                if w!=None and h!=None:
                        self.resize(w,h)
                if paned1!=None:
index 10a46950083440f130adfb45b216ac27586fe9b1..cfcd14a916cc700f16082ae5dca212d4c94ac10b 100644 (file)
@@ -112,7 +112,7 @@ class WatchesFrame (StatusFrame.StatusFrame):
                selection = self.tv.get_selection()
                model, paths = selection.get_selected_rows()
 
-               for path in paths:
+               for path in reversed(paths):
                        iter = model.get_iter(path)
                        model.remove(iter)