Add deprecation wrappers for methods that have vanished from wxWidgets due to the 2.8 compatibility flag being turned off.

This commit is contained in:
Robin Dunn
2018-02-09 14:30:49 -08:00
parent 6428566d13
commit 50a6410c87
9 changed files with 61 additions and 10 deletions

View File

@@ -49,6 +49,9 @@ def run():
c.find('GetBitmap').mustHaveApp()
c.find('GetIcon').mustHaveApp()
c.find('Insert').ignore()
c.addPyCode("ArtProvider.Insert = wx.deprecated(ArtProvider.PushBack, 'Use ArtProvider.PushBack instead')")
# Change the types of the art constants from wxString to const char*
# since that is what they really are.
artConsts = list()

View File

@@ -60,6 +60,12 @@ def run():
c.find('SetSelection.from').name = 'frm'
c.find('GetTextIndent').ignore()
c.find('SetTextIndent').ignore()
c.addPyCode("ComboCtrl.GetTextIndent = wx.deprecated(ComboCtrl.GetMargins, 'Use GetMargins instead.')")
c.addPyCode("ComboCtrl.SetTextIndent = wx.deprecated(ComboCtrl.SetMargins, 'Use SetMargins instead.')")
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)

View File

@@ -570,7 +570,10 @@ def run():
#---------------------------------------
# wxIconizeEvent
module.find('wxIconizeEvent.Iconized').deprecated = True
c = module.find('wxIconizeEvent')
c.find('Iconized').ignore()
c.addPyCode("IconizeEvent.Iconized = wx.deprecated(IconizeEvent.IsIconized, 'Use IsIconized instead')")
# Apply common fixups for all the event classes

View File

@@ -170,6 +170,11 @@ def run():
c.addPyProperty('Menus GetMenus SetMenus')
c.find('GetLabelTop').ignore()
c.find('SetLabelTop').ignore()
c.addPyCode("MenuBar.GetLabelTop = wx.deprecated(MenuBar.GetMenuLabelText, 'Use GetMenuLabelText instead')")
c.addPyCode("MenuBar.SetLabelTop = wx.deprecated(ManuBar.SetMenuLabel, 'Use SetMenuLabel instead')")
module.addItem(tools.wxListWrapperTemplate('wxMenuList', 'wxMenu', module))
#-----------------------------------------------------------------

View File

@@ -38,6 +38,19 @@ def run():
c.find('SetSubMenu.menu').transfer = True
c.find('GetLabel').ignore()
c.find('GetName').ignore()
c.find('GetText').ignore()
c.find('SetText').ignore()
c.find('GetLabelFromText').ignore()
c.addPyCode("MenuItem.GetLabel = wx.deprecated(MenuItem.GetItemLabelText, 'Use GetItemLabelText instead')")
c.addPyCode("MenuItem.GetName = wx.deprecated(MenuItem.GetItemLabelText, 'Use GetItemLabelText instead')")
c.addPyCode("MenuItem.GetText = wx.deprecated(MenuItem.GetItemLabel, 'Use GetItemLabel instead')")
c.addPyCode("MenuItem.SetText = wx.deprecated(MenuItem.SetItemLabel, 'Use SetItemLabel instead')")
c.addPyCode("MenuItem.GetLabelFromText = wx.deprecated(MenuItem.GetLabelText, 'Use GetLabelText instead')")
# These are MSW only. Make them be empty stubs for the other ports
c.find('GetBackgroundColour').type = 'wxColour*'
c.find('GetBackgroundColour').setCppCode("""\

View File

@@ -117,16 +117,28 @@ def run():
c.find('GetEditorDialog').factory = True
c.find('AddChild').ignore()
c.find('GetValueString').ignore()
c.addPyCode("PGProperty.AddChild = wx.deprecated(PGProperty.AddPrivateChild, 'Use AddPrivateChild instead')")
c.addPyCode("PGProperty.GetValueString = wx.deprecated(PGProperty.GetValueAsString, 'Use GetValueAsString instead')")
#---------------------------------------------------------
c = module.find('wxPGChoicesData')
tools.ignoreConstOverloads(c)
c.bases = ['wxRefCounter']
c.find('~wxPGChoicesData').ignore(False)
#---------------------------------------------------------
c = module.find('wxPGChoices')
c.find('wxPGChoices').findOverload('wxChar **').ignore()
tools.ignoreConstOverloads(c)
c.find('operator[]').ignore()
c.find('GetId').type = 'wxIntPtr'
c.find('GetId').setCppCode_sip("""\
sipRes = new ::wxIntPtr((wxIntPtr)sipCpp->GetId());
""")
c.addPyMethod('__getitem__', '(self, index)',
doc="Returns a reference to a :class:PGChoiceEntry using Python list syntax.",

View File

@@ -94,6 +94,9 @@ def run():
# Needs wxWin 2.6 compatibility
c.find('Remove').findOverload('(wxWindow *window)').ignore()
c.find('SetVirtualSizeHints').ignore()
c.addPyCode("Sizer.SetVirtualSizeHints = wx.deprecated(Sizer.FitInside, 'Use FitInside instead')")
c.addPyMethod('AddMany', '(self, items)',
doc="""\
:meth:`AddMany` is a convenience method for adding several items to a sizer

View File

@@ -63,6 +63,10 @@ def run():
module.find('wxSetDisplayName').ignore()
module.find('wxPostDelete').ignore()
module.find('wxUsleep').ignore()
module.addPyCode("Usleep = deprecated(MilliSleep, 'Use MilliSleep instead.')")
# ignore all the environment related functions
for item in module.allItems():
if 'Env' in item.name:

View File

@@ -119,47 +119,49 @@ def run():
c.addCppMethod('unsigned long', 'GetFirstVisibleLine', '()',
doc="Deprecated compatibility helper.",
deprecated='Use GetVisibleRowsBegin instead.',
body="return self->GetFirstVisibleLine();")
body="return self->GetVisibleRowsBegin();")
c.addCppMethod('unsigned long', 'GetLastVisibleLine', '()',
doc="Deprecated compatibility helper.",
deprecated='Use GetVisibleRowsEnd instead.',
body="return self->GetLastVisibleLine();")
body="return self->GetVisibleRowsEnd();")
c.addCppMethod('unsigned long', 'GetLineCount', '()',
doc="Deprecated compatibility helper.",
deprecated='Use GetRowCount instead.',
body="return self->GetLineCount();")
body="return self->GetRowCount();")
c.addCppMethod('void', 'SetLineCount', '(unsigned long count)',
doc="Deprecated compatibility helper.",
deprecated='Use SetRowCount instead.',
body="self->SetLineCount(count);")
body="self->SetRowCount(count);")
c.addCppMethod('void', 'RefreshLine', '(unsigned long line)',
doc="Deprecated compatibility helper.",
deprecated='Use RefreshRow instead.',
body="self->RefreshLine(line);")
body="self->RefreshRow(line);")
c.addCppMethod('void', 'RefreshLines', '(unsigned long from_, unsigned long to_)',
doc="Deprecated compatibility helper.",
deprecated='Use RefreshRows instead.',
body="self->RefreshLines(from_, to_);")
body="self->RefreshRows(from_, to_);")
c.addCppMethod('bool', 'ScrollToLine', '(unsigned long line)',
doc="Deprecated compatibility helper.",
deprecated='Use ScrollToRow instead.',
body="return self->ScrollToLine(line);")
body="return self->ScrollToRow(line);")
c.addCppMethod('bool', 'ScrollLines', '(int lines)',
doc="Deprecated compatibility helper.",
deprecated='Use ScrollRows instead.',
body="return self->wxVarVScrollLegacyAdaptor::ScrollLines(lines);")
#body="return self->wxVarVScrollLegacyAdaptor::ScrollLines(lines);")
body="return self->ScrollRows(lines);")
c.addCppMethod('bool', 'ScrollPages', '(int pages)',
doc="Deprecated compatibility helper.",
deprecated='Use ScrollRowPages instead.',
body="return self->wxVarVScrollLegacyAdaptor::ScrollPages(pages);")
#body="return self->wxVarVScrollLegacyAdaptor::ScrollPages(pages);")
body="return self->ScrollRowPages(pages);")