From: Robin Dunn Date: Tue, 27 Apr 2004 19:26:48 +0000 (+0000) Subject: better __docfilter__ and other epydoc tweaks X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/99109c0ff1c29c7c977c073f9f8e0bf4b8e728f7 better __docfilter__ and other epydoc tweaks git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/contrib/activex/activex.i b/wxPython/contrib/activex/activex.i index 6e7c157b45..3b7460921e 100644 --- a/wxPython/contrib/activex/activex.i +++ b/wxPython/contrib/activex/activex.i @@ -25,7 +25,7 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr); diff --git a/wxPython/contrib/gizmos/gizmos.i b/wxPython/contrib/gizmos/gizmos.i index 8b85c16f3a..b76d189788 100644 --- a/wxPython/contrib/gizmos/gizmos.i +++ b/wxPython/contrib/gizmos/gizmos.i @@ -36,7 +36,7 @@ %import windows.i %import controls.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING2(DynamicSashNameStr, wxT("dynamicSashWindow")); diff --git a/wxPython/contrib/glcanvas/glcanvas.i b/wxPython/contrib/glcanvas/glcanvas.i index 5e5c8d77c7..8e1596eecc 100644 --- a/wxPython/contrib/glcanvas/glcanvas.i +++ b/wxPython/contrib/glcanvas/glcanvas.i @@ -25,7 +25,7 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas")); diff --git a/wxPython/contrib/iewin/iewin.i b/wxPython/contrib/iewin/iewin.i index 8a1a4169a9..8ea307ec71 100644 --- a/wxPython/contrib/iewin/iewin.i +++ b/wxPython/contrib/iewin/iewin.i @@ -25,7 +25,7 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr); diff --git a/wxPython/contrib/ogl/ogl.i b/wxPython/contrib/ogl/ogl.i index b7cb72c772..01bdc1d12f 100644 --- a/wxPython/contrib/ogl/ogl.i +++ b/wxPython/contrib/ogl/ogl.i @@ -24,7 +24,7 @@ %import windows.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING_NOSWIG(EmptyString); diff --git a/wxPython/contrib/stc/stc.i b/wxPython/contrib/stc/stc.i index 199798909a..51fa9b6860 100644 --- a/wxPython/contrib/stc/stc.i +++ b/wxPython/contrib/stc/stc.i @@ -25,7 +25,7 @@ %import core.i %import misc.i // for DnD %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING(STCNameStr); diff --git a/wxPython/contrib/xrc/xrc.i b/wxPython/contrib/xrc/xrc.i index 23a04ec32e..f7f990aed2 100644 --- a/wxPython/contrib/xrc/xrc.i +++ b/wxPython/contrib/xrc/xrc.i @@ -27,7 +27,7 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } MAKE_CONST_WXSTRING_NOSWIG(EmptyString); diff --git a/wxPython/src/__init__.py b/wxPython/src/__init__.py index 65b23070ea..d6c0977443 100644 --- a/wxPython/src/__init__.py +++ b/wxPython/src/__init__.py @@ -26,7 +26,16 @@ __all__ = [ 'calendar', 'grid', 'html', - 'wizard', + 'wizard', + + # contribs (need a better way to find these...) + 'activex', + 'gizmos', + 'glcanvas', + 'iewin', + 'ogl', + 'stc', + 'xrc', ] # Load the package namespace with the core classes and such @@ -36,7 +45,7 @@ del wx # Load up __all__ with all the names of items that should appear to be # defined in this pacakge so epydoc will document them that way. import wx._core -__docfilter__ = wx._core.__docfilter__ +__docfilter__ = wx._core.__DocFilter(globals()) __all__ += [name for name in dir(wx._core) if not (name.startswith('__') and name.endswith('__'))] diff --git a/wxPython/src/_core_ex.py b/wxPython/src/_core_ex.py index 6c6ff3b1f9..ff368615ae 100644 --- a/wxPython/src/_core_ex.py +++ b/wxPython/src/_core_ex.py @@ -222,14 +222,22 @@ class FutureCall: # documented (or will be) as part of the classes/functions/methods # where they should be used. -def __docfilter__(name): - import types - obj = globals().get(name, None) - if type(obj) not in [type, types.ClassType, types.FunctionType, types.BuiltinFunctionType]: - return False - if name.startswith('_') or name.endswith('Ptr') or name.startswith('EVT'): - return False - return True +class __DocFilter: + """ + A filter for epydoc that only allows non-Ptr classes and + fucntions, in order to reduce the clutter in the API docs. + """ + def __init__(self, globals): + self._globals = globals + + def __call__(self, name): + import types + obj = self._globals.get(name, None) + if type(obj) not in [type, types.ClassType, types.FunctionType, types.BuiltinFunctionType]: + return False + if name.startswith('_') or name.endswith('Ptr') or name.startswith('EVT'): + return False + return True #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- diff --git a/wxPython/src/calendar.i b/wxPython/src/calendar.i index 8f2f16602b..b0466c88e1 100644 --- a/wxPython/src/calendar.i +++ b/wxPython/src/calendar.i @@ -24,7 +24,7 @@ %import misc.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } %include _calendar_rename.i diff --git a/wxPython/src/controls.i b/wxPython/src/controls.i index eb0cd7ea07..e51a2e628f 100644 --- a/wxPython/src/controls.i +++ b/wxPython/src/controls.i @@ -23,7 +23,6 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } %include __controls_rename.i diff --git a/wxPython/src/gdi.i b/wxPython/src/gdi.i index 4e6acd8f78..453b0e9f8e 100644 --- a/wxPython/src/gdi.i +++ b/wxPython/src/gdi.i @@ -24,7 +24,6 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } %include __gdi_rename.i diff --git a/wxPython/src/grid.i b/wxPython/src/grid.i index c01e8a7bbf..e0e0ae42b1 100644 --- a/wxPython/src/grid.i +++ b/wxPython/src/grid.i @@ -27,7 +27,7 @@ %import windows.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } %include _grid_rename.i diff --git a/wxPython/src/html.i b/wxPython/src/html.i index d167819a5f..164183844e 100644 --- a/wxPython/src/html.i +++ b/wxPython/src/html.i @@ -30,7 +30,7 @@ %import windows.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } %include _html_rename.i diff --git a/wxPython/src/misc.i b/wxPython/src/misc.i index a6b6a49904..2919e201e0 100644 --- a/wxPython/src/misc.i +++ b/wxPython/src/misc.i @@ -25,7 +25,6 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } %include __misc_rename.i diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 2591e356c3..5044563f2a 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -24,7 +24,6 @@ %import core.i %pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__docfilter__ } %include __windows_rename.i diff --git a/wxPython/src/wizard.i b/wxPython/src/wizard.i index 309da8bac3..6fd84dff2e 100644 --- a/wxPython/src/wizard.i +++ b/wxPython/src/wizard.i @@ -25,6 +25,7 @@ %import windows.i %pythoncode { wx = _core } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } %include _wizard_rename.i diff --git a/wxPython/wx/build/__init__.py b/wxPython/wx/build/__init__.py index 08c9d66954..4bf06acf29 100644 --- a/wxPython/wx/build/__init__.py +++ b/wxPython/wx/build/__init__.py @@ -1 +1,20 @@ # A Python package +""" +This package provides the config module, which is used by wxPython's +setup.py distutils script. It was moved here so it would be installed +with the rest of wxPython and could therefore be used by the setup.py +for other projects that needed this same info and functionality (most +likely in order to be compatible with wxPython.) + +See config.py and wxPython's setup.py for more details. + +""" + + +# Exclude config from the epydoc docs because it will currently cause +# a lot of noise. Once it has been refactored then add "config" to +# the list below. + +__all__ = [] + + diff --git a/wxPython/wx/tools/__init__.py b/wxPython/wx/tools/__init__.py index 54e9b268d8..6c958a6014 100644 --- a/wxPython/wx/tools/__init__.py +++ b/wxPython/wx/tools/__init__.py @@ -1,4 +1,18 @@ -# +""" +Some useful tools and utilities for wxPython. +""" + + +# XRCed is purposfully left out so epydoc won't document it +__all__ = [ + 'dbg', + 'genaxmodule', + 'helpviewer', + 'img2img', + 'img2png', + 'img2py', + 'img2xpm', + ] diff --git a/wxPython/wx/tools/img2png.py b/wxPython/wx/tools/img2png.py index 4416df9ebf..2f5bc8baab 100644 --- a/wxPython/wx/tools/img2png.py +++ b/wxPython/wx/tools/img2png.py @@ -14,7 +14,7 @@ # """ -img2png.py -- convert several image formats to PNG format +img2png.py -- convert several image formats to PNG format. Usage: diff --git a/wxPython/wx/tools/img2xpm.py b/wxPython/wx/tools/img2xpm.py index 97c6d6061d..3fa833b0ce 100644 --- a/wxPython/wx/tools/img2xpm.py +++ b/wxPython/wx/tools/img2xpm.py @@ -14,7 +14,7 @@ # """ -img2xpm.py -- convert several image formats to XPM +img2xpm.py -- convert several image formats to XPM. Usage: