From 92fea4048b8b546029f9a5af0fe7372e1c9a82fb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 5 Mar 2003 04:08:08 +0000 Subject: [PATCH] Deprecated NewId and RegisterId Added missing Disable method git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19487 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_extras.py | 41 ++++++++++++++++++++++++++++++++--------- wxPython/src/misc.i | 2 -- wxPython/src/windows.i | 1 + 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 46f127b424..dbee2c12fd 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -595,12 +595,7 @@ wxPen = wxPyPen wxScrollbar = wxScrollBar wxPoint2D = wxPoint2DDouble -# Use Python's bool constants if available, make aliases if not -try: - True -except NameError: - True = 1==1 - False = 1==0 +wxPyAssertionError = wxc.wxPyAssertionError # backwards compatibility @@ -611,15 +606,43 @@ NULL = None wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric -false = FALSE = False -true = TRUE = True # workarounds for bad wxRTTI names __wxPyPtrTypeMap['wxGauge95'] = 'wxGauge' -wxPyAssertionError = wxc.wxPyAssertionError + +def NewId(): + import warnings + warnings.warn("Use wxNewId instead", DeprecationWarning, 2) + return wxNewId() + +def RegisterId(ID): + import warnings + warnings.warn("Use wxRegisterId instead", DeprecationWarning, 2) + return wxRegisterId(ID) + + + +# Use Python's bool constants if available, make aliases if not +try: + True +except NameError: + True = 1==1 + False = 1==0 + +class _DeprecatedNonBool: + def __init__(self, val, txt): + self.__val = val + self.__txt = txt + def __int__(self): + import warnings + warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3) + return self.__val + +TRUE = true = _DeprecatedNonBool(True, 'True') +FALSE = false = _DeprecatedNonBool(False, 'False') #---------------------------------------------------------------------- diff --git a/wxPython/src/misc.i b/wxPython/src/misc.i index 834c805722..8887c653f1 100644 --- a/wxPython/src/misc.i +++ b/wxPython/src/misc.i @@ -511,8 +511,6 @@ public: long wxNewId(); void wxRegisterId(long id); -%name(NewId) long wxNewId(); -%name(RegisterId) void wxRegisterId(long id); long wxGetCurrentId(); void wxBell(); diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 4236bcd14f..5b6ccf56da 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -216,6 +216,7 @@ public: void DragAcceptFiles(bool accept); #endif void Enable(bool enable); + void Disable(); // Find child window by ID or name %name(FindWindowById) wxWindow* FindWindow(long id);