]> git.sthu.org Git - pygdb.git/blob - MainControlWindow.py
change from BufRead to Filetype in install notes
[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.stepoutBtn = gtk.Button("Step Out")
55 hbtnbox.add(self.stepoutBtn)
56 self.quitBtn = gtk.Button("Quit")
57 hbtnbox.add(self.quitBtn)
58
59 #Vertical pane for terminals
60 vpaned = gtk.VPaned()
61 vbox.pack_start(vpaned, True, True)
62 vpaned.add(self.dbgterm)
63 vpaned.add(self.clientioterm)
64
65
66 #Install handlers
67 self.runBtnHandler = self.runBtn.connect('clicked', self.runBtnClicked)
68 self.continueBtnHandler = self.continueBtn.connect('clicked', \
69 self.continueBtnClicked)
70 self.stepoverBtnHandler = self.stepoverBtn.connect('clicked', \
71 self.stepoverBtnClicked)
72 self.stepinBtnHandler = self.stepinBtn.connect('clicked', self.stepinBtnClicked)
73 self.stepoutBtnHandler = self.stepoutBtn.connect('clicked', self.stepoutBtnClicked)
74 self.quitBtnHandler = self.quitBtn.connect('clicked', self.quitBtnClicked)
75
76 #Show the window
77 self.show_all()
78
79
80
81 def runBtnClicked(self, btn):
82 pos = self.dbgterm.setRun()
83
84 def continueBtnClicked(self, btn):
85 pos = self.dbgterm.setContinue()
86
87 def stepoverBtnClicked(self, btn):
88 pos = self.dbgterm.setStepover()
89
90 def stepinBtnClicked(self, btn):
91 pos = self.dbgterm.setStepin()
92
93 def stepoutBtnClicked(self, btn):
94 pos = self.dbgterm.setStepout()
95
96 def quitBtnClicked(self, btn):
97 self.dbgterm.setQuit()
98
99 def disableButtons(self, *w):
100 self.runBtn.handler_block(self.runBtnHandler)
101 self.continueBtn.handler_block(self.continueBtnHandler)
102 self.stepoverBtn.handler_block(self.stepoverBtnHandler)
103 self.stepinBtn.handler_block(self.stepinBtnHandler)
104 self.stepoutBtn.handler_block(self.stepoutBtnHandler)
105 self.quitBtn.handler_block(self.quitBtnHandler)
106
107 def enableButtons(self, *w):
108 self.runBtn.handler_unblock(self.runBtnHandler)
109 self.continueBtn.handler_unblock(self.continueBtnHandler)
110 self.stepoverBtn.handler_unblock(self.stepoverBtnHandler)
111 self.stepinBtn.handler_unblock(self.stepinBtnHandler)
112 self.stepoutBtn.handler_unblock(self.stepoutBtnHandler)
113 self.quitBtn.handler_unblock(self.quitBtnHandler)
114