]> git.sthu.org Git - pygdb.git/blob - MainControlWindow.py
0b5c3f11413e36067c55c373fbb625a63d20d8ca
[pygdb.git] / MainControlWindow.py
1 #!/usr/bin/python
2 #shuber, 2008-06-04
3
4 __author__ = "shuber"
5
6
7 import gtk
8 import string
9 import sys
10 import vte
11
12
13 import DbgTerminal
14 import ClientIOTerminal
15
16
17 class MainControlWindow (gtk.Window):
18
19 def __init__(self, dbgterm):
20
21 #Set up GTK stuff
22 gtk.Window.__init__(self)
23 self.connect("destroy", DbgTerminal.quitHandler )
24
25 dbgterm.gotActiveCallback += [self.enableButtons]
26 dbgterm.gotInactiveCallback += [self.disableButtons]
27
28 #Set terminals
29 self.dbgterm = dbgterm
30 self.clientioterm = ClientIOTerminal.ClientIOTerminal(self.dbgterm.client_ptymaster)
31
32 #Set title and add terminal
33 self.set_title("Main Control")
34 self.set_border_width(5)
35
36
37 #Vertical box. Top: Buttons, Bottom: Terminal vpane
38 vbox = gtk.VBox(False,5)
39 self.add(vbox)
40
41 #Button box
42 hbtnbox = gtk.HBox(False, spacing=5)
43 #hbtnbox.set_layout(gtk.BUTTONBOX_START)
44 vbox.pack_start(hbtnbox)
45
46 self.runBtn = gtk.Button("Run")
47 hbtnbox.add(self.runBtn)
48 self.continueBtn = gtk.Button("Continue")
49 hbtnbox.add(self.continueBtn)
50 self.stepoverBtn = gtk.Button("Step Over")
51 hbtnbox.add(self.stepoverBtn)
52 self.stepinBtn = gtk.Button("Step In")
53 hbtnbox.add(self.stepinBtn)
54 self.quitBtn = gtk.Button("Quit")
55 hbtnbox.add(self.quitBtn)
56
57 #Vertical pane for terminals
58 vpaned = gtk.VPaned()
59 vbox.pack_start(vpaned, True, True)
60 vpaned.add(self.dbgterm)
61 vpaned.add(self.clientioterm)
62
63
64 #Install handlers
65 self.runBtnHandler = self.runBtn.connect('clicked', self.runBtnClicked)
66 self.continueBtnHandler = self.continueBtn.connect('clicked', \
67 self.continueBtnClicked)
68 self.stepoverBtnHandler = self.stepoverBtn.connect('clicked', \
69 self.stepoverBtnClicked)
70 self.stepinBtnHandler = self.stepinBtn.connect('clicked', self.stepinBtnClicked)
71 self.quitBtnHandler = self.quitBtn.connect('clicked', self.quitBtnClicked)
72
73 #Show the window
74 self.show_all()
75
76
77
78 def runBtnClicked(self, btn):
79 pos = self.dbgterm.setRun()
80
81 def continueBtnClicked(self, btn):
82 pos = self.dbgterm.setContinue()
83
84 def stepoverBtnClicked(self, btn):
85 pos = self.dbgterm.setStepover()
86
87 def stepinBtnClicked(self, btn):
88 pos = self.dbgterm.setStepin()
89
90 def quitBtnClicked(self, btn):
91 self.dbgterm.setQuit()
92
93 def disableButtons(self, *w):
94 self.runBtn.handler_block(self.runBtnHandler)
95 self.continueBtn.handler_block(self.continueBtnHandler)
96 self.stepoverBtn.handler_block(self.stepoverBtnHandler)
97 self.stepinBtn.handler_block(self.stepinBtnHandler)
98 self.quitBtn.handler_block(self.quitBtnHandler)
99
100 def enableButtons(self, *w):
101 self.runBtn.handler_unblock(self.runBtnHandler)
102 self.continueBtn.handler_unblock(self.continueBtnHandler)
103 self.stepoverBtn.handler_unblock(self.stepoverBtnHandler)
104 self.stepinBtn.handler_unblock(self.stepinBtnHandler)
105 self.quitBtn.handler_unblock(self.quitBtnHandler)
106