PyCrust update
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
09168de7a1
commit
6fc4b6483f
@ -104,14 +104,18 @@ class FillingTree(wxTreeCtrl):
|
||||
self.setText('')
|
||||
return
|
||||
object = self.GetPyData(item)
|
||||
otype = type(object)
|
||||
text = ''
|
||||
text += self.getFullName(item)
|
||||
text += '\n\nType: ' + str(type(object))
|
||||
value = str(object)
|
||||
if type(object) is types.StringType:
|
||||
value = repr(value)
|
||||
text += '\n\nType: ' + str(otype)
|
||||
try:
|
||||
value = str(object)
|
||||
except:
|
||||
value = ''
|
||||
if otype is types.StringType or otype is types.UnicodeType:
|
||||
value = repr(object)
|
||||
text += '\n\nValue: ' + value
|
||||
if type(object) is types.InstanceType:
|
||||
if otype is types.InstanceType:
|
||||
try:
|
||||
text += '\n\nClass Definition:\n\n' + \
|
||||
inspect.getsource(object.__class__)
|
||||
|
@ -74,8 +74,13 @@ def getAllAttributeNames(object):
|
||||
# !!! Do Not use hasattr() as a test anywhere in this function,
|
||||
# !!! because it is unreliable with remote objects - xmlrpc, soap, etc.
|
||||
# !!! They always return true for hasattr().
|
||||
# !!!
|
||||
key = str(object)
|
||||
# !!!
|
||||
try:
|
||||
# Yes, this can fail if object is an instance of a class with
|
||||
# __str__ (or __repr__) having a bug or raising an exception. :-(
|
||||
key = str(object)
|
||||
except:
|
||||
key = 'anonymous'
|
||||
# Wake up sleepy objects - a hack for ZODB objects in "ghost" state.
|
||||
wakeupcall = dir(object)
|
||||
del wakeupcall
|
||||
|
@ -176,6 +176,8 @@ class Shell(wxStyledTextCtrl):
|
||||
# Assign handlers for keyboard events.
|
||||
EVT_KEY_DOWN(self, self.OnKeyDown)
|
||||
EVT_CHAR(self, self.OnChar)
|
||||
# Assign handlers for wxSTC events.
|
||||
EVT_STC_UPDATEUI(self, id, self.OnUpdateUI)
|
||||
# Configure various defaults and user preferences.
|
||||
self.config()
|
||||
# Display the introductory banner information.
|
||||
@ -291,6 +293,37 @@ class Shell(wxStyledTextCtrl):
|
||||
self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F")
|
||||
self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)
|
||||
|
||||
def OnUpdateUI(self, evt):
|
||||
"""Check for matching braces."""
|
||||
braceAtCaret = -1
|
||||
braceOpposite = -1
|
||||
charBefore = None
|
||||
caretPos = self.GetCurrentPos()
|
||||
if caretPos > 0:
|
||||
charBefore = self.GetCharAt(caretPos - 1)
|
||||
styleBefore = self.GetStyleAt(caretPos - 1)
|
||||
|
||||
# Check before.
|
||||
if charBefore and chr(charBefore) in '[]{}()' \
|
||||
and styleBefore == wxSTC_P_OPERATOR:
|
||||
braceAtCaret = caretPos - 1
|
||||
|
||||
# Check after.
|
||||
if braceAtCaret < 0:
|
||||
charAfter = self.GetCharAt(caretPos)
|
||||
styleAfter = self.GetStyleAt(caretPos)
|
||||
if charAfter and chr(charAfter) in '[]{}()' \
|
||||
and styleAfter == wxSTC_P_OPERATOR:
|
||||
braceAtCaret = caretPos
|
||||
|
||||
if braceAtCaret >= 0:
|
||||
braceOpposite = self.BraceMatch(braceAtCaret)
|
||||
|
||||
if braceAtCaret != -1 and braceOpposite == -1:
|
||||
self.BraceBadLight(braceAtCaret)
|
||||
else:
|
||||
self.BraceHighlight(braceAtCaret, braceOpposite)
|
||||
|
||||
def OnChar(self, event):
|
||||
"""Keypress event handler.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user