mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Add IsMainThread and use it in the PyOnDemandOutputWindow class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -419,6 +419,11 @@ def run():
|
||||
])
|
||||
|
||||
|
||||
module.addCppFunction('bool', 'IsMainThread', '()',
|
||||
doc="Returns True if the current thread is what wx considers the GUI thread.",
|
||||
body="return wxThread::IsMain();")
|
||||
|
||||
|
||||
module.addInitializerCode("""\
|
||||
wxPyPreInit(sipModuleDict);
|
||||
""")
|
||||
|
||||
@@ -270,12 +270,12 @@ def run():
|
||||
""",
|
||||
body="""\
|
||||
if self.frame is None:
|
||||
if not wx.Thread.IsMain():
|
||||
if not wx.IsMainThread():
|
||||
wx.CallAfter(self.CreateOutputWindow, text)
|
||||
else:
|
||||
self.CreateOutputWindow(text)
|
||||
else:
|
||||
if not wx.Thread.IsMain():
|
||||
if not wx.IsMainThread():
|
||||
wx.CallAfter(self.text.AppendText, text)
|
||||
else:
|
||||
self.text.AppendText(text)
|
||||
|
||||
Reference in New Issue
Block a user