mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-23 23:13:12 +08:00
Updated to new PyCrust
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,7 +53,8 @@ class FillingTree(wxTreeCtrl):
|
||||
objtype = type(object)
|
||||
if objtype is types.DictType:
|
||||
dict = object
|
||||
elif objtype in (types.InstanceType, types.ModuleType):
|
||||
elif (objtype in (types.InstanceType, types.ModuleType)) \
|
||||
or hasattr(object, '__class__'):
|
||||
for key in introspect.getAttributeNames(object):
|
||||
# Believe it or not, some attributes can disappear, such as
|
||||
# the exc_traceback attribute of the sys module. So this is
|
||||
@@ -170,10 +171,16 @@ if wxPlatform == '__WXMSW__':
|
||||
'helv' : 'Lucida Console',
|
||||
'lucida' : 'Lucida Console',
|
||||
'other' : 'Comic Sans MS',
|
||||
'size' : 8,
|
||||
'lnsize' : 7,
|
||||
'size' : 10,
|
||||
'lnsize' : 9,
|
||||
'backcol': '#FFFFFF',
|
||||
}
|
||||
# Versions of wxPython prior to 2.3.2 had a sizing bug on Win platform.
|
||||
# The font was 2 points too large. So we need to reduce the font size.
|
||||
if ((wxMAJOR_VERSION, wxMINOR_VERSION) == (2, 3) and wxRELEASE_NUMBER < 2) \
|
||||
or (wxMAJOR_VERSION <= 2 and wxMINOR_VERSION <= 2):
|
||||
faces['size'] -= 2
|
||||
faces['lnsize'] -= 2
|
||||
else: # GTK
|
||||
faces = { 'times' : 'Times',
|
||||
'mono' : 'Courier',
|
||||
@@ -299,3 +306,4 @@ class App(wxApp):
|
||||
return true
|
||||
|
||||
|
||||
|
||||
@@ -48,16 +48,17 @@ class Interpreter(InteractiveInterpreter):
|
||||
"""Send command to the interpreter to be executed.
|
||||
|
||||
Because this may be called recursively, we append a new list
|
||||
onto the commandBuffer list and then append commands into
|
||||
that. If the passed in command is part of a multi-line command
|
||||
we keep appending the pieces to the last list in commandBuffer
|
||||
until we have a complete command, then, finally, we delete
|
||||
that last list."""
|
||||
onto the commandBuffer list and then append commands into that.
|
||||
If the passed in command is part of a multi-line command we keep
|
||||
appending the pieces to the last list in commandBuffer until we
|
||||
have a complete command. If not, we delete that last list."""
|
||||
if not self.more:
|
||||
try: del self.commandBuffer[-1]
|
||||
except IndexError: pass
|
||||
if not self.more: self.commandBuffer.append([])
|
||||
self.commandBuffer[-1].append(command)
|
||||
source = '\n'.join(self.commandBuffer[-1])
|
||||
self.more = self.runsource(source)
|
||||
if not self.more: del self.commandBuffer[-1]
|
||||
return self.more
|
||||
|
||||
def runsource(self, source):
|
||||
@@ -102,3 +103,4 @@ class InterpreterAlaCarte(Interpreter):
|
||||
sys.ps1 = ps1
|
||||
sys.ps2 = ps2
|
||||
|
||||
|
||||
@@ -49,11 +49,18 @@ def getAllAttributeNames(object):
|
||||
Recursively walk through a class and all base classes.
|
||||
"""
|
||||
attributes = []
|
||||
# Wake up sleepy objects - a hack for ZODB objects in "ghost" state.
|
||||
wakeupcall = dir(object)
|
||||
del wakeupcall
|
||||
# Get attributes available through the normal convention.
|
||||
attributes += dir(object)
|
||||
# For a class instance, get the attributes for the class.
|
||||
if hasattr(object, '__class__'):
|
||||
attributes += getAllAttributeNames(object.__class__)
|
||||
# Break a circular reference. This happens with extension classes.
|
||||
if object.__class__ is object:
|
||||
pass
|
||||
else:
|
||||
attributes += getAllAttributeNames(object.__class__)
|
||||
# Also get attributes from any and all parent classes.
|
||||
if hasattr(object, '__bases__'):
|
||||
for base in object.__bases__:
|
||||
@@ -74,13 +81,13 @@ def getCallTip(command='', locals=None):
|
||||
dropSelf = 0
|
||||
if hasattr(object, '__name__'): # Make sure this is a useable object.
|
||||
# Switch to the object that has the information we need.
|
||||
if inspect.ismethod(object):
|
||||
# Get the function from the object otherwise inspec.getargspec()
|
||||
if inspect.ismethod(object) or hasattr(object, 'im_func'):
|
||||
# Get the function from the object otherwise inspect.getargspec()
|
||||
# complains that the object isn't a Python function.
|
||||
object = object.im_func
|
||||
dropSelf = 1
|
||||
elif inspect.isclass(object):
|
||||
# Get the __init__ method for the class.
|
||||
# Get the __init__ method function for the class.
|
||||
try:
|
||||
object = object.__init__.im_func
|
||||
dropSelf = 1
|
||||
@@ -92,10 +99,11 @@ def getCallTip(command='', locals=None):
|
||||
dropSelf = 1
|
||||
break
|
||||
name = object.__name__
|
||||
tip1 = ''
|
||||
if inspect.isbuiltin(object):
|
||||
# Builtin functions don't have an argspec that we can get.
|
||||
tip1 = ''
|
||||
else:
|
||||
pass
|
||||
elif inspect.isfunction(object):
|
||||
# tip1 is a string like: "getCallTip(command='', locals=None)"
|
||||
argspec = apply(inspect.formatargspec, inspect.getargspec(object))
|
||||
if dropSelf:
|
||||
@@ -129,7 +137,7 @@ def getRoot(command, terminator=None):
|
||||
|
||||
The command would normally terminate with a "(" or ".". Anything after
|
||||
the terminator will be dropped, allowing you to get back to the root.
|
||||
Return only the root portion that can be eval()'d without side effect.
|
||||
Return only the root portion that can be eval()'d without side effects.
|
||||
"""
|
||||
root = ''
|
||||
validChars = "._" + string.uppercase + string.lowercase + string.digits
|
||||
@@ -151,7 +159,7 @@ def getRoot(command, terminator=None):
|
||||
# Detect situations where we are in the middle of a string.
|
||||
# This code catches the simplest case, but needs to catch others.
|
||||
if command[i-1] in ("'", '"'):
|
||||
# Were in the middle of a string so we aren't dealing with an
|
||||
# We're in the middle of a string so we aren't dealing with an
|
||||
# object and it would be misleading to return anything here.
|
||||
root = ''
|
||||
else:
|
||||
@@ -159,3 +167,4 @@ def getRoot(command, terminator=None):
|
||||
root = command[i:]
|
||||
return root
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,4 +7,4 @@ __cvsid__ = "$Id$"
|
||||
__date__ = "July 1, 2001"
|
||||
__version__ = "$Revision$"[11:-2]
|
||||
|
||||
VERSION = '0.6'
|
||||
VERSION = '0.7'
|
||||
|
||||
Reference in New Issue
Block a user