More updates to the docview library modules and sample apps from the

ActiveGrid folks.  Their sample IDE is now able to integrate with
Subversion.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2005-05-19 00:21:49 +00:00
parent 4809f5df5d
commit 6f1a3f9c1a
19 changed files with 1791 additions and 1064 deletions

View File

@@ -10,75 +10,19 @@
# License: wxWindows License
#----------------------------------------------------------------------------
import logging
import cStringIO
import traceback
import sys
import string
import os
def classForName(className):
pathList = className.split('.')
moduleName = string.join(pathList[:-1], '.')
code = __import__(moduleName)
for name in pathList[1:]:
code = code.__dict__[name]
return code
def _registerMainModuleDir():
global mainModuleDir
if sys.executable.find('python') != -1:
utilModuleDir = os.path.dirname(__file__)
if not os.path.isabs(utilModuleDir):
utilModuleDir = os.path.join(os.getcwd(), utilModuleDir)
mainModuleDir = os.path.normpath(os.path.join(utilModuleDir, os.path.join(os.path.pardir, os.path.pardir)))
else:
mainModuleDir = os.path.dirname(sys.executable)
def hasattrignorecase(object, name):
for attr in dir(object):
if attr.lower() == name.lower():
return True
for attr in dir(object):
if attr.lower() == '_' + name.lower():
return True
return False
def setattrignorecase(object, name, value):
for attr in object.__dict__:
if attr.lower() == name.lower():
object.__dict__[attr] = value
return
## for attr in dir(object):
## if attr.lower() == '_' + name.lower():
## object.__dict__[attr] = value
## return
object.__dict__[name] = value
def getattrignorecase(object, name):
for attr in object.__dict__:
if attr.lower() == name.lower():
return object.__dict__[attr]
## for attr in dir(object):
## if attr.lower() == '_' + name.lower():
## return object.__dict__[attr]
return object.__dict__[name]
def defaultLoad(fileObject, knownTypes=None):
xml = fileObject.read()
loadedObject = xmlmarshaller.unmarshal(xml, knownTypes=knownTypes)
if hasattr(fileObject, 'name'):
loadedObject.fileName = os.path.abspath(fileObject.name)
loadedObject.initialize()
return loadedObject
def defaultSave(fileObject, objectToSave, knownTypes=None):
xml = xmlmarshaller.marshal(objectToSave, prettyPrint=True, knownTypes=knownTypes)
fileObject.write(xml)
fileObject.close()
def clone(objectToClone):
xml = xmlmarshaller.marshal(objectToClone, prettyPrint=True)
clonedObject = xmlmarshaller.unmarshal(xml)
if hasattr(objectToClone, 'fileName'):
clonedObject.fileName = objectToClone.fileName
clonedObject.initialize()
return clonedObject
def exceptionToString(e):
sio = cStringIO.StringIO()
traceback.print_exception(e.__class__, e, sys.exc_traceback, file=sio)
return sio.getvalue()
_registerMainModuleDir()