mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Allow wxPyCheckForApp to not raise an exception if one isn't wanted
This commit is contained in:
@@ -160,7 +160,7 @@ struct wxPyAPI {
|
||||
bool (*p_wxPyWrappedPtr_TypeCheck)(PyObject* obj, const wxString& className);
|
||||
wxVariant (*p_wxVariant_in_helper)(PyObject* obj);
|
||||
PyObject* (*p_wxVariant_out_helper)(const wxVariant& value);
|
||||
bool (*p_wxPyCheckForApp)();
|
||||
bool (*p_wxPyCheckForApp)(bool raiseException);
|
||||
PyObject* (*p_wxPyMakeBuffer)(void* ptr, Py_ssize_t len, bool readOnly);
|
||||
bool (*p_wxPyNumberSequenceCheck)(PyObject* obj, int reqLength);
|
||||
void* (*p_wxPyGetCppPtr)(sipSimpleWrapper* sipPyObj);
|
||||
@@ -245,8 +245,8 @@ inline PyObject* wxVariant_out_helper(const wxVariant& value)
|
||||
|
||||
|
||||
// Check if a wx.App object has been created
|
||||
inline bool wxPyCheckForApp()
|
||||
{ return wxPyGetAPIPtr()->p_wxPyCheckForApp(); }
|
||||
inline bool wxPyCheckForApp(bool raiseException=true)
|
||||
{ return wxPyGetAPIPtr()->p_wxPyCheckForApp(raiseException); }
|
||||
|
||||
|
||||
// Create a buffer object from a pointer and size
|
||||
|
||||
@@ -431,11 +431,12 @@ PyObject* i_wxVariant_out_helper(const wxVariant& value)
|
||||
// (Initialized in wxPyCoreModuleInject)
|
||||
PyObject* wxPyNoAppError = NULL;
|
||||
|
||||
bool i_wxPyCheckForApp() {
|
||||
bool i_wxPyCheckForApp(bool raiseException) {
|
||||
if (wxTheApp != NULL)
|
||||
return true;
|
||||
else {
|
||||
PyErr_SetString(wxPyNoAppError, "The wx.App object must be created first!");
|
||||
if (raiseException)
|
||||
PyErr_SetString(wxPyNoAppError, "The wx.App object must be created first!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user