37 |
class DebugSession: |
class DebugSession: |
38 |
def __init__(self, caller): |
def __init__(self, caller): |
39 |
self.caller = caller |
self.caller = caller |
40 |
outputWindow = wxFrame(caller, -1, "Console Output", |
outputWindow = wxFrame(caller, -1, _("Console Output"), |
41 |
size=wxSize(300,50)) |
size=wxSize(300,50)) |
42 |
outputWindow.text = wxTextCtrl(outputWindow, -1, style=wxTE_MULTILINE) |
outputWindow.text = wxTextCtrl(outputWindow, -1, style=wxTE_MULTILINE) |
43 |
outputWindow.Show(true) |
outputWindow.Show(true) |
50 |
self._saveexit = sys.exit |
self._saveexit = sys.exit |
51 |
sys.exit = self.debugClosing |
sys.exit = self.debugClosing |
52 |
debugInstance = DebugInstance(caller._app) |
debugInstance = DebugInstance(caller._app) |
53 |
debugInstance.setForm(GFParser.loadForm(StringIO(caller.rootObject.dumpXML(treeDump=1)), debugInstance)) |
debugInstance.setForm(GFParser.loadFile(StringIO(caller.rootObject.dumpXML(treeDump=1)), debugInstance)) |
54 |
debugInstance.activate() |
debugInstance.activate() |
55 |
debugInstance._ui._debuginstance = self |
debugInstance._ui._debuginstance = self |
56 |
except: |
except: |
57 |
self.sanityCheck() |
self.sanityCheck() |
58 |
raise |
raise |
59 |
self.outputWindow.text.AppendText('\n---- Form Closed Abruptly ----') |
self.outputWindow.text.AppendText(_('\n---- Form Closed Abruptly ----')) |
60 |
|
|
61 |
def debugClosing(self): |
def debugClosing(self): |
62 |
self.sanityCheck() |
self.sanityCheck() |
63 |
self.outputWindow.text.AppendText('\n---- Form Closed ----') |
self.outputWindow.text.AppendText(_('\n---- Form Closed ----')) |
64 |
|
|
65 |
def sanityCheck(self): |
def sanityCheck(self): |
66 |
self.stdoutcatcher.restore() |
self.stdoutcatcher.restore() |