0001 0002 import sys 0003 import time 0004 0005 class Tools: 0006 _public_methods_ = [ 'reload', 'adddir', 'echo', 'sleep' ] 0007 0008 def reload(self, module): 0009 if sys.modules.has_key(module): 0010 reload(sys.modules[module]) 0011 return "reload succeeded." 0012 return "no reload performed." 0013 0014 def adddir(self, dir): 0015 if type(dir) == type(''): 0016 sys.path.append(dir) 0017 return str(sys.path) 0018 0019 def echo(self, arg): 0020 return `arg` 0021 0022 def sleep(self, t): 0023 time.sleep(t) 0024 0025 0026 if __name__=='__main__': 0027 from win32com.server.register import RegisterServer, UnregisterServer 0028 clsid = "{06ce7630-1d81-11d0-ae37-c2fa70000000}" 0029 progid = "Python.Tools" 0030 verprogid = "Python.Tools.1" 0031 if "--unregister" in sys.argv: 0032 print "Unregistering..." 0033 UnregisterServer(clsid, progid, verprogid) 0034 print "Unregistered OK" 0035 else: 0036 print "Registering COM server..." 0037 RegisterServer(clsid, 0038 "win32com.servers.PythonTools.Tools", 0039 "Python Tools", 0040 progid, 0041 verprogid) 0042 print "Class registered." 0043
Generated by PyXR 0.9.4