X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=pygdb.py;h=d3cf2690d478bec972ca7fd70cd696d1bf320fe4;hb=fd54ea4a2710afa2bd51e2b8600c4577bdfccc0d;hp=e6c1dbccb64a0d29ada143869b91c4917fcce1aa;hpb=1a0bc6a0b5ed8f42aca890ff0ebc4adb8831b6fc;p=pygdb.git diff --git a/pygdb.py b/pygdb.py index e6c1dbc..d3cf269 100755 --- a/pygdb.py +++ b/pygdb.py @@ -4,6 +4,7 @@ __author__ = "shuber" import gtk +import os import string import sys @@ -12,6 +13,37 @@ import MainControlWindow import StatusWindow +def launchDebugger(clientCmd, quitonclose=True): + + + + def hideWindows(): + #Kill the debugger + dbgterm.stopDbg() + + mainCtrlWnd.destroy() + statusWnd.destroy() + gtk.main_quit() + + + #Determine the closing callback func + if quitonclose: + destroycb = gtk.main_quit + else: + destroycb = hideWindows + + #Create Terminal + dbgterm = GdbTerminal.GdbTerminal(clientCmd, destroycb) + + #Create windows + mainCtrlWnd = MainControlWindow.MainControlWindow(dbgterm, destroycb) + statusWnd = StatusWindow.StatusWindow(mainCtrlWnd, dbgterm, destroycb) + dbgterm.initialize() + + return dbgterm, mainCtrlWnd, statusWnd + + + if __name__ == "__main__": #Check if enough arguments are given @@ -21,16 +53,7 @@ if __name__ == "__main__": #Create the terminals clientCmd = string.join(sys.argv[1:]) - dbgterm = GdbTerminal.GdbTerminal(clientCmd) - - #Create windows - mainCtrlWnd = MainControlWindow.MainControlWindow(dbgterm) - statusWnd = StatusWindow.StatusWindow(mainCtrlWnd, dbgterm) - - #Register callback function for new positions - mainCtrlWnd.newPosCbs += [statusWnd.updateValues] - + launchDebugger(clientCmd) gtk.main() -