]> git.sthu.org Git - pygdb.git/blob - StatusWindow.py
new feature request
[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, vimservername):
24 gtk.Window.__init__(self)
25
26 self.vimservername = vimservername
27 self.debugger = debugger
28 self.debugger.gotActiveCallback += [self.updateValues]
29
30 self.set_border_width(5)
31 self.set_title("Status")
32 self.set_default_size(400,600)
33 self.connect("destroy", DbgTerminal.quitHandler)
34
35
36 #Vbox container of frames
37 vbox = gtk.VBox(False, 5)
38 self.add(vbox)
39
40
41 #Adding the frames
42 self.frames = []
43 self.frames += [PositionFrame.PositionFrame(debugger), \
44 WatchesFrame.WatchesFrame(debugger), \
45 BreakpointsFrame.BreakpointsFrame(debugger) ]
46
47 #Register callback after frames!
48 self.debugger.gotActiveCallback += [self.updateValues]
49
50 #First paned window
51 self.paned1 = gtk.VPaned()
52 vbox.add(self.paned1)
53 #Second one
54 self.paned2 = gtk.VPaned()
55 self.paned1.add2(self.paned2)
56
57 self.paned1.add1(self.frames[1])
58 self.paned2.add1(self.frames[2])
59 self.paned2.add2(self.frames[0])
60
61 self.show_all()
62
63
64 def applyConfiguration(self, conf):
65
66 w = conf.findInt("statuswnd-width")
67 h = conf.findInt("statuswnd-height")
68 paned1 = conf.findInt("statuswnd-paned1")
69 paned2 = conf.findInt("statuswnd-paned2")
70
71 if w!=None and h!=None:
72 self.resize(w,h)
73 if paned1!=None:
74 self.paned1.set_position(paned1)
75 if paned2!=None:
76 self.paned2.set_position(paned2)
77
78
79 while not self.debugger.isActive():
80 gtk.main_iteration()
81
82 for f in self.frames:
83 f.applyConfiguration(conf)
84
85
86 def fillConfiguration(self, conf):
87
88 conf.addInt("statuswnd-width", self.get_size()[0])
89 conf.addInt("statuswnd-height", self.get_size()[1])
90 conf.addInt("statuswnd-paned1", self.paned1.get_position())
91 conf.addInt("statuswnd-paned2", self.paned2.get_position())
92
93 conf.setCommand( self.debugger.clientCmd )
94
95 for f in self.frames:
96 f.fillConfiguration(conf)
97
98
99 def updateValues(self, status, param):
100
101 conf = Configuration.Configuration()
102 self.fillConfiguration(conf)
103 conf.store(".pygdb.conf")
104
105 self.updateVim()
106
107
108 def updateVim(self):
109
110 os.system('gvim --servername %s --remote-send "<ESC> :GDBLoadConfig<CR>"' % \
111 self.vimservername)
112
113