X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ef752932bd40c566f0ea003f78e48a00c8295a9..54af9b8b5e0f2fcd0eb0b122c2c2de561a51be23:/wxPython/src/gtk/xrc.py diff --git a/wxPython/src/gtk/xrc.py b/wxPython/src/gtk/xrc.py index e5bdb94fb8..5bbd09e39e 100644 --- a/wxPython/src/gtk/xrc.py +++ b/wxPython/src/gtk/xrc.py @@ -1,4 +1,4 @@ -# This file was created automatically by SWIG. +# This file was created automatically by SWIG 1.3.29. # Don't modify this file, modify the SWIG interface instead. """ @@ -7,6 +7,54 @@ controls on a panel, etc. to be loaded from an XML file. """ import _xrc +import new +new_instancemethod = new.instancemethod +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'PySwigObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static) or hasattr(self,name): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError,name + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +import types +try: + _object = types.ObjectType + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 +del types + + +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + import _core wx = _core @@ -21,22 +69,16 @@ XRC_USE_LOCALE = _xrc.XRC_USE_LOCALE XRC_NO_SUBCLASSING = _xrc.XRC_NO_SUBCLASSING XRC_NO_RELOADING = _xrc.XRC_NO_RELOADING class XmlResource(_core.Object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxXmlResource instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): - """__init__(self, String filemask, int flags=XRC_USE_LOCALE) -> XmlResource""" - newobj = _xrc.new_XmlResource(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown + """Proxy of C++ XmlResource class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + """__init__(self, String filemask, int flags=XRC_USE_LOCALE, String domain=wxEmptyString) -> XmlResource""" + _xrc.XmlResource_swiginit(self,_xrc.new_XmlResource(*args, **kwargs)) self.InitAllHandlers() - def __del__(self, destroy=_xrc.delete_XmlResource): - """__del__(self)""" - try: - if self.thisown: destroy(self) - except: pass - + __swig_destroy__ = _xrc.delete_XmlResource + __del__ = lambda self : None; def Load(*args, **kwargs): """Load(self, String filemask) -> bool""" return _xrc.XmlResource_Load(*args, **kwargs) @@ -45,6 +87,10 @@ class XmlResource(_core.Object): """LoadFromString(self, String data) -> bool""" return _xrc.XmlResource_LoadFromString(*args, **kwargs) + def Unload(*args, **kwargs): + """Unload(self, String filename) -> bool""" + return _xrc.XmlResource_Unload(*args, **kwargs) + def InitAllHandlers(*args, **kwargs): """InitAllHandlers(self)""" return _xrc.XmlResource_InitAllHandlers(*args, **kwargs) @@ -127,7 +173,7 @@ class XmlResource(_core.Object): return _xrc.XmlResource_AttachUnknownControl(*args, **kwargs) def GetXRCID(*args, **kwargs): - """GetXRCID(String str_id) -> int""" + """GetXRCID(String str_id, int value_if_not_found=ID_NONE) -> int""" return _xrc.XmlResource_GetXRCID(*args, **kwargs) GetXRCID = staticmethod(GetXRCID) @@ -157,13 +203,18 @@ class XmlResource(_core.Object): """SetFlags(self, int flags)""" return _xrc.XmlResource_SetFlags(*args, **kwargs) + def GetDomain(*args, **kwargs): + """GetDomain(self) -> String""" + return _xrc.XmlResource_GetDomain(*args, **kwargs) -class XmlResourcePtr(XmlResource): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlResource -_xrc.XmlResource_swigregister(XmlResourcePtr) + def SetDomain(*args, **kwargs): + """SetDomain(self, String domain)""" + return _xrc.XmlResource_SetDomain(*args, **kwargs) + + Domain = property(GetDomain,SetDomain,doc="See `GetDomain` and `SetDomain`") + Flags = property(GetFlags,SetFlags,doc="See `GetFlags` and `SetFlags`") + Version = property(GetVersion,doc="See `GetVersion`") +_xrc.XmlResource_swigregister(XmlResource) cvar = _xrc.cvar UTF8String = cvar.UTF8String StyleString = cvar.StyleString @@ -172,32 +223,32 @@ PosString = cvar.PosString BitmapString = cvar.BitmapString IconString = cvar.IconString FontString = cvar.FontString +AnimationString = cvar.AnimationString def EmptyXmlResource(*args, **kwargs): - """EmptyXmlResource(int flags=XRC_USE_LOCALE) -> XmlResource""" + """EmptyXmlResource(int flags=XRC_USE_LOCALE, String domain=wxEmptyString) -> XmlResource""" val = _xrc.new_EmptyXmlResource(*args, **kwargs) - val.thisown = 1 val.InitAllHandlers() return val def XmlResource_AddSubclassFactory(*args, **kwargs): - """XmlResource_AddSubclassFactory(XmlSubclassFactory factory)""" - return _xrc.XmlResource_AddSubclassFactory(*args, **kwargs) + """XmlResource_AddSubclassFactory(XmlSubclassFactory factory)""" + return _xrc.XmlResource_AddSubclassFactory(*args, **kwargs) def XmlResource_GetXRCID(*args, **kwargs): - """XmlResource_GetXRCID(String str_id) -> int""" - return _xrc.XmlResource_GetXRCID(*args, **kwargs) + """XmlResource_GetXRCID(String str_id, int value_if_not_found=ID_NONE) -> int""" + return _xrc.XmlResource_GetXRCID(*args, **kwargs) -def XmlResource_Get(*args, **kwargs): - """XmlResource_Get() -> XmlResource""" - return _xrc.XmlResource_Get(*args, **kwargs) +def XmlResource_Get(*args): + """XmlResource_Get() -> XmlResource""" + return _xrc.XmlResource_Get(*args) def XmlResource_Set(*args, **kwargs): - """XmlResource_Set(XmlResource res) -> XmlResource""" - return _xrc.XmlResource_Set(*args, **kwargs) + """XmlResource_Set(XmlResource res) -> XmlResource""" + return _xrc.XmlResource_Set(*args, **kwargs) -def XRCID(str_id): - return XmlResource_GetXRCID(str_id) +def XRCID(str_id, value_if_not_found = wx.ID_NONE): + return XmlResource_GetXRCID(str_id, value_if_not_found) def XRCCTRL(window, str_id, *ignoreargs): return window.FindWindowById(XRCID(str_id)) @@ -205,27 +256,19 @@ def XRCCTRL(window, str_id, *ignoreargs): #--------------------------------------------------------------------------- class XmlSubclassFactory(object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxPyXmlSubclassFactory instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): + """Proxy of C++ XmlSubclassFactory class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): """__init__(self) -> XmlSubclassFactory""" - newobj = _xrc.new_XmlSubclassFactory(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown + _xrc.XmlSubclassFactory_swiginit(self,_xrc.new_XmlSubclassFactory(*args, **kwargs)) self._setCallbackInfo(self, XmlSubclassFactory) def _setCallbackInfo(*args, **kwargs): """_setCallbackInfo(self, PyObject self, PyObject _class)""" return _xrc.XmlSubclassFactory__setCallbackInfo(*args, **kwargs) - -class XmlSubclassFactoryPtr(XmlSubclassFactory): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlSubclassFactory -_xrc.XmlSubclassFactory_swigregister(XmlSubclassFactoryPtr) +_xrc.XmlSubclassFactory_swigregister(XmlSubclassFactory) #--------------------------------------------------------------------------- @@ -243,17 +286,15 @@ XML_DOCUMENT_FRAG_NODE = _xrc.XML_DOCUMENT_FRAG_NODE XML_NOTATION_NODE = _xrc.XML_NOTATION_NODE XML_HTML_DOCUMENT_NODE = _xrc.XML_HTML_DOCUMENT_NODE class XmlProperty(object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxXmlProperty instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): + """Proxy of C++ XmlProperty class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): """ __init__(self, String name=EmptyString, String value=EmptyString, XmlProperty next=None) -> XmlProperty """ - newobj = _xrc.new_XmlProperty(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown + _xrc.XmlProperty_swiginit(self,_xrc.new_XmlProperty(*args, **kwargs)) def GetName(*args, **kwargs): """GetName(self) -> String""" return _xrc.XmlProperty_GetName(*args, **kwargs) @@ -278,39 +319,30 @@ class XmlProperty(object): """SetNext(self, XmlProperty next)""" return _xrc.XmlProperty_SetNext(*args, **kwargs) - -class XmlPropertyPtr(XmlProperty): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlProperty -_xrc.XmlProperty_swigregister(XmlPropertyPtr) + Name = property(GetName,SetName,doc="See `GetName` and `SetName`") + Next = property(GetNext,SetNext,doc="See `GetNext` and `SetNext`") + Value = property(GetValue,SetValue,doc="See `GetValue` and `SetValue`") +_xrc.XmlProperty_swigregister(XmlProperty) class XmlNode(object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxXmlNode instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): + """Proxy of C++ XmlNode class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): """ __init__(self, XmlNode parent=None, int type=0, String name=EmptyString, String content=EmptyString, XmlProperty props=None, XmlNode next=None) -> XmlNode """ - newobj = _xrc.new_XmlNode(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown - def __del__(self, destroy=_xrc.delete_XmlNode): - """__del__(self)""" - try: - if self.thisown: destroy(self) - except: pass - + _xrc.XmlNode_swiginit(self,_xrc.new_XmlNode(*args, **kwargs)) + __swig_destroy__ = _xrc.delete_XmlNode + __del__ = lambda self : None; def AddChild(*args, **kwargs): """AddChild(self, XmlNode child)""" return _xrc.XmlNode_AddChild(*args, **kwargs) def InsertChild(*args, **kwargs): - """InsertChild(self, XmlNode child, XmlNode before_node)""" + """InsertChild(self, XmlNode child, XmlNode before_node) -> bool""" return _xrc.XmlNode_InsertChild(*args, **kwargs) def RemoveChild(*args, **kwargs): @@ -341,6 +373,18 @@ class XmlNode(object): """GetContent(self) -> String""" return _xrc.XmlNode_GetContent(*args, **kwargs) + def IsWhitespaceOnly(*args, **kwargs): + """IsWhitespaceOnly(self) -> bool""" + return _xrc.XmlNode_IsWhitespaceOnly(*args, **kwargs) + + def GetDepth(*args, **kwargs): + """GetDepth(self, XmlNode grandparent=None) -> int""" + return _xrc.XmlNode_GetDepth(*args, **kwargs) + + def GetNodeContent(*args, **kwargs): + """GetNodeContent(self) -> String""" + return _xrc.XmlNode_GetNodeContent(*args, **kwargs) + def GetParent(*args, **kwargs): """GetParent(self) -> XmlNode""" return _xrc.XmlNode_GetParent(*args, **kwargs) @@ -393,49 +437,46 @@ class XmlNode(object): """SetProperties(self, XmlProperty prop)""" return _xrc.XmlNode_SetProperties(*args, **kwargs) - -class XmlNodePtr(XmlNode): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlNode -_xrc.XmlNode_swigregister(XmlNodePtr) + Children = property(GetChildren,SetChildren,doc="See `GetChildren` and `SetChildren`") + Content = property(GetContent,SetContent,doc="See `GetContent` and `SetContent`") + Name = property(GetName,SetName,doc="See `GetName` and `SetName`") + Next = property(GetNext,SetNext,doc="See `GetNext` and `SetNext`") + Parent = property(GetParent,SetParent,doc="See `GetParent` and `SetParent`") + Properties = property(GetProperties,SetProperties,doc="See `GetProperties` and `SetProperties`") + Type = property(GetType,SetType,doc="See `GetType` and `SetType`") +_xrc.XmlNode_swigregister(XmlNode) def XmlNodeEasy(*args, **kwargs): """XmlNodeEasy(int type, String name, String content=EmptyString) -> XmlNode""" val = _xrc.new_XmlNodeEasy(*args, **kwargs) - val.thisown = 1 return val +XML_NO_INDENTATION = _xrc.XML_NO_INDENTATION +XMLDOC_NONE = _xrc.XMLDOC_NONE +XMLDOC_KEEP_WHITESPACE_NODES = _xrc.XMLDOC_KEEP_WHITESPACE_NODES class XmlDocument(_core.Object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxXmlDocument instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): + """Proxy of C++ XmlDocument class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): """__init__(self, String filename, String encoding=UTF8String) -> XmlDocument""" - newobj = _xrc.new_XmlDocument(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown - def __del__(self, destroy=_xrc.delete_XmlDocument): - """__del__(self)""" - try: - if self.thisown: destroy(self) - except: pass - + _xrc.XmlDocument_swiginit(self,_xrc.new_XmlDocument(*args, **kwargs)) + __swig_destroy__ = _xrc.delete_XmlDocument + __del__ = lambda self : None; def Load(*args, **kwargs): - """Load(self, String filename, String encoding=UTF8String) -> bool""" + """Load(self, String filename, String encoding=UTF8String, int flags=XMLDOC_NONE) -> bool""" return _xrc.XmlDocument_Load(*args, **kwargs) def LoadFromStream(*args, **kwargs): - """LoadFromStream(self, InputStream stream, String encoding=UTF8String) -> bool""" + """LoadFromStream(self, InputStream stream, String encoding=UTF8String, int flags=XMLDOC_NONE) -> bool""" return _xrc.XmlDocument_LoadFromStream(*args, **kwargs) def Save(*args, **kwargs): - """Save(self, String filename) -> bool""" + """Save(self, String filename, int indentstep=1) -> bool""" return _xrc.XmlDocument_Save(*args, **kwargs) def SaveToStream(*args, **kwargs): - """SaveToStream(self, OutputStream stream) -> bool""" + """SaveToStream(self, OutputStream stream, int indentstep=1) -> bool""" return _xrc.XmlDocument_SaveToStream(*args, **kwargs) def IsOk(*args, **kwargs): @@ -454,6 +495,10 @@ class XmlDocument(_core.Object): """GetFileEncoding(self) -> String""" return _xrc.XmlDocument_GetFileEncoding(*args, **kwargs) + def DetachRoot(*args, **kwargs): + """DetachRoot(self) -> XmlNode""" + return _xrc.XmlDocument_DetachRoot(*args, **kwargs) + def SetRoot(*args, **kwargs): """SetRoot(self, XmlNode node)""" return _xrc.XmlDocument_SetRoot(*args, **kwargs) @@ -466,39 +511,34 @@ class XmlDocument(_core.Object): """SetFileEncoding(self, String encoding)""" return _xrc.XmlDocument_SetFileEncoding(*args, **kwargs) - -class XmlDocumentPtr(XmlDocument): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlDocument -_xrc.XmlDocument_swigregister(XmlDocumentPtr) + FileEncoding = property(GetFileEncoding,SetFileEncoding,doc="See `GetFileEncoding` and `SetFileEncoding`") + Root = property(GetRoot,SetRoot,doc="See `GetRoot` and `SetRoot`") + Version = property(GetVersion,SetVersion,doc="See `GetVersion` and `SetVersion`") +_xrc.XmlDocument_swigregister(XmlDocument) def XmlDocumentFromStream(*args, **kwargs): """XmlDocumentFromStream(InputStream stream, String encoding=UTF8String) -> XmlDocument""" val = _xrc.new_XmlDocumentFromStream(*args, **kwargs) - val.thisown = 1 return val def EmptyXmlDocument(*args, **kwargs): """EmptyXmlDocument() -> XmlDocument""" val = _xrc.new_EmptyXmlDocument(*args, **kwargs) - val.thisown = 1 return val #--------------------------------------------------------------------------- class XmlResourceHandler(_core.Object): - def __repr__(self): - return "<%s.%s; proxy of C++ wxPyXmlResourceHandler instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) - def __init__(self, *args, **kwargs): + """Proxy of C++ XmlResourceHandler class""" + thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): """__init__(self) -> XmlResourceHandler""" - newobj = _xrc.new_XmlResourceHandler(*args, **kwargs) - self.this = newobj.this - self.thisown = 1 - del newobj.thisown + _xrc.XmlResourceHandler_swiginit(self,_xrc.new_XmlResourceHandler(*args, **kwargs)) self._setCallbackInfo(self, XmlResourceHandler) + __swig_destroy__ = _xrc.delete_XmlResourceHandler + __del__ = lambda self : None; def _setCallbackInfo(*args, **kwargs): """_setCallbackInfo(self, PyObject self, PyObject _class)""" return _xrc.XmlResourceHandler__setCallbackInfo(*args, **kwargs) @@ -535,10 +575,6 @@ class XmlResourceHandler(_core.Object): """GetParentAsWindow(self) -> Window""" return _xrc.XmlResourceHandler_GetParentAsWindow(*args, **kwargs) - def GetInstanceAsWindow(*args, **kwargs): - """GetInstanceAsWindow(self) -> Window""" - return _xrc.XmlResourceHandler_GetInstanceAsWindow(*args, **kwargs) - def IsOfClass(*args, **kwargs): """IsOfClass(self, XmlNode node, String classname) -> bool""" return _xrc.XmlResourceHandler_IsOfClass(*args, **kwargs) @@ -625,6 +661,10 @@ class XmlResourceHandler(_core.Object): """GetFont(self, String param=FontString) -> Font""" return _xrc.XmlResourceHandler_GetFont(*args, **kwargs) + def GetAnimation(*args, **kwargs): + """GetAnimation(self, String param=AnimationString) -> wxAnimation""" + return _xrc.XmlResourceHandler_GetAnimation(*args, **kwargs) + def SetupWindow(*args, **kwargs): """SetupWindow(self, Window wnd)""" return _xrc.XmlResourceHandler_SetupWindow(*args, **kwargs) @@ -645,13 +685,16 @@ class XmlResourceHandler(_core.Object): """GetCurFileSystem(self) -> FileSystem""" return _xrc.XmlResourceHandler_GetCurFileSystem(*args, **kwargs) - -class XmlResourceHandlerPtr(XmlResourceHandler): - def __init__(self, this): - self.this = this - if not hasattr(self,"thisown"): self.thisown = 0 - self.__class__ = XmlResourceHandler -_xrc.XmlResourceHandler_swigregister(XmlResourceHandlerPtr) + Class = property(GetClass,doc="See `GetClass`") + CurFileSystem = property(GetCurFileSystem,doc="See `GetCurFileSystem`") + ID = property(GetID,doc="See `GetID`") + Instance = property(GetInstance,doc="See `GetInstance`") + Name = property(GetName,doc="See `GetName`") + Node = property(GetNode,doc="See `GetNode`") + Parent = property(GetParent,doc="See `GetParent`") + ParentAsWindow = property(GetParentAsWindow,doc="See `GetParentAsWindow`") + Resource = property(GetResource,doc="See `GetResource`") +_xrc.XmlResourceHandler_swigregister(XmlResourceHandler) #---------------------------------------------------------------------------- # The global was removed in favor of static accessor functions. This is for @@ -665,7 +708,12 @@ TheXmlResource = XmlResource_Get() def _my_import(name): - mod = __import__(name) + try: + mod = __import__(name) + except ImportError: + import traceback + print traceback.format_exc() + raise components = name.split('.') for comp in components[1:]: mod = getattr(mod, comp) @@ -691,3 +739,4 @@ XmlResource_AddSubclassFactory(XmlSubclassFactory_Python()) #---------------------------------------------------------------------------- +