home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / xbmc-9.11.exe / system / python / spyce / spyceModule.py < prev    next >
Encoding:
Python Source  |  2009-12-23  |  1.6 KB  |  56 lines

  1. ##################################################
  2. # SPYCE - Python-based HTML Scripting
  3. # Copyright (c) 2002 Rimon Barr.
  4. #
  5. # Refer to spyce.py
  6. # CVS: $Id: spyceModule.py 20864 2009-06-02 06:16:47Z ceros7 $
  7. ##################################################
  8.  
  9. __doc__ = '''Spyce modules functionality.'''
  10.  
  11. ##################################################
  12. # Spyce module
  13. #
  14.  
  15. class spyceModule:
  16.   "All Spyce module should subclass this."
  17.   def __init__(self, wrapper):
  18.     self._api = wrapper
  19.   def start(self):
  20.     pass
  21.   def finish(self, theError=None):
  22.     pass
  23.   def init(self, *args, **kwargs):
  24.     pass
  25.   def __repr__(self):
  26.     return 'no information, '+str(self.__class__)
  27.  
  28. class spyceModulePlus(spyceModule):
  29.   def __init__(self, wrapper):
  30.     spyceModule.__init__(self, wrapper)
  31.     self.wrapper = self._api  # deprecated
  32.     self.modules = moduleFinder(wrapper)
  33.     self.globals = wrapper.getGlobals()
  34.  
  35. class moduleFinder:
  36.   def __init__(self, wrapper):
  37.     self._wrapper = wrapper
  38.   def __getattr__(self, name):
  39.     return self._wrapper.getModule(name)
  40.  
  41. ##################################################
  42. # Spyce module API
  43. #
  44.  
  45. spyceModuleAPI = [ 'getFilename', 'getCode', 
  46.   'getCodeRefs', 'getModRefs', 
  47.   'getServerObject', 'getServerGlobals', 'getServerID',
  48.   'getModules', 'getModule', 'setModule', 'getGlobals', 
  49.   'registerModuleCallback', 'unregisterModuleCallback',
  50.   'getRequest', 'getResponse', 'setResponse',
  51.   'registerResponseCallback', 'unregisterResponseCallback', 
  52.   'spyceString', 'spyceFile', 'spyceModule', 'spyceTaglib',
  53.   'setStdout', 'getStdout',
  54. ]
  55.  
  56.