| 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 RBFoundation.XMLClassBuilder import ElementFactory |
|---|
| 27 |
import evaluate |
|---|
| 28 |
|
|---|
| 29 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 30 |
#~ Class |
|---|
| 31 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 32 |
|
|---|
| 33 |
class element_factory(evaluate.evaluate): |
|---|
| 34 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 35 |
#~ Constants / Variables / Etc. |
|---|
| 36 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 37 |
|
|---|
| 38 |
default_settings = evaluate.evaluate.default_settings.copy() |
|---|
| 39 |
#default_settings ['namespace'] = '' |
|---|
| 40 |
#default_settings ['node'] = '' |
|---|
| 41 |
|
|---|
| 42 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 43 |
#~ Special |
|---|
| 44 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 45 |
|
|---|
| 46 |
def __init__(self, owner, parent, node, attributes, namespacemap): |
|---|
| 47 |
evaluate.evaluate.__init__(self, owner, parent, node, attributes, namespacemap) |
|---|
| 48 |
self.owner = owner |
|---|
| 49 |
|
|---|
| 50 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 51 |
#~ Protected Methods |
|---|
| 52 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 53 |
|
|---|
| 54 |
def _GetEvalLocals(self, **variables): |
|---|
| 55 |
result = evaluate.evaluate._GetEvalLocals(self, **variables) |
|---|
| 56 |
result['EF'] = ElementFactory |
|---|
| 57 |
result['ElementFactory'] = ElementFactory |
|---|
| 58 |
return result |
|---|
| 59 |
|
|---|
| 60 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 61 |
#~ Public Methods |
|---|
| 62 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 63 |
|
|---|
| 64 |
def SkinFinalize(self): |
|---|
| 65 |
evaluate.evaluate.SkinFinalize(self) |
|---|
| 66 |
if 'node' in self.settings: |
|---|
| 67 |
idx = (self.settings['namespace'], self.settings['node']) |
|---|
| 68 |
elif 'namespace' in self.settings: |
|---|
| 69 |
idx = (self.settings['namespace'], ) |
|---|
| 70 |
else: idx = None |
|---|
| 71 |
|
|---|
| 72 |
self.owner._GetModifableElementFactoryDict()[idx] = self.object |
|---|
| 73 |
|
|---|
| 74 |
del self.owner |
|---|
| 75 |
|
|---|