18 class PositionFrame (StatusFrame
.StatusFrame
):
21 def __init__(self
, debugger
):
23 StatusFrame
.StatusFrame
.__init
__(self
, debugger
)
24 self
.set_label("Position")
26 debugger
.gotActiveCallback
+= [self
.updateValues
]
27 debugger
.gotInactiveCallback
+= [self
.updateValues
]
32 vbox
= gtk
.VBox(False, 5)
35 hbox
= gtk
.HBox(False, 10)
36 vbox
.pack_start(hbox
, False, False)
37 self
.openBtn
= gtk
.Button(":e")
38 hbox
.pack_start(self
.openBtn
, False, False)
39 self
.positionLabel
= gtk
.Label()
40 hbox
.pack_start(self
.positionLabel
, False, False)
42 sw
= gtk
.ScrolledWindow()
43 sw
.set_shadow_type(gtk
.SHADOW_ETCHED_IN
)
44 sw
.set_policy(gtk
.POLICY_AUTOMATIC
, gtk
.POLICY_AUTOMATIC
)
47 self
.srcview
= gtk
.TextView()
50 self
.openBtn
.connect("clicked", self
.openBtnClicked
)
53 def openBtnClicked(self
, btn
):
55 if not self
.debugger
.isActive():
60 cmd
= 'gvim --servername pygdb -c ":GDBLoadConfig" %s' % (self
.file)
63 dialog
= gtk
.MessageDialog(None, \
64 gtk
.DIALOG_MODAL | gtk
.DIALOG_DESTROY_WITH_PARENT
, \
65 gtk
.MESSAGE_ERROR
, gtk
.BUTTONS_OK
, \
66 "Error calling editor with '%s'." % cmd
)
71 def updateValues(self
, status
, param
):
73 #Create new text buffer for source view
74 buf
= gtk
.TextBuffer()
77 self
.file, self
.lineno
= param
78 self
.positionLabel
.set_label("%s:%d" % (self
.file, self
.lineno
))
81 code
= self
.debugger
.listCodeSnippet()
86 self
.file, self
.lineno
= None, None
89 if status
== "exited":
90 self
.positionLabel
.set_label("Exited with code %d." % param
)
91 elif status
== "started":
92 self
.positionLabel
.set_label("Started.")
93 elif status
== "continued":
94 self
.positionLabel
.set_label("Continued.")
96 self
.positionLabel
.set_label(status
)
100 self
.srcview
.set_buffer(buf
)
105 def applyConfiguration(self
, conf
):
108 def fillConfiguration(self
, conf
):
109 conf
.setCurrpos(self
.file, self
.lineno
)