def child_task(self, q, l, gq, gl): '''child process - this holds GUI elements''' mp_util.child_close_fds() import wx self.app = wx.PySimpleApp() self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None, id=wx.ID_ANY) self.app.frame.set_event_queue(q) self.app.frame.set_event_queue_lock(l) self.app.frame.set_gui_event_queue(gq) self.app.frame.set_gui_event_queue_lock(gl) self.app.frame.Show() self.app.MainLoop()
def child_task(self, q, l, gq, gl): '''child process - this holds GUI elements''' mp_util.child_close_fds() from ..lib import wx_processguard from ..lib.wx_loader import wx from MAVProxy.modules.mavproxy_misseditor import missionEditorFrame self.app = wx.App(False) self.app.frame = missionEditorFrame.MissionEditorFrame(parent=None, id=wx.ID_ANY) self.app.frame.set_event_queue(q) self.app.frame.set_event_queue_lock(l) self.app.frame.set_gui_event_queue(gq) self.app.frame.set_gui_event_queue_lock(gl) self.app.frame.Show() self.app.MainLoop()
def child_task(self, q, l, gq, gl, cw_sem): '''child process - this holds GUI elements''' mp_util.child_close_fds() from MAVProxy.modules.lib import wx_processguard from ..lib.wx_loader import wx from MAVProxy.modules.mavproxy_misseditor import missionEditorFrame self.app = wx.App(False) self.app.frame = missionEditorFrame.MissionEditorFrame(self, parent=None, id=wx.ID_ANY) self.app.frame.set_event_queue(q) self.app.frame.set_event_queue_lock(l) self.app.frame.set_gui_event_queue(gq) self.app.frame.set_gui_event_queue_lock(gl) self.app.frame.set_close_window_semaphore(cw_sem) self.app.SetExitOnFrameDelete(True) self.app.frame.Show() # start a thread to monitor the "close window" semaphore: class CloseWindowSemaphoreWatcher(threading.Thread): def __init__(self, task, sem): threading.Thread.__init__(self) self.task = task self.sem = sem def run(self): self.sem.acquire(True) self.task.app.ExitMainLoop() watcher_thread = CloseWindowSemaphoreWatcher(self, cw_sem) watcher_thread.start() self.app.MainLoop() # tell the watcher it is OK to quit: cw_sem.release() watcher_thread.join()