new exciting GTK Main Control Window
[pygdb.git] / DbgWindow.py
index 6f46c6c0091e8e305ca4228ccf679c4368d460c4..aa073ffbd849ae810dd796e3ef7bc212436034b4 100755 (executable)
@@ -11,130 +11,6 @@ import time
 import threading
 import vte
 
-import ClientIOWindow
-
-
-class DbgWindow (gtk.Window):
-
-       clientIOWnd = None
-       lastrow = 0
-       history = []
-
-       
-
-       def __init__(self, clientCmd):
-
-               #Set up some members
-               self.clientCmd = clientCmd
-
-               #Set up GTK stuff
-               gtk.Window.__init__(self)
-               self.connect("destroy", lambda *w: gtk.main_quit())
-
-               #Set title and add terminal
-               self.set_title("Debugger I/O")
-               self.terminal = vte.Terminal()
-               self.terminal.history = []
-               self.terminal.history_length = 5
-               self.add(self.terminal)
-
-               #Set up terminal window and initialize debugger
-               self.terminal.connect("child-exited", lambda *w: gtk.main_quit())
-               self.terminal.connect("cursor-moved", self.contents_changed)
-               self._initializeDbg()
-
-               #Show the window
-               self.show_all()
-
-
-       def _initializeDbg(self):
-
-               #Start debugger
-               self.terminal.fork_command( self.getDbgCommand(), self.getDbgArgv())
-
-               #Open pseudo-terminal where to-be-debugged process reads/writes to
-               self.client_ptymaster, self.client_ptyslave = pty.openpty()
-               self.setDbgPty(self.client_ptyslave)
-
-
-       def contents_changed(self, term):
-               c,r = term.get_cursor_position()
-
-               if self.lastrow < r:
-                       text = self.terminal.get_text_range(self.lastrow,0,r-1,-1,lambda *w:True)
-                       self.history += string.split(text, "\n")
-                       self.lastrow = r
-
-       def waitForDbgNewline(self):
-               r = self.lastrow
-               while not self.lastrow > r:
-                       gtk.main_iteration()
-
-       def waitForDbgRx(self, rx):             
-               while True:
-                       start = len(self.history)
-                       gtk.main_iteration()
-
-                       for line in self.history[start:]:
-                               if rx.search(line):
-                                       return line
-
-
-       def getDbgCommand(self):
-               return self.getDbgArgv()[0];
-
-       def getDbgArgv(self):
-               raise NotImplementedError()
-
-       def setDbgPty(self, pty):
-               raise NotImplementedError()
-
-       def setDbgRun(self):
-               raise NotImplementedError()
-
-       def setDbgQuit(self):
-               raise NotImplementedError()
-
-       def setDbgContinue(self):
-               raise NotImplementedError()
-
-       def setDbgBreakpoint(self, file, lineno):
-               raise NotImplementedError()
-
-       def getDbgExpression(self, expr):
-               raise NotImplementedError()
-
-       def getDbgLastLine(self):
-               if len(self.history) == 0:
-                       return None
-
-               return self.history[-1]
-
-       def feed_dbg(self, text):
-               self.terminal.feed_child(text)
-
-
-       def showClientIOWindow(self):
-               if not self.clientIOWnd:
-                       self.clientIOWnd = ClientIOWindow.ClientIOWindow(self, self.client_ptymaster)
-       
-
-
-
-def launchDebugger(wnd):
-
-       wnd.showClientIOWindow()
-
-       wnd.setDbgBreakpoint("main.cpp", 15)
-       wnd.setDbgRun()
-       res = wnd.getDbgExpression("a")
-       print "Result = ", res
-
-       wnd.setDbgQuit()
-
-       gtk.main()
-
-
-
+import DbgTerminal