More docstrings.

Fixed wxWave compilation on Linux.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-11-20 01:19:37 +00:00
parent ce8f00f30c
commit 6c3b4aae47
7 changed files with 484 additions and 268 deletions

View File

@@ -59,96 +59,133 @@ public:
void _setCallbackInfo(PyObject* self, PyObject* _class);
// set/get the application name
wxString GetAppName() const;
void SetAppName(const wxString& name);
// set/get the app class name
wxString GetClassName() const;
void SetClassName(const wxString& name);
DocDeclStr(
wxString, GetAppName() const,
"Get the application name.");
DocDeclStr(
void, SetAppName(const wxString& name),
"Set the application name. This value may be used automatically\n"
"by wxConfig and such.");
// set/get the vendor name
const wxString& GetVendorName() const;
void SetVendorName(const wxString& name);
DocDeclStr(
wxString, GetClassName() const,
"Get the application's class name.");
DocDeclStr(
void, SetClassName(const wxString& name),
"Set the application's class name. This value may be used for X-resources if\n"
"applicable for the platform");
// create the app traits object to which we delegate for everything which
// either should be configurable by the user (then he can change the
// default behaviour simply by overriding CreateTraits() and returning his
// own traits object) or which is GUI/console dependent as then wxAppTraits
// allows us to abstract the differences behind the common fa<EFBFBD>ade
wxAppTraits *GetTraits();
// process all events in the wxPendingEvents list -- it is necessary to
// call this function to process posted events. This happens during each
// event loop iteration.
virtual void ProcessPendingEvents();
// process all currently pending events right now
//
// it is an error to call Yield() recursively unless the value of
// onlyIfNeeded is True
//
// WARNING: this function is dangerous as it can lead to unexpected
// reentrancies (i.e. when called from an event handler it
// may result in calling the same event handler again), use
// with _extreme_ care or, better, don't use at all!
virtual bool Yield(bool onlyIfNeeded = False);
// make sure that idle events are sent again
virtual void WakeUpIdle();
DocDeclStr(
const wxString&, GetVendorName() const,
"Get the application's vendor name.");
DocDeclStr(
void, SetVendorName(const wxString& name),
"Set the application's vendor name. This value may be used automatically\n"
"by wxConfig and such.");
// execute the main GUI loop, the function returns when the loop ends
virtual int MainLoop();
// exit the main loop thus terminating the application
virtual void Exit();
// exit the main GUI loop during the next iteration (i.e. it does not
// stop the program immediately!)
virtual void ExitMainLoop();
// returns True if there are unprocessed events in the event queue
virtual bool Pending();
// process the first event in the event queue (blocks until an event
// apperas if there are none currently)
virtual bool Dispatch();
DocDeclStr(
wxAppTraits*, GetTraits(),
"Create the app traits object to which we delegate for everything which either\n"
"should be configurable by the user (then he can change the default behaviour\n"
"simply by overriding CreateTraits() and returning his own traits object) or\n"
"which is GUI/console dependent as then wxAppTraits allows us to abstract the\n"
"differences behind the common facade");
// this virtual function is called in the GUI mode when the application
// becomes idle and normally just sends wxIdleEvent to all interested
// parties
//
// it should return True if more idle events are needed, False if not
virtual bool ProcessIdle() ;
// Send idle event to window and all subwindows
// Returns True if more idle time is requested.
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
// Perform standard OnIdle behaviour: call from port's OnIdle
void OnIdle(wxIdleEvent& event);
DocDeclStr(
virtual void, ProcessPendingEvents(),
"Process all events in the wxPendingEvents list -- it is necessary to call this\n"
"function to process posted events. This happens during each event loop\n"
"iteration.");
// return True if our app has focus
virtual bool IsActive() const;
DocDeclStr(
virtual bool, Yield(bool onlyIfNeeded = False),
"Process all currently pending events right now, instead of waiting until\n"
"return to the event loop. It is an error to call Yield() recursively unless\n"
"the value of onlyIfNeeded is True.\n"
"\n"
"WARNING: This function is dangerous as it can lead to unexpected\n"
" reentrancies (i.e. when called from an event handler it\n"
" may result in calling the same event handler again), use\n"
" with _extreme_ care or, better, don't use at all!\n");
// set the "main" top level window
void SetTopWindow(wxWindow *win);
DocDeclStr(
virtual void, WakeUpIdle(),
"Make sure that idle events are sent again");
// return the "main" top level window (if it hadn't been set previously
// with SetTopWindow(), will return just some top level window and, if
// there are none, will return NULL)
virtual wxWindow *GetTopWindow() const;
// control the exit behaviour: by default, the program will exit the
// main loop (and so, usually, terminate) when the last top-level
// program window is deleted. Beware that if you disable this behaviour
// (with SetExitOnFrameDelete(False)), you'll have to call
// ExitMainLoop() explicitly from somewhere.
void SetExitOnFrameDelete(bool flag);
bool GetExitOnFrameDelete() const;
DocDeclStr(
virtual int, MainLoop(),
"Execute the main GUI loop, the function returns when the loop ends.");
DocDeclStr(
virtual void, Exit(),
"Exit the main loop thus terminating the application.");
DocDeclStr(
virtual void, ExitMainLoop(),
"Exit the main GUI loop during the next iteration (i.e. it does not\n"
"stop the program immediately!)");
DocDeclStr(
virtual bool, Pending(),
"Returns True if there are unprocessed events in the event queue.");
DocDeclStr(
virtual bool, Dispatch(),
"Process the first event in the event queue (blocks until an event\n"
"appears if there are none currently)");
DocDeclStr(
virtual bool, ProcessIdle(),
"Called from the MainLoop when the application becomes idle and sends an\n"
"IdleEvent to all interested parties. Returns True is more idle events are\n"
"needed, False if not.");
DocDeclStr(
virtual bool, SendIdleEvents(wxWindow* win, wxIdleEvent& event),
"Send idle event to window and all subwindows. Returns True if more idle time\n"
"is requested.");
DocDeclStr(
virtual bool, IsActive() const,
"Return True if our app has focus.");
DocDeclStr(
void, SetTopWindow(wxWindow *win),
"Set the \"main\" top level window");
DocDeclStr(
virtual wxWindow*, GetTopWindow() const,
"Return the \"main\" top level window (if it hadn't been set previously with\n"
"SetTopWindow(), will return just some top level window and, if there not any,\n"
"will return None)");
DocDeclStr(
void, SetExitOnFrameDelete(bool flag),
"Control the exit behaviour: by default, the program will exit the main loop\n"
"(and so, usually, terminate) when the last top-level program window is\n"
"deleted. Beware that if you disable this behaviour (with\n"
"SetExitOnFrameDelete(False)), you'll have to call ExitMainLoop() explicitly\n"
"from somewhere.\n");
DocDeclStr(
bool, GetExitOnFrameDelete() const,
"Get the current exit behaviour setting.");
#if 0
// Get display mode that is used use. This is only used in framebuffer
@@ -161,9 +198,16 @@ public:
virtual bool SetDisplayMode(const wxVideoMode& info);
#endif
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag );
bool GetUseBestVisual() const;
DocDeclStr(
void, SetUseBestVisual( bool flag ),
"Set whether the app should try to use the best available visual on systems\n"
"where more than one is available, (Sun, SGI, XFree86 4, etc.)");
DocDeclStr(
bool, GetUseBestVisual() const,
"Get current UseBestVisual setting.");
// set/get printing mode: see wxPRINT_XXX constants.
//
@@ -172,14 +216,20 @@ public:
virtual void SetPrintMode(int mode);
int GetPrintMode() const;
// Get/Set OnAssert behaviour. The following flags may be or'd together:
//
// wxPYAPP_ASSERT_SUPPRESS Don't do anything
// wxPYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible
// wxPYAPP_ASSERT_DIALOG Display a message dialog
// wxPYAPP_ASSERT_LOG Write the assertion info to the wxLog
int GetAssertMode();
void SetAssertMode(int mode);
DocDeclStr(
void, SetAssertMode(int mode),
"Set the OnAssert behaviour for debug and hybrid builds. The following flags\n"
"may be or'd together:\n"
"\n"
" wxPYAPP_ASSERT_SUPPRESS Don't do anything\n"
" wxPYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible (default)\n"
" wxPYAPP_ASSERT_DIALOG Display a message dialog\n"
" wxPYAPP_ASSERT_LOG Write the assertion info to the wxLog\n");
DocDeclStr(
int, GetAssertMode(),
"Get the current OnAssert behaviour setting.");
static bool GetMacSupportPCMenuShortcuts();
@@ -194,12 +244,15 @@ public:
static void SetMacExitMenuItemId(long val);
static void SetMacHelpMenuTitleName(const wxString& val);
// For internal use only
void _BootstrapApp();
DocDeclStr(
void, _BootstrapApp(),
"For internal use only");
DocStr(GetComCtl32Version,
"Returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it\n"
"wasn't found at all. Raises an exception on non-Windows platforms.");
#ifdef __WXMSW__
// returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
// wasn't found at all
static int GetComCtl32Version();
#else
%extend {
@@ -214,28 +267,52 @@ public:
//---------------------------------------------------------------------------
%newgroup;
// Force an exit from main loop
void wxExit();
// Yield to other apps/messages
bool wxYield();
bool wxYieldIfNeeded();
bool wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=False);
DocDeclStr(
void, wxExit(),
"Force an exit of the application. Convenience for wx.GetApp().Exit()");
// Cause the message queue to become empty again
void wxWakeUpIdle();
// Send an event to be processed later
void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
DocDeclStr(
bool, wxYield(),
"Yield to other apps/messages. Convenience for wx.GetApp().Yield()");
// This is used to cleanup after wxWindows when Python shuts down.
DocDeclStr(
bool, wxYieldIfNeeded(),
"Yield to other apps/messages. Convenience for wx.GetApp().Yield(True)");
DocDeclStr(
bool, wxSafeYield(wxWindow* win=NULL, bool onlyIfNeeded=False),
"This function is similar to wx.Yield, except that it disables the user input\n"
"to all program windows before calling wx.Yield and re-enables it again\n"
"afterwards. If win is not None, this window will remain enabled, allowing the\n"
"implementation of some limited user interaction.\n"
"\n"
"Returns the result of the call to wx.Yield.");
DocDeclStr(
void, wxWakeUpIdle(),
"Cause the message queue to become empty again, so idle events will be sent.");
DocDeclStr(
void, wxPostEvent(wxEvtHandler *dest, wxEvent& event),
"Send an event to a window or other wx.EvtHandler to be processed later.");
DocStr(wxApp_CleanUp,
"For internal use only, it is used to cleanup after wxWindows when Python shuts down.");
%inline %{
void wxApp_CleanUp() {
__wxPyCleanup();
}
%}
// Return a reference to the current wxApp object.
DocStr(wxGetApp,
"Return a reference to the current wxApp object.");
%inline %{
wxPyApp* wxGetApp() {
return (wxPyApp*)wxTheApp;

View File

@@ -2,51 +2,71 @@
#----------------------------------------------------------------------
class PyOnDemandOutputWindow:
"""
A class that can be used for redirecting Python's stdout and
stderr streams. It will do nothing until something is wrriten to
the stream at which point it will create a Frame with a text area
and write the text there.
"""
def __init__(self, title = "wxPython: stdout/stderr"):
self.frame = None
self.title = title
self.parent = None
def SetParent(self, parent):
"""Set the window to be used as the popup Frame's parent."""
self.parent = parent
def CreateOutputWindow(self, st):
self.frame = wx.Frame(self.parent, -1, self.title,
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.text = wxTextCtrl(self.frame, -1, "",
style = wx.TE_MULTILINE | wx.TE_READONLY)
self.frame.SetSize((450, 300))
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
# These methods provide the file-like output behaviour.
def write(self, text):
"""
Create the output window if needed and write the string to it.
If not called in the context of the gui thread then uses
CallAfter to do the work there.
"""
if self.frame is None:
if not wx.Thread_IsMain():
wx.CallAfter(self.CreateOutputWindow, text)
else:
self.CreateOutputWindow(text)
else:
if not wx.Thread_IsMain():
wx.CallAfter(self.text.AppendText, text)
else:
self.text.AppendText(text)
def close(self):
if self.frame is not None:
wx.CallAfter(self.frame.Close)
def OnCloseWindow(self, event):
if self.frame != None:
if self.frame is not None:
self.frame.Destroy()
self.frame = None
self.text = None
# These methods provide the file-like output behaviour.
def write(self, str):
if not wx.Thread_IsMain():
# Aquire the GUI mutex before making GUI calls. Mutex is released
# when locker is deleted at the end of this function.
locker = wx.MutexGuiLocker()
if not self.frame:
self.frame = wx.Frame(self.parent, -1, self.title,
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.text = wxTextCtrl(self.frame, -1, "",
style = wx.TE_MULTILINE | wx.TE_READONLY)
self.frame.SetSize((450, 300))
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
self.text.AppendText(str)
def close(self):
if self.frame != None:
if not wx.Thread_IsMain():
locker = wx.MutexGuiLocker()
self.frame.Close()
#----------------------------------------------------------------------
# The main application class. Derive from this and implement an OnInit
# method that creates a frame and then calls self.SetTopWindow(frame)
_defRedirect = (wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__')
class App(wx.PyApp):
"""
The main application class. Derive from this and implement an OnInit
method that creates a frame and then calls self.SetTopWindow(frame)
"""
outputWindowClass = PyOnDemandOutputWindow
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
@@ -137,13 +157,20 @@ App_GetComCtl32Version = _core.PyApp_GetComCtl32Version
#----------------------------------------------------------------------------
class PySimpleApp(wx.App):
def __init__(self, redirect=False, filename=None):
wx.App.__init__(self, redirect, filename)
"""
A simple application class. You can just create one of these and
then then make your top level windows later, and not have to worry
about OnInit."""
def __init__(self, redirect=False, filename=None, useBestVisual=False):
wx.App.__init__(self, redirect, filename, useBestVisual)
def OnInit(self):
wx.InitAllImageHandlers()
return True
# Is anybody using this one?
class PyWidgetTester(wx.App):
def __init__(self, size = (250, 100)):
self.size = size

View File

@@ -132,7 +132,11 @@ public:
wxLayoutConstraints();
bool SatisfyConstraints(wxWindow *win, int *OUTPUT);
DocDeclA(
bool, SatisfyConstraints(wxWindow *win, int *OUTPUT),
"SatisfyConstraints(Window win) -> (areSatisfied, noChanges)");
bool AreSatisfied() const;
};

View File

@@ -63,7 +63,7 @@ public:
~wxWave();
bool IsOk() const;
bool Play(bool async = True, bool looped = False) const;
bool Play(bool async = True, bool looped = False);
%pythoncode { def __nonzero__(self): return self.IsOk() }
};

View File

@@ -4396,105 +4396,177 @@ class PyApp(EvtHandler):
return _core.PyApp__setCallbackInfo(*args, **kwargs)
def GetAppName(*args, **kwargs):
"""GetAppName() -> wxString"""
"""GetAppName() -> wxString
Get the application name."""
return _core.PyApp_GetAppName(*args, **kwargs)
def SetAppName(*args, **kwargs):
"""SetAppName(wxString name)"""
"""SetAppName(wxString name)
Set the application name. This value may be used automatically
by wxConfig and such."""
return _core.PyApp_SetAppName(*args, **kwargs)
def GetClassName(*args, **kwargs):
"""GetClassName() -> wxString
Returns the class name of the C++ object using wxRTTI."""
Get the application's class name."""
return _core.PyApp_GetClassName(*args, **kwargs)
def SetClassName(*args, **kwargs):
"""SetClassName(wxString name)"""
"""SetClassName(wxString name)
Set the application's class name. This value may be used for X-resources if
applicable for the platform"""
return _core.PyApp_SetClassName(*args, **kwargs)
def GetVendorName(*args, **kwargs):
"""GetVendorName() -> wxString"""
"""GetVendorName() -> wxString
Get the application's vendor name."""
return _core.PyApp_GetVendorName(*args, **kwargs)
def SetVendorName(*args, **kwargs):
"""SetVendorName(wxString name)"""
"""SetVendorName(wxString name)
Set the application's vendor name. This value may be used automatically
by wxConfig and such."""
return _core.PyApp_SetVendorName(*args, **kwargs)
def GetTraits(*args, **kwargs):
"""GetTraits() -> wxAppTraits"""
"""GetTraits() -> wxAppTraits
Create the app traits object to which we delegate for everything which either
should be configurable by the user (then he can change the default behaviour
simply by overriding CreateTraits() and returning his own traits object) or
which is GUI/console dependent as then wxAppTraits allows us to abstract the
differences behind the common facade"""
return _core.PyApp_GetTraits(*args, **kwargs)
def ProcessPendingEvents(*args, **kwargs):
"""ProcessPendingEvents()"""
"""ProcessPendingEvents()
Process all events in the wxPendingEvents list -- it is necessary to call this
function to process posted events. This happens during each event loop
iteration."""
return _core.PyApp_ProcessPendingEvents(*args, **kwargs)
def Yield(*args, **kwargs):
"""Yield(bool onlyIfNeeded=False) -> bool"""
"""Yield(bool onlyIfNeeded=False) -> bool
Process all currently pending events right now, instead of waiting until
return to the event loop. It is an error to call Yield() recursively unless
the value of onlyIfNeeded is True.
WARNING: This function is dangerous as it can lead to unexpected
reentrancies (i.e. when called from an event handler it
may result in calling the same event handler again), use
with _extreme_ care or, better, don't use at all!
"""
return _core.PyApp_Yield(*args, **kwargs)
def WakeUpIdle(*args, **kwargs):
"""WakeUpIdle()"""
"""WakeUpIdle()
Make sure that idle events are sent again"""
return _core.PyApp_WakeUpIdle(*args, **kwargs)
def MainLoop(*args, **kwargs):
"""MainLoop() -> int"""
"""MainLoop() -> int
Execute the main GUI loop, the function returns when the loop ends."""
return _core.PyApp_MainLoop(*args, **kwargs)
def Exit(*args, **kwargs):
"""Exit()"""
"""Exit()
Exit the main loop thus terminating the application."""
return _core.PyApp_Exit(*args, **kwargs)
def ExitMainLoop(*args, **kwargs):
"""ExitMainLoop()"""
"""ExitMainLoop()
Exit the main GUI loop during the next iteration (i.e. it does not
stop the program immediately!)"""
return _core.PyApp_ExitMainLoop(*args, **kwargs)
def Pending(*args, **kwargs):
"""Pending() -> bool"""
"""Pending() -> bool
Returns True if there are unprocessed events in the event queue."""
return _core.PyApp_Pending(*args, **kwargs)
def Dispatch(*args, **kwargs):
"""Dispatch() -> bool"""
"""Dispatch() -> bool
Process the first event in the event queue (blocks until an event
appears if there are none currently)"""
return _core.PyApp_Dispatch(*args, **kwargs)
def ProcessIdle(*args, **kwargs):
"""ProcessIdle() -> bool"""
"""ProcessIdle() -> bool
Called from the MainLoop when the application becomes idle and sends an
IdleEvent to all interested parties. Returns True is more idle events are
needed, False if not."""
return _core.PyApp_ProcessIdle(*args, **kwargs)
def SendIdleEvents(*args, **kwargs):
"""SendIdleEvents(Window win, IdleEvent event) -> bool"""
"""SendIdleEvents(Window win, IdleEvent event) -> bool
Send idle event to window and all subwindows. Returns True if more idle time
is requested."""
return _core.PyApp_SendIdleEvents(*args, **kwargs)
def OnIdle(*args, **kwargs):
"""OnIdle(IdleEvent event)"""
return _core.PyApp_OnIdle(*args, **kwargs)
def IsActive(*args, **kwargs):
"""IsActive() -> bool"""
"""IsActive() -> bool
Return True if our app has focus."""
return _core.PyApp_IsActive(*args, **kwargs)
def SetTopWindow(*args, **kwargs):
"""SetTopWindow(Window win)"""
"""SetTopWindow(Window win)
Set the "main" top level window"""
return _core.PyApp_SetTopWindow(*args, **kwargs)
def GetTopWindow(*args, **kwargs):
"""GetTopWindow() -> Window"""
"""GetTopWindow() -> Window
Return the "main" top level window (if it hadn't been set previously with
SetTopWindow(), will return just some top level window and, if there not any,
will return None)"""
return _core.PyApp_GetTopWindow(*args, **kwargs)
def SetExitOnFrameDelete(*args, **kwargs):
"""SetExitOnFrameDelete(bool flag)"""
"""SetExitOnFrameDelete(bool flag)
Control the exit behaviour: by default, the program will exit the main loop
(and so, usually, terminate) when the last top-level program window is
deleted. Beware that if you disable this behaviour (with
SetExitOnFrameDelete(False)), you'll have to call ExitMainLoop() explicitly
from somewhere.
"""
return _core.PyApp_SetExitOnFrameDelete(*args, **kwargs)
def GetExitOnFrameDelete(*args, **kwargs):
"""GetExitOnFrameDelete() -> bool"""
"""GetExitOnFrameDelete() -> bool
Get the current exit behaviour setting."""
return _core.PyApp_GetExitOnFrameDelete(*args, **kwargs)
def SetUseBestVisual(*args, **kwargs):
"""SetUseBestVisual(bool flag)"""
"""SetUseBestVisual(bool flag)
Set whether the app should try to use the best available visual on systems
where more than one is available, (Sun, SGI, XFree86 4, etc.)"""
return _core.PyApp_SetUseBestVisual(*args, **kwargs)
def GetUseBestVisual(*args, **kwargs):
"""GetUseBestVisual() -> bool"""
"""GetUseBestVisual() -> bool
Get current UseBestVisual setting."""
return _core.PyApp_GetUseBestVisual(*args, **kwargs)
def SetPrintMode(*args, **kwargs):
@@ -4505,14 +4577,25 @@ Returns the class name of the C++ object using wxRTTI."""
"""GetPrintMode() -> int"""
return _core.PyApp_GetPrintMode(*args, **kwargs)
def GetAssertMode(*args, **kwargs):
"""GetAssertMode() -> int"""
return _core.PyApp_GetAssertMode(*args, **kwargs)
def SetAssertMode(*args, **kwargs):
"""SetAssertMode(int mode)"""
"""SetAssertMode(int mode)
Set the OnAssert behaviour for debug and hybrid builds. The following flags
may be or'd together:
wxPYAPP_ASSERT_SUPPRESS Don't do anything
wxPYAPP_ASSERT_EXCEPTION Turn it into a Python exception if possible (default)
wxPYAPP_ASSERT_DIALOG Display a message dialog
wxPYAPP_ASSERT_LOG Write the assertion info to the wxLog
"""
return _core.PyApp_SetAssertMode(*args, **kwargs)
def GetAssertMode(*args, **kwargs):
"""GetAssertMode() -> int
Get the current OnAssert behaviour setting."""
return _core.PyApp_GetAssertMode(*args, **kwargs)
def GetMacSupportPCMenuShortcuts(*args, **kwargs):
"""PyApp.GetMacSupportPCMenuShortcuts() -> bool"""
return _core.PyApp_GetMacSupportPCMenuShortcuts(*args, **kwargs)
@@ -4564,11 +4647,16 @@ Returns the class name of the C++ object using wxRTTI."""
SetMacHelpMenuTitleName = staticmethod(SetMacHelpMenuTitleName)
def _BootstrapApp(*args, **kwargs):
"""_BootstrapApp()"""
"""_BootstrapApp()
For internal use only"""
return _core.PyApp__BootstrapApp(*args, **kwargs)
def GetComCtl32Version(*args, **kwargs):
"""PyApp.GetComCtl32Version() -> int"""
"""PyApp.GetComCtl32Version() -> int
Returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
wasn't found at all. Raises an exception on non-Windows platforms."""
return _core.PyApp_GetComCtl32Version(*args, **kwargs)
GetComCtl32Version = staticmethod(GetComCtl32Version)
@@ -4621,91 +4709,135 @@ def PyApp_SetMacHelpMenuTitleName(*args, **kwargs):
return _core.PyApp_SetMacHelpMenuTitleName(*args, **kwargs)
def PyApp_GetComCtl32Version(*args, **kwargs):
"""PyApp_GetComCtl32Version() -> int"""
"""PyApp_GetComCtl32Version() -> int
Returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
wasn't found at all. Raises an exception on non-Windows platforms."""
return _core.PyApp_GetComCtl32Version(*args, **kwargs)
#---------------------------------------------------------------------------
def Exit(*args, **kwargs):
"""Exit()"""
"""Exit()
Force an exit of the application. Convenience for wx.GetApp().Exit()"""
return _core.Exit(*args, **kwargs)
def Yield(*args, **kwargs):
"""Yield() -> bool"""
"""Yield() -> bool
Yield to other apps/messages. Convenience for wx.GetApp().Yield()"""
return _core.Yield(*args, **kwargs)
def YieldIfNeeded(*args, **kwargs):
"""YieldIfNeeded() -> bool"""
"""YieldIfNeeded() -> bool
Yield to other apps/messages. Convenience for wx.GetApp().Yield(True)"""
return _core.YieldIfNeeded(*args, **kwargs)
def SafeYield(*args, **kwargs):
"""SafeYield(Window win=None, bool onlyIfNeeded=False) -> bool"""
"""SafeYield(Window win=None, bool onlyIfNeeded=False) -> bool
This function is similar to wx.Yield, except that it disables the user input
to all program windows before calling wx.Yield and re-enables it again
afterwards. If win is not None, this window will remain enabled, allowing the
implementation of some limited user interaction.
Returns the result of the call to wx.Yield."""
return _core.SafeYield(*args, **kwargs)
def WakeUpIdle(*args, **kwargs):
"""WakeUpIdle()"""
"""WakeUpIdle()
Cause the message queue to become empty again, so idle events will be sent."""
return _core.WakeUpIdle(*args, **kwargs)
def PostEvent(*args, **kwargs):
"""PostEvent(EvtHandler dest, Event event)"""
"""PostEvent(EvtHandler dest, Event event)
Send an event to a window or other wx.EvtHandler to be processed later."""
return _core.PostEvent(*args, **kwargs)
def App_CleanUp(*args, **kwargs):
"""App_CleanUp()"""
"""App_CleanUp()
For internal use only, it is used to cleanup after wxWindows when Python shuts down."""
return _core.App_CleanUp(*args, **kwargs)
def GetApp(*args, **kwargs):
"""GetApp() -> PyApp"""
"""GetApp() -> PyApp
Return a reference to the current wxApp object."""
return _core.GetApp(*args, **kwargs)
#----------------------------------------------------------------------
class PyOnDemandOutputWindow:
"""
A class that can be used for redirecting Python's stdout and
stderr streams. It will do nothing until something is wrriten to
the stream at which point it will create a Frame with a text area
and write the text there.
"""
def __init__(self, title = "wxPython: stdout/stderr"):
self.frame = None
self.title = title
self.parent = None
def SetParent(self, parent):
"""Set the window to be used as the popup Frame's parent."""
self.parent = parent
def CreateOutputWindow(self, st):
self.frame = wx.Frame(self.parent, -1, self.title,
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.text = wxTextCtrl(self.frame, -1, "",
style = wx.TE_MULTILINE | wx.TE_READONLY)
self.frame.SetSize((450, 300))
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
# These methods provide the file-like output behaviour.
def write(self, text):
"""
Create the output window if needed and write the string to it.
If not called in the context of the gui thread then uses
CallAfter to do the work there.
"""
if self.frame is None:
if not wx.Thread_IsMain():
wx.CallAfter(self.CreateOutputWindow, text)
else:
self.CreateOutputWindow(text)
else:
if not wx.Thread_IsMain():
wx.CallAfter(self.text.AppendText, text)
else:
self.text.AppendText(text)
def close(self):
if self.frame is not None:
wx.CallAfter(self.frame.Close)
def OnCloseWindow(self, event):
if self.frame != None:
if self.frame is not None:
self.frame.Destroy()
self.frame = None
self.text = None
# These methods provide the file-like output behaviour.
def write(self, str):
if not wx.Thread_IsMain():
# Aquire the GUI mutex before making GUI calls. Mutex is released
# when locker is deleted at the end of this function.
locker = wx.MutexGuiLocker()
if not self.frame:
self.frame = wx.Frame(self.parent, -1, self.title,
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.text = wxTextCtrl(self.frame, -1, "",
style = wx.TE_MULTILINE | wx.TE_READONLY)
self.frame.SetSize((450, 300))
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
self.text.AppendText(str)
def close(self):
if self.frame != None:
if not wx.Thread_IsMain():
locker = wx.MutexGuiLocker()
self.frame.Close()
#----------------------------------------------------------------------
# The main application class. Derive from this and implement an OnInit
# method that creates a frame and then calls self.SetTopWindow(frame)
_defRedirect = (wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__')
class App(wx.PyApp):
"""
The main application class. Derive from this and implement an OnInit
method that creates a frame and then calls self.SetTopWindow(frame)
"""
outputWindowClass = PyOnDemandOutputWindow
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
@@ -4796,13 +4928,20 @@ App_GetComCtl32Version = _core.PyApp_GetComCtl32Version
#----------------------------------------------------------------------------
class PySimpleApp(wx.App):
def __init__(self, redirect=False, filename=None):
wx.App.__init__(self, redirect, filename)
"""
A simple application class. You can just create one of these and
then then make your top level windows later, and not have to worry
about OnInit."""
def __init__(self, redirect=False, filename=None, useBestVisual=False):
wx.App.__init__(self, redirect, filename, useBestVisual)
def OnInit(self):
wx.InitAllImageHandlers()
return True
# Is anybody using this one?
class PyWidgetTester(wx.App):
def __init__(self, size = (250, 100)):
self.size = size
@@ -7455,7 +7594,7 @@ class LayoutConstraints(Object):
self.thisown = 1
del newobj.thisown
def SatisfyConstraints(*args, **kwargs):
"""SatisfyConstraints(Window win, int OUTPUT) -> bool"""
"""SatisfyConstraints(Window win) -> (areSatisfied, noChanges)"""
return _core.LayoutConstraints_SatisfyConstraints(*args, **kwargs)
def AreSatisfied(*args, **kwargs):

View File

@@ -17740,36 +17740,6 @@ static PyObject *_wrap_PyApp_SendIdleEvents(PyObject *self, PyObject *args, PyOb
}
static PyObject *_wrap_PyApp_OnIdle(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyApp *arg1 = (wxPyApp *) 0 ;
wxIdleEvent *arg2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char *kwnames[] = {
(char *) "self",(char *) "event", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyApp_OnIdle",kwnames,&obj0,&obj1)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyApp,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxIdleEvent,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
if (arg2 == NULL) {
PyErr_SetString(PyExc_TypeError,"null reference"); SWIG_fail;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
(arg1)->OnIdle(*arg2);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_PyApp_IsActive(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyApp *arg1 = (wxPyApp *) 0 ;
@@ -18005,31 +17975,6 @@ static PyObject *_wrap_PyApp_GetPrintMode(PyObject *self, PyObject *args, PyObje
}
static PyObject *_wrap_PyApp_GetAssertMode(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyApp *arg1 = (wxPyApp *) 0 ;
int result;
PyObject * obj0 = 0 ;
char *kwnames[] = {
(char *) "self", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:PyApp_GetAssertMode",kwnames,&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyApp,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (int)(arg1)->GetAssertMode();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
resultobj = PyInt_FromLong((long)result);
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_PyApp_SetAssertMode(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyApp *arg1 = (wxPyApp *) 0 ;
@@ -18055,6 +18000,31 @@ static PyObject *_wrap_PyApp_SetAssertMode(PyObject *self, PyObject *args, PyObj
}
static PyObject *_wrap_PyApp_GetAssertMode(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyApp *arg1 = (wxPyApp *) 0 ;
int result;
PyObject * obj0 = 0 ;
char *kwnames[] = {
(char *) "self", NULL
};
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:PyApp_GetAssertMode",kwnames,&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyApp,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (int)(arg1)->GetAssertMode();
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
resultobj = PyInt_FromLong((long)result);
return resultobj;
fail:
return NULL;
}
static PyObject *_wrap_PyApp_GetMacSupportPCMenuShortcuts(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
bool result;
@@ -35612,7 +35582,6 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"PyApp_Dispatch", (PyCFunction) _wrap_PyApp_Dispatch, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_ProcessIdle", (PyCFunction) _wrap_PyApp_ProcessIdle, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_SendIdleEvents", (PyCFunction) _wrap_PyApp_SendIdleEvents, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_OnIdle", (PyCFunction) _wrap_PyApp_OnIdle, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_IsActive", (PyCFunction) _wrap_PyApp_IsActive, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_SetTopWindow", (PyCFunction) _wrap_PyApp_SetTopWindow, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetTopWindow", (PyCFunction) _wrap_PyApp_GetTopWindow, METH_VARARGS | METH_KEYWORDS },
@@ -35622,8 +35591,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"PyApp_GetUseBestVisual", (PyCFunction) _wrap_PyApp_GetUseBestVisual, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_SetPrintMode", (PyCFunction) _wrap_PyApp_SetPrintMode, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetPrintMode", (PyCFunction) _wrap_PyApp_GetPrintMode, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetAssertMode", (PyCFunction) _wrap_PyApp_GetAssertMode, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_SetAssertMode", (PyCFunction) _wrap_PyApp_SetAssertMode, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetAssertMode", (PyCFunction) _wrap_PyApp_GetAssertMode, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetMacSupportPCMenuShortcuts", (PyCFunction) _wrap_PyApp_GetMacSupportPCMenuShortcuts, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetMacAboutMenuItemId", (PyCFunction) _wrap_PyApp_GetMacAboutMenuItemId, METH_VARARGS | METH_KEYWORDS },
{ (char *)"PyApp_GetMacPreferencesMenuItemId", (PyCFunction) _wrap_PyApp_GetMacPreferencesMenuItemId, METH_VARARGS | METH_KEYWORDS },

View File

@@ -10496,7 +10496,7 @@ static PyObject *_wrap_Wave_Play(PyObject *self, PyObject *args, PyObject *kwarg
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
result = (bool)((wxWave const *)arg1)->Play(arg2,arg3);
result = (bool)(arg1)->Play(arg2,arg3);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;