def do_init(): # create them... resources = Resources(settings, ndbg.get_basedir()) global _mc mw = MainWindow(settings, resources) def run_load_cb(): log2("UI init: running on_load callback") if load_cb: load_cb(_mc) return False # ensure the timeout is a one-time thing def on_ready(*args): log2("UI init: window shown, scheduling load in 200ms") MessageLoop.add_delayed_message(run_load_cb, 200) if load_cb: mw.connect('show', on_ready) settings.set_delayed_save(True) _mc = MainControl(settings, mw)
def on_accept_launch(self, proc_id): proc = remove_first(self._launchable_processes, lambda proc: proc.id == proc_id) log1("%s accepted: ", proc.mc) # remove other launchable processes for p2 in self._launchable_processes: p2.mc.remove_launchable_process(p2.id) del self._launchable_processes[:] # launch the process launcher_exe = os.path.abspath(os.path.join(ndbg.get_basedir(), "launcher/ndbg_launcher")) if os.path.exists(launcher_exe): self._proc = subprocess.Popen([launcher_exe] + self._launch_cmd.ExecLaunch) else: print "Could not find ndbg_launcher binary. It should be in $NDBG_DIR/launcher, but you have to compile it first!" print "ndbg_in_existing will still work, but will not be able to debug startup." self._proc = subprocess.Popen(self._launch_cmd.ExecLaunch) log2("Launched locally as pid=%i", self._proc.pid) def send_launch_complete(): proc.mc.attach_to_launched_pid(self._proc.pid) MessageLoop.add_message(send_launch_complete)