Replace the deprecation text for wx.NewId

This commit is contained in:
Robin Dunn
2018-06-24 20:40:36 -07:00
parent 06f5361ed7
commit 36fa818f2f
2 changed files with 27 additions and 9 deletions

View File

@@ -83,6 +83,16 @@ def run():
c.addPyMethod('__enter__', '(self)', 'return self')
c.addPyMethod('__exit__', '(self, exc_type, exc_val, exc_tb)', 'pass')
f = module.find('wxNewId')
f.clearDeprecated()
f.deprecated = """\
IDs generated by this function can possibly conflict with IDs used elsewhere in
the application code. It is recommended to instead use the ``wx.ID_ANY`` ID to
assign generated IDs which are guaranteed to not conflict with the other in-use
IDs for the controls menu items and etc. that you create in the application. For
those cases where you need to create an ID that can be used more than once then
please see :func:`wx.NewIdRef`.
""".replace('\n', ' ')
for funcname in ['wxBell',
'wxBeginBusyCursor',
@@ -94,9 +104,10 @@ def run():
'wxGetKeyState',
'wxGetMouseState',
]:
c = module.find(funcname)
c.mustHaveApp()
f = module.find(funcname)
f.mustHaveApp()
#-----------------------------------------------------------------
tools.doCommonTweaks(module)

View File

@@ -26,10 +26,6 @@ from sphinxtools.utilities import findDescendants
#---------------------------------------------------------------------------
# These classes simply hold various bits of information about the classes,
# methods, functions and other items in the C/C++ API being wrapped.
#
# NOTE: Currently very little is being done with the docstrings. They can
# either be reprocessed later by the document generator or we can do more
# tinkering with them here. It just depends on decisions not yet made...
#---------------------------------------------------------------------------
class BaseDef(object):
@@ -83,10 +79,21 @@ class BaseDef(object):
itemid = item.get('id')
if itemid and itemid.startswith('deprecated'):
self.deprecated = True
break
return
if self.deprecated:
break
def clearDeprecated(self):
"""
Remove the deprecation notice from the detailedDoc, if any, and reset
self.deprecated to False.
"""
self.deprecated = False
for para in self.detailedDoc:
for item in para.iter():
itemid = item.get('id')
if itemid and itemid.startswith('deprecated'):
self.detailedDoc.remove(para)
return
def ignore(self, val=True):