13 import BreakpointsFrame
18 class StatusWindow (gtk
.Window
):
20 def __init__(self
, mainctrlwnd
, debugger
):
22 gtk
.Window
.__init
__(self
)
23 self
.debugger
= debugger
25 self
.set_border_width(5)
26 self
.set_title("Status")
27 self
.set_default_size(400,600)
28 self
.connect("destroy", lambda *w
: gtk
.main_quit())
30 vbox
= gtk
.VBox(False, 5)
33 hbox
= gtk
.HBox(False, 5)
34 vbox
.pack_start(hbox
, False, False)
36 self
.viewBtn
= gtk
.Button("View")
37 self
.viewBtn
.connect("clicked", self
.viewBtnClicked
)
38 hbox
.pack_start(self
.viewBtn
, False, False)
39 self
.status
= gtk
.Label("Not Running")
40 hbox
.pack_start(self
.status
, False, False)
42 self
.paned1
= gtk
.VPaned()
47 self
.frames
+= [WatchesFrame
.WatchesFrame(debugger
)]
48 self
.frames
+= [BreakpointsFrame
.BreakpointsFrame(debugger
)]
49 self
.paned1
.add1(self
.frames
[0])
50 self
.paned1
.add2(self
.frames
[1])
52 #Register callback function for new positions
53 #and update the values
54 mainctrlwnd
.newPosCbs
+= [self
.updateValues
]
59 def applyConfiguration(self
, conf
):
61 w
= conf
.findInt("statuswnd-width")
62 h
= conf
.findInt("statuswnd-height")
63 paned1
= conf
.findInt("statuswnd-paned1")
65 if w
!=None and h
!=None:
68 self
.paned1
.set_position(paned1
)
71 while not self
.debugger
.isActive():
75 f
.applyConfiguration(conf
)
78 def fillConfiguration(self
, conf
):
80 conf
.addInt("statuswnd-width", self
.get_size()[0])
81 conf
.addInt("statuswnd-height", self
.get_size()[1])
82 conf
.addInt("statuswnd-paned1", self
.paned1
.get_position())
85 f
.fillConfiguration(conf
)
88 def updateValues(self
, pos
):
91 self
.status
.set_text("Exited")
94 self
.status
.set_text("%s:%s" % (file, lineno
))
100 def viewBtnClicked(self
, btn
):
102 status
= self
.status
.get_label().strip()
103 rx
= re
.compile("\S+:\d+")
106 if rx
.search(status
):
108 [file,lineno
] = string
.split(status
,":")
111 os
.system('gvim -R -c ":%d" %s' % (lineno
,file))