PyCrust update
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -104,14 +104,18 @@ class FillingTree(wxTreeCtrl):
|
|||||||
self.setText('')
|
self.setText('')
|
||||||
return
|
return
|
||||||
object = self.GetPyData(item)
|
object = self.GetPyData(item)
|
||||||
|
otype = type(object)
|
||||||
text = ''
|
text = ''
|
||||||
text += self.getFullName(item)
|
text += self.getFullName(item)
|
||||||
text += '\n\nType: ' + str(type(object))
|
text += '\n\nType: ' + str(otype)
|
||||||
|
try:
|
||||||
value = str(object)
|
value = str(object)
|
||||||
if type(object) is types.StringType:
|
except:
|
||||||
value = repr(value)
|
value = ''
|
||||||
|
if otype is types.StringType or otype is types.UnicodeType:
|
||||||
|
value = repr(object)
|
||||||
text += '\n\nValue: ' + value
|
text += '\n\nValue: ' + value
|
||||||
if type(object) is types.InstanceType:
|
if otype is types.InstanceType:
|
||||||
try:
|
try:
|
||||||
text += '\n\nClass Definition:\n\n' + \
|
text += '\n\nClass Definition:\n\n' + \
|
||||||
inspect.getsource(object.__class__)
|
inspect.getsource(object.__class__)
|
||||||
|
@@ -75,7 +75,12 @@ def getAllAttributeNames(object):
|
|||||||
# !!! because it is unreliable with remote objects - xmlrpc, soap, etc.
|
# !!! because it is unreliable with remote objects - xmlrpc, soap, etc.
|
||||||
# !!! They always return true for hasattr().
|
# !!! They always return true for hasattr().
|
||||||
# !!!
|
# !!!
|
||||||
|
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)
|
key = str(object)
|
||||||
|
except:
|
||||||
|
key = 'anonymous'
|
||||||
# Wake up sleepy objects - a hack for ZODB objects in "ghost" state.
|
# Wake up sleepy objects - a hack for ZODB objects in "ghost" state.
|
||||||
wakeupcall = dir(object)
|
wakeupcall = dir(object)
|
||||||
del wakeupcall
|
del wakeupcall
|
||||||
|
@@ -176,6 +176,8 @@ class Shell(wxStyledTextCtrl):
|
|||||||
# Assign handlers for keyboard events.
|
# Assign handlers for keyboard events.
|
||||||
EVT_KEY_DOWN(self, self.OnKeyDown)
|
EVT_KEY_DOWN(self, self.OnKeyDown)
|
||||||
EVT_CHAR(self, self.OnChar)
|
EVT_CHAR(self, self.OnChar)
|
||||||
|
# Assign handlers for wxSTC events.
|
||||||
|
EVT_STC_UPDATEUI(self, id, self.OnUpdateUI)
|
||||||
# Configure various defaults and user preferences.
|
# Configure various defaults and user preferences.
|
||||||
self.config()
|
self.config()
|
||||||
# Display the introductory banner information.
|
# Display the introductory banner information.
|
||||||
@@ -291,6 +293,37 @@ class Shell(wxStyledTextCtrl):
|
|||||||
self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F")
|
self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F")
|
||||||
self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)
|
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):
|
def OnChar(self, event):
|
||||||
"""Keypress event handler.
|
"""Keypress event handler.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user