]>
git.sthu.org Git - pygdb.git/blob - MainControlWindow.py
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
.stepoutBtn
= gtk
.Button("Step Out")
55 hbtnbox
.add(self
.stepoutBtn
)
56 self
.quitBtn
= gtk
.Button("Quit")
57 hbtnbox
.add(self
.quitBtn
)
59 #Vertical pane for terminals
61 vbox
.pack_start(vpaned
, True, True)
62 vpaned
.add(self
.dbgterm
)
63 vpaned
.add(self
.clientioterm
)
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
)
81 def runBtnClicked(self
, btn
):
82 pos
= self
.dbgterm
.setRun()
84 def continueBtnClicked(self
, btn
):
85 pos
= self
.dbgterm
.setContinue()
87 def stepoverBtnClicked(self
, btn
):
88 pos
= self
.dbgterm
.setStepover()
90 def stepinBtnClicked(self
, btn
):
91 pos
= self
.dbgterm
.setStepin()
93 def stepoutBtnClicked(self
, btn
):
94 pos
= self
.dbgterm
.setStepout()
96 def quitBtnClicked(self
, btn
):
97 self
.dbgterm
.setQuit()
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
)
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
)