From 104bb121bd7c3433a5e46c9b86e211b9544ea288 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Mon, 9 Jun 2008 21:44:20 +0200 Subject: [PATCH] new feature: selecting on breakpoint sets entry-ctrl-text --- BreakpointsFrame.py | 77 ++++++++++++++++++++++++++------------------- StatusWindow.py | 1 - WatchesFrame.py | 2 +- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/BreakpointsFrame.py b/BreakpointsFrame.py index 3093fbb..1a24574 100644 --- a/BreakpointsFrame.py +++ b/BreakpointsFrame.py @@ -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) diff --git a/StatusWindow.py b/StatusWindow.py index 4a08b54..c6c29cf 100644 --- a/StatusWindow.py +++ b/StatusWindow.py @@ -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: diff --git a/WatchesFrame.py b/WatchesFrame.py index 10a4695..cfcd14a 100644 --- a/WatchesFrame.py +++ b/WatchesFrame.py @@ -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) -- 2.30.2