]> git.sthu.org Git - pygdb.git/blob - StatusWindow.py
change from BufRead to Filetype in install notes
[pygdb.git] / StatusWindow.py
1 #!/usr/bin/python
2 #shuber, 2008-06-04
3
4 __author__ = "shuber"
5
6
7 import gtk
8 import re
9 import string
10 import os
11 import vte
12
13 import Configuration
14 import DbgTerminal
15 import BreakpointsFrame
16 import PositionFrame
17 import WatchesFrame
18
19
20
21 class StatusWindow (gtk.Window):
22
23 def __init__(self, debugger):
24 gtk.Window.__init__(self)
25
26 self.debugger = debugger
27 self.debugger.gotActiveCallback += [self.updateValues]
28
29 self.set_border_width(5)
30 self.set_title("Status")
31 self.set_default_size(400,600)
32 self.connect("destroy", DbgTerminal.quitHandler)
33
34
35 #Vbox container of frames
36 vbox = gtk.VBox(False, 5)
37 self.add(vbox)
38
39
40 #Adding the frames
41 self.frames = []
42 self.frames += [PositionFrame.PositionFrame(debugger), \
43 WatchesFrame.WatchesFrame(debugger), \
44 BreakpointsFrame.BreakpointsFrame(debugger) ]
45
46 #Register callback after frames!
47 self.debugger.gotActiveCallback += [self.updateValues]
48
49 #First paned window
50 self.paned1 = gtk.VPaned()
51 vbox.add(self.paned1)
52 #Second one
53 self.paned2 = gtk.VPaned()
54 self.paned1.add2(self.paned2)
55
56 self.paned1.add1(self.frames[1])
57 self.paned2.add1(self.frames[2])
58 self.paned2.add2(self.frames[0])
59
60 self.show_all()
61
62
63 def applyConfiguration(self, conf):
64
65 w = conf.findInt("statuswnd-width")
66 h = conf.findInt("statuswnd-height")
67 paned1 = conf.findInt("statuswnd-paned1")
68 paned2 = conf.findInt("statuswnd-paned2")
69
70 if w!=None and h!=None:
71 self.resize(w,h)
72 if paned1!=None:
73 self.paned1.set_position(paned1)
74 if paned2!=None:
75 self.paned2.set_position(paned2)
76
77
78 while not self.debugger.isActive():
79 gtk.main_iteration()
80
81 for f in self.frames:
82 f.applyConfiguration(conf)
83
84
85 def fillConfiguration(self, conf):
86
87 conf.addInt("statuswnd-width", self.get_size()[0])
88 conf.addInt("statuswnd-height", self.get_size()[1])
89 conf.addInt("statuswnd-paned1", self.paned1.get_position())
90 conf.addInt("statuswnd-paned2", self.paned2.get_position())
91
92 for f in self.frames:
93 f.fillConfiguration(conf)
94
95
96 def updateValues(self, status, param):
97
98 conf = Configuration.Configuration()
99 self.fillConfiguration(conf)
100 conf.store(".pygdb.conf")
101
102 DbgTerminal.updateVim()
103
104
105