root/trunk/RBSkinning/RBSkinning/xmlPython/script.py

Revision 343, 2.1 kB (checked in by sholloway, 6 years ago)

*** empty log message ***

Line 
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 PySkinObject import PySkinObject
27 import sys
28 import weakref
29
30 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 #~ Class
32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
34 class script(PySkinObject):
35     default_settings = PySkinObject.default_settings.copy()
36     #default_settings['module'] = None
37     #default_settings['call'] = None
38     default_settings['reload'] = '0'
39     default_settings['args'] = '(self,)'
40     default_settings['kw'] = '{}'
41
42     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43     #~ Public Methods
44     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
46     def ExecuteXML(self, **Variables):
47         bAddToSysPath = self.context.__root__ not in sys.path
48         if bAddToSysPath: sys.path.append(self.context.__root__)
49         module = __import__(self.settings['module'], {}, {}, self.settings['call'])
50         if int(self.settings['reload']):
51             reload(module)
52         call = getattr(module, self.settings['call'])
53         args = self.EvalLocal(self.settings['args'])
54         kw = self.EvalLocal(self.settings['kw'])
55         if bAddToSysPath: sys.path.remove(self.context.__root__)
56         return call(*args, **kw)
57
58     def _addData(self, data):
59         pass
60
Note: See TracBrowser for help on using the browser.