allow clicking to set a breakpoint

Clicking in the left gutter of the source window will set a
breakpoint.  Currently the effect of this is somewhat invisible,
because there is no way for the GUI to notice when breakpoints
are created.
This commit is contained in:
Tom Tromey
2013-06-14 12:04:16 -06:00
parent 295c006fa0
commit 7020755290
2 changed files with 15 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ import gui.startup
import os.path
import gui.toplevel
from gi.repository import Gtk, GtkSource, GObject
from gi.repository import Gtk, GtkSource, GObject, Gdk
class BufferManager:
def __init__(self):
@@ -45,6 +45,7 @@ class BufferManager:
buff.set_text(contents)
buff.end_not_undoable_action()
buff.set_modified(False)
buff.filename = filename
self.buffers[filename] = buff
return buff
@@ -168,6 +169,15 @@ class SourceWindow(Toplevel):
def deleted(self, widget, event):
lru_handler.remove(self)
def line_mark_activated(self, view, textiter, event):
if event.type != Gdk.EventType.BUTTON_PRESS:
return
if event.button.get_button()[1] != 1:
return
fun = Invoker("break %s:%d" % (self.view.get_buffer().filename,
textiter.get_line() + 1))
fun()
def _do_scroll(self, buff, srcline):
buff.place_cursor(buff.get_iter_at_line(srcline))
self.view.scroll_mark_onscreen(buff.get_insert())