This commit was manufactured by cvs2svn to create tag 'WX_2_4_1'.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/WX_2_4_1@21086 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
28
wxPython/wx/prefix.py
Normal file
28
wxPython/wx/prefix.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Renaming utility.
|
||||
|
||||
Provides a way to drop the wx prefix from wxPython objects."""
|
||||
|
||||
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
||||
__cvsid__ = "$Id$"
|
||||
__revision__ = "$Revision$"[11:-2]
|
||||
|
||||
import types
|
||||
|
||||
def rename(d_new, d_old):
|
||||
for old, obj in d_old.items():
|
||||
if type(obj) is types.ModuleType or old.startswith('_'):
|
||||
# Skip modules and private names.
|
||||
continue
|
||||
## mod = d_old['__name__']
|
||||
## if hasattr(obj, '__module__') and not obj.__module__.startswith(mod):
|
||||
## # Skip objects imported from other modules, except those
|
||||
## # related to the current module, such as stc_.
|
||||
## continue
|
||||
new = old
|
||||
if old.startswith('EVT_') or old.startswith('wxEVT_'):
|
||||
# Leave these names unmodified.
|
||||
pass
|
||||
elif old.startswith('wx'):
|
||||
new = old[2:]
|
||||
if new:
|
||||
d_new[new] = d_old[old]
|
Reference in New Issue
Block a user