| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 23 |
#~ Imports |
|---|
| 24 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 25 |
|
|---|
| 26 |
from RBSkinning.xmlPython import inline |
|---|
| 27 |
|
|---|
| 28 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 29 |
#~ Definitions |
|---|
| 30 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 31 |
|
|---|
| 32 |
class substitute_long(inline.inline): |
|---|
| 33 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 34 |
#~ Constants / Variables / Etc. |
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
|
|---|
| 37 |
default_settings = inline.inline.default_settings.copy() |
|---|
| 38 |
default_settings['attr'] = None |
|---|
| 39 |
default_settings['nsprefix'] = None |
|---|
| 40 |
default_settings['namespace'] = None |
|---|
| 41 |
default_settings['node'] = None |
|---|
| 42 |
|
|---|
| 43 |
_ObjectAsXML = 0 |
|---|
| 44 |
|
|---|
| 45 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 46 |
#~ Public Methods |
|---|
| 47 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 48 |
|
|---|
| 49 |
def SkinFinalize(self): |
|---|
| 50 |
result = inline.inline.SkinFinalize(self) |
|---|
| 51 |
|
|---|
| 52 |
if 'node' in self.source_settings: |
|---|
| 53 |
self.parent().__node__ = self.object |
|---|
| 54 |
elif 'ns' in self.source_settings: |
|---|
| 55 |
self.parent().__namespace__ = self.object |
|---|
| 56 |
elif 'namespace' in self.source_settings: |
|---|
| 57 |
self.parent().__namespace__ = self.object |
|---|
| 58 |
elif 'nsprefix' in self.source_settings: |
|---|
| 59 |
nsprefix = self.settings['nsprefix'] or '' |
|---|
| 60 |
self.parent().__namespace_map__.setxmlns(nsprefix, self.object) |
|---|
| 61 |
elif 'attr' in self.source_settings: |
|---|
| 62 |
self.parent().settings[self.settings['attr']] = self.object |
|---|
| 63 |
elif 'ctxvar' in self.source_settings: pass |
|---|
| 64 |
elif 'ctxnode' in self.source_settings: pass |
|---|
| 65 |
else: |
|---|
| 66 |
self._ObjectAsXML = 1 |
|---|
| 67 |
|
|---|
| 68 |
return result |
|---|
| 69 |
|
|---|
| 70 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 71 |
#~ Protected Methods |
|---|
| 72 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 73 |
|
|---|
| 74 |
def _toXML(self, strSplit='', *args, **kw): |
|---|
| 75 |
if self._ObjectAsXML: |
|---|
| 76 |
result = [str(self.object)] |
|---|
| 77 |
else: result = [] |
|---|
| 78 |
|
|---|
| 79 |
if strSplit is not None: return strSplit.join(result) |
|---|
| 80 |
else: return result |
|---|