]>
git.sthu.org Git - pygdb.git/blob - MainControlWindow.py
0b5c3f11413e36067c55c373fbb625a63d20d8ca
14 import ClientIOTerminal
17 class MainControlWindow (gtk
.Window
):
19 def __init__(self
, dbgterm
):
22 gtk
.Window
.__init
__(self
)
23 self
.connect("destroy", DbgTerminal
.quitHandler
)
25 dbgterm
.gotActiveCallback
+= [self
.enableButtons
]
26 dbgterm
.gotInactiveCallback
+= [self
.disableButtons
]
29 self
.dbgterm
= dbgterm
30 self
.clientioterm
= ClientIOTerminal
.ClientIOTerminal(self
.dbgterm
.client_ptymaster
)
32 #Set title and add terminal
33 self
.set_title("Main Control")
34 self
.set_border_width(5)
37 #Vertical box. Top: Buttons, Bottom: Terminal vpane
38 vbox
= gtk
.VBox(False,5)
42 hbtnbox
= gtk
.HBox(False, spacing
=5)
43 #hbtnbox.set_layout(gtk.BUTTONBOX_START)
44 vbox
.pack_start(hbtnbox
)
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
)
57 #Vertical pane for terminals
59 vbox
.pack_start(vpaned
, True, True)
60 vpaned
.add(self
.dbgterm
)
61 vpaned
.add(self
.clientioterm
)
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
)
78 def runBtnClicked(self
, btn
):
79 pos
= self
.dbgterm
.setRun()
81 def continueBtnClicked(self
, btn
):
82 pos
= self
.dbgterm
.setContinue()
84 def stepoverBtnClicked(self
, btn
):
85 pos
= self
.dbgterm
.setStepover()
87 def stepinBtnClicked(self
, btn
):
88 pos
= self
.dbgterm
.setStepin()
90 def quitBtnClicked(self
, btn
):
91 self
.dbgterm
.setQuit()
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
)
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
)