SWIGged updates for wxMSW
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -719,7 +719,7 @@ static PyObject *_wrap_wxHelpProvider_ShowHelp(PyObject *self, PyObject *args, P
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxHelpProvider * _arg0;
|
||||
wxWindowBase * _arg1;
|
||||
wxWindow * _arg1;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
char *_kwnames[] = { "self","window", NULL };
|
||||
@@ -736,8 +736,8 @@ static PyObject *_wrap_wxHelpProvider_ShowHelp(PyObject *self, PyObject *args, P
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindowBase_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxHelpProvider_ShowHelp. Expected _wxWindowBase_p.");
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxHelpProvider_ShowHelp. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -755,7 +755,7 @@ static PyObject *_wrap_wxHelpProvider_ShowHelp(PyObject *self, PyObject *args, P
|
||||
static PyObject *_wrap_wxHelpProvider_AddHelp(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxHelpProvider * _arg0;
|
||||
wxWindowBase * _arg1;
|
||||
wxWindow * _arg1;
|
||||
wxString * _arg2;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
@@ -774,8 +774,8 @@ static PyObject *_wrap_wxHelpProvider_AddHelp(PyObject *self, PyObject *args, Py
|
||||
}
|
||||
if (_argo1) {
|
||||
if (_argo1 == Py_None) { _arg1 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindowBase_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxHelpProvider_AddHelp. Expected _wxWindowBase_p.");
|
||||
else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxHelpProvider_AddHelp. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@@ -1717,35 +1717,67 @@ def wxCallAfter(callable, *args, **kw):
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class wxFutureCall(wxTimer):
|
||||
|
||||
class wxFutureCall:
|
||||
"""
|
||||
A convenience class for wxTimer, that calls the given callable
|
||||
object once after the given amount of milliseconds, passing any
|
||||
positional or keyword args. The return value of the callable is
|
||||
availbale after it has been run with the GetResult method.
|
||||
|
||||
If you don't need to get the return value or restart the timer
|
||||
then there is no need to hold a reference to this object. It will
|
||||
hold a reference to itself while the timer is running (the timer
|
||||
has a reference to self.Notify) but the cycle will be broken when
|
||||
the timer completes, automatically cleaning up the wxFutureCall
|
||||
object.
|
||||
"""
|
||||
def __init__(self, millis, callable, *args, **kwargs):
|
||||
wxTimer.__init__(self)
|
||||
self.millis = millis
|
||||
self.callable = callable
|
||||
self.SetArgs(*args, **kwargs)
|
||||
self.runCount = 0
|
||||
self.hasRun = False
|
||||
self.result = None
|
||||
self.Start(self.millis, wxTIMER_ONE_SHOT)
|
||||
self.timer = None
|
||||
self.Start()
|
||||
|
||||
def __del__(self):
|
||||
self.Stop()
|
||||
wxTimer.__del__(self)
|
||||
|
||||
def Restart(self, millis=None):
|
||||
|
||||
def Start(self, millis=None):
|
||||
"""
|
||||
Restart the timer with the same duration as before.
|
||||
(Re)start the timer
|
||||
"""
|
||||
self.hasRun = False
|
||||
if millis is not None:
|
||||
self.millis = millis
|
||||
self.Start(self.millis, wxTIMER_ONE_SHOT)
|
||||
self.Stop()
|
||||
self.timer = wxPyTimer(self.Notify)
|
||||
self.timer.Start(self.millis, wxTIMER_ONE_SHOT)
|
||||
Restart = Start
|
||||
|
||||
|
||||
def Stop(self):
|
||||
"""
|
||||
Stop and destroy the timer.
|
||||
"""
|
||||
if self.timer is not None:
|
||||
self.timer.Stop()
|
||||
self.timer = None
|
||||
|
||||
|
||||
def GetInterval(self):
|
||||
if self.timer is not None:
|
||||
return self.timer.GetInterval()
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
def IsRunning(self):
|
||||
return self.timer is not None and self.timer.IsRunning()
|
||||
|
||||
|
||||
def SetArgs(self, *args, **kwargs):
|
||||
"""
|
||||
@@ -1771,6 +1803,8 @@ class wxFutureCall(wxTimer):
|
||||
self.runCount += 1
|
||||
self.result = self.callable(*self.args, **self.kwargs)
|
||||
self.hasRun = True
|
||||
wxCallAfter(self.Stop)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user