rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
sys.stdout = oldOut
def generate_child(self, child, dir): "Generate a single child. May force a few children to be built as we generate deps" self.generate_type = GEN_DEMAND_CHILD oldOut = sys.stdout
except "pythoncom.com_error":
except pythoncom.com_error:
def EnsureDispatch(prog_id, bForDemand = 0): """Given a COM prog_id, return an object that is using makepy support, building if necessary""" disp = win32com.client.Dispatch(prog_id) if not disp.__dict__.get("CLSID"): # Eeek - no makepy support - try and build it. try: ti = disp._oleobj_.GetTypeInfo() disp_clsid = ti.Ge...
try: name = clbrclass.name file = clbrclass.file lineno = clbrclass.lineno self.super = clbrclass.super self.methods = clbrclass.methods except AttributeError: name = clbrclass file = lineno = None self.super = []; self.methods = {}
name = clbrclass.name file = clbrclass.file lineno = clbrclass.lineno self.super = clbrclass.super self.methods = clbrclass.methods
def __init__(self, clbrclass, suffix = ""): try: name = clbrclass.name file = clbrclass.file lineno = clbrclass.lineno self.super = clbrclass.super self.methods = clbrclass.methods except AttributeError: name = clbrclass file = lineno = None self.super = []; self.methods = {} HierListCLBRItem.__init__(self, name, file,...
class HierListCLBRFunction(HierListCLBRClass):
class HierListCLBRFunction(HierListCLBRItem): def __init__(self, clbrfunc, suffix = ""): name = clbrfunc.name file = clbrfunc.file lineno = clbrfunc.lineno HierListCLBRItem.__init__(self, name, file, lineno, suffix)
def GetBitmapColumn(self): return 21
def Resolve(self): if self.dll is None: return 0 tlb = pythoncom.LoadTypeLib(self.dll) self.FromTypelib(tlb, None) return 1
def __cmp__(self, other): rc = cmp(string.lower(self.ver_desc or ""), string.lower(other.ver_desc or "")) if rc==0: rc = cmp(string.lower(self.desc), string.lower(other.desc)) if rc==0: rc = cmp(self.major, other.major) if rc==0: rc = cmp(self.major, other.minor) return rc
key2 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s" % (iid))
key2 = win32api.RegOpenKey(key, str(iid))
def EnumTlbs(excludeFlags = 0): """Return a list of TypelibSpec objects, one for each registered library. """ key = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib") iids = EnumKeys(key) results = [] for iid, crap in iids: key2 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s" % (iid)) for versio...
key3 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s\\%s" % (iid, version))
major_minor = string.split(version, '.', 1) if len(major_minor) < 2: major_minor.append('0') try: major = int(major_minor[0]) minor = int(major_minor[1]) except ValueError: continue key3 = win32api.RegOpenKey(key2, str(version))
def EnumTlbs(excludeFlags = 0): """Return a list of TypelibSpec objects, one for each registered library. """ key = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib") iids = EnumKeys(key) results = [] for iid, crap in iids: key2 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s" % (iid)) for versio...
key4 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s\\%s\\%s" % (iid, version, lcid)) for platform, dll in EnumKeys(key4): if platform=="win32": major = string.split(version, '.', 1) if len(major) < 2: major.append('0') try: major, minor = string.atoi(major[0], 16), string.atoi(major[1], 16) lcid = strin...
try: lcid = int(lcid) except ValueError: continue try: key4 = win32api.RegOpenKey(key3, "%s\win32" % (lcid,)) except win32api.error: continue try: dll = win32api.RegQueryValue(key4, None) except win32api.error: dll = None spec = TypelibSpec(iid, lcid, major, minor, flags) spec.dll = dll spec.desc = tlbdesc spec.ver_de...
def EnumTlbs(excludeFlags = 0): """Return a list of TypelibSpec objects, one for each registered library. """ key = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib") iids = EnumKeys(key) results = [] for iid, crap in iids: key2 = win32api.RegOpenKey(win32con.HKEY_CLASSES_ROOT, "Typelib\\%s" % (iid)) for versio...
if win32service.__file__.find("_d")>=0:
if os.path.splitext(win32service.__file__)[0].endswith("_d"):
def LocatePythonServiceExe(exeName = None): # Try and find the specified EXE somewhere. If specifically registered, # use it. Otherwise look down sys.path, and the global PATH environment. if exeName is None: if win32service.__file__.find("_d")>=0: exeName = "PythonService_d.exe" else: exeName = "PythonService.exe" #...
print self, "alive"
def __init__(self, oobj = None): print self, "alive" PyCOMTest.IPyCOMTestEvent.__init__(self, oobj) self.fireds = {}
def __del__(self): print self, "dead"
def __del__(self): print self, "dead"
print "ID %d fired %d times" % (firedId, no)
if verbose: print "ID %d fired %d times" % (firedId, no)
def _DumpFireds(self): if not self.fireds: print "ERROR: Nothing was recieved!" for firedId, no in self.fireds.items(): print "ID %d fired %d times" % (firedId, no)
connection = DebugConnection()
def TestGenerated(): # Create an instance of the server. o=PyCOMTest.CoPyCOMTest() counter = o.GetSimpleCounter() TestCounter(counter, 1) counter = win32com.client.Dispatch("PyCOMTest.SimpleCounter") TestCounter(counter, 1) i1, i2 = o.GetMultipleInterfaces() if type(i1) != types.InstanceType or type(i2) != types.Inst...
try: for i in range(2):
try: for i in range(3):
def TestGenerated(): # Create an instance of the server. o=PyCOMTest.CoPyCOMTest() counter = o.GetSimpleCounter() TestCounter(counter, 1) counter = win32com.client.Dispatch("PyCOMTest.SimpleCounter") TestCounter(counter, 1) i1, i2 = o.GetMultipleInterfaces() if type(i1) != types.InstanceType or type(i2) != types.Inst...
connection.Connect(o, handler) sessions.append(session) time.sleep(2)
connection = win32com.client.connect.SimpleConnection(o, handler) sessions.append((session, connection)) time.sleep(.5)
def TestGenerated(): # Create an instance of the server. o=PyCOMTest.CoPyCOMTest() counter = o.GetSimpleCounter() TestCounter(counter, 1) counter = win32com.client.Dispatch("PyCOMTest.SimpleCounter") TestCounter(counter, 1) i1, i2 = o.GetMultipleInterfaces() if type(i1) != types.InstanceType or type(i2) != types.Inst...
for session in sessions:
for session, connection in sessions:
def TestGenerated(): # Create an instance of the server. o=PyCOMTest.CoPyCOMTest() counter = o.GetSimpleCounter() TestCounter(counter, 1) counter = win32com.client.Dispatch("PyCOMTest.SimpleCounter") TestCounter(counter, 1) i1, i2 = o.GetMultipleInterfaces() if type(i1) != types.InstanceType or type(i2) != types.Inst...
if verbose: print "Disconnecting" connection.Disconnect()
def TestGenerated(): # Create an instance of the server. o=PyCOMTest.CoPyCOMTest() counter = o.GetSimpleCounter() TestCounter(counter, 1) counter = win32com.client.Dispatch("PyCOMTest.SimpleCounter") TestCounter(counter, 1) i1, i2 = o.GetMultipleInterfaces() if type(i1) != types.InstanceType or type(i2) != types.Inst...
verbose = 1
if "-q" not in sys.argv: verbose = 1
def NullThreadFunc(): pass
print "C++ test harness worked OK."
def NullThreadFunc(): pass
print "Successfully performed some basic tests of win32file!"
def Test(): # Create a file in the %TEMP% directory. testName = os.path.join( win32api.GetTempPath(), "win32filetest.dat" ) desiredAccess = win32file.GENERIC_READ | win32file.GENERIC_WRITE # Set a flag to delete the file automatically when it is closed. fileFlags = win32file.FILE_FLAG_DELETE_ON_CLOSE h = win32file.Crea...
def EnsureDispatch(prog_id, bForDemand = 0):
def EnsureDispatch(prog_id, bForDemand = 1):
def EnsureDispatch(prog_id, bForDemand = 0): """Given a COM prog_id, return an object that is using makepy support, building if necessary""" disp = win32com.client.Dispatch(prog_id) if not disp.__dict__.get("CLSID"): # Eeek - no makepy support - try and build it. try: ti = disp._oleobj_.GetTypeInfo() disp_clsid = ti.Ge...
if bRunInteractive: startType = startType | win32service.SERVICE_INTERACTIVE_PROCESS
serviceType = win32service.SERVICE_WIN32_OWN_PROCESS if bRunInteractive: serviceType = serviceType | win32service.SERVICE_INTERACTIVE_PROCESS
def InstallService(pythonClassString, serviceName, displayName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, perfMonIni = None, perfMonDll = None): # Handle the default arguments. if startType is None: startType = win32service.SERVICE_...
win32service.SERVICE_WIN32_OWN_PROCESS,
serviceType,
def InstallService(pythonClassString, serviceName, displayName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, perfMonIni = None, perfMonDll = None): # Handle the default arguments. if startType is None: startType = win32service.SERVICE_...
def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None):
def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, bRunInteractive = 0, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None):
def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None): # Before doing anything, remove any perfmon counters. try: import perfmon perfmon.UnloadPerfCoun...
win32service.SERVICE_NO_CHANGE,
serviceType,
def ChangeServiceConfig(pythonClassString, serviceName, startType = None, errorControl = None, serviceDeps = None, userName = None, password = None, exeName = None, displayName = None, perfMonIni = None, perfMonDll = None): # Before doing anything, remove any perfmon counters. try: import perfmon perfmon.UnloadPerfCoun...
opts, args = getopt.getopt(argv[1:], customInstallOptions,["password=","username=","startup=","perfmonini=", "perfmondll="])
opts, args = getopt.getopt(argv[1:], customInstallOptions,["password=","username=","startup=","perfmonini=", "perfmondll=", "interactive"])
def HandleCommandLine(cls, serviceClassString = None, argv = None, customInstallOptions = "", customOptionHandler = None): """Utility function allowing services to process the command line. Allows standard commands such as 'start', 'stop', 'debug', 'install' etc. Install supports 'standard' command line options prefi...
InstallService(serviceClassString, serviceName, serviceDisplayName, serviceDeps = serviceDeps, startType=startup, userName=userName,password=password, exeName=exeName, perfMonIni=perfMonIni,perfMonDll=perfMonDll)
InstallService(serviceClassString, serviceName, serviceDisplayName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, perfMonIni=perfMonIni,perfMonDll=perfMonDll)
def HandleCommandLine(cls, serviceClassString = None, argv = None, customInstallOptions = "", customOptionHandler = None): """Utility function allowing services to process the command line. Allows standard commands such as 'start', 'stop', 'debug', 'install' etc. Install supports 'standard' command line options prefi...
ChangeServiceConfig(serviceClassString, serviceName, serviceDeps = serviceDeps, startType=startup, userName=userName,password=password, exeName=exeName, displayName = serviceDisplayName, perfMonIni=perfMonIni,perfMonDll=perfMonDll)
ChangeServiceConfig(serviceClassString, serviceName, serviceDeps = serviceDeps, startType=startup, bRunInteractive=interactive, userName=userName,password=password, exeName=exeName, displayName = serviceDisplayName, perfMonIni=perfMonIni,perfMonDll=perfMonDll)
def HandleCommandLine(cls, serviceClassString = None, argv = None, customInstallOptions = "", customOptionHandler = None): """Utility function allowing services to process the command line. Allows standard commands such as 'start', 'stop', 'debug', 'install' etc. Install supports 'standard' command line options prefi...
if not kw.has_key("dsp_file"):
if not kw.has_key("dsp_file") and not kw.get("sources"):
def __init__ (self, name, **kw): if not kw.has_key("dsp_file"): kw["dsp_file"] = "pythonwin/" + name + ".dsp" kw.setdefault("extra_compile_args", []).extend( ['-D_AFXDLL', '-D_AFXEXT','-D_MBCS']) WinExt.__init__(self, name, **kw)
if not kw.has_key("dsp_file"):
if not kw.has_key("dsp_file") and not kw.get("sources"):
def __init__ (self, name, **kw): if not kw.has_key("dsp_file"): kw["dsp_file"] = "com/" + name + ".dsp" kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32"
sources = ["win32/src/winxpgui.rc"], dsp_file = "win32/win32gui.dsp",
sources = """ win32/src/winxpgui.rc win32/src/win32dynamicdialog.cpp win32/src/win32gui.i win32/src/win32guimodule.cpp """.split(),
def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self)
dsp_file = None,
def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self)
WinExt_win32com('adsi', libraries="ACTIVEDS ADSIID"),
WinExt_win32com('adsi', libraries="ACTIVEDS ADSIID", sources=(""" %(adsi)s/adsi.i %(adsi)s/adsi.cpp %(adsi)s/PyIADsContainer.i %(adsi)s/PyIADsContainer.cpp %(adsi)s/PyIADsUser.i %(adsi)s/PyIADsUser.cpp %(adsi)s/PyIDirectoryObject.i %(adsi)s/PyIDirectoryObject.cpp %(adsi)s/PyIDirectorySe...
def finalize_options(self): if self.install_dir is None: installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self)
items = items_dict.keys()
items = map(str, items_dict.keys())
def list2dict(l): ret={} for i in l: ret[i] = None return ret
files = glob.glob(win32com.__gen_path__+ "\*.py") for file in files: name = os.path.splitext(os.path.split(file)[1])[0] if name[0] != '_': mod = _GetModule(name) print "%s - %s" % (mod.__doc__, name)
d = {} for clsid, (typelibCLSID, lcid, major, minor) in clsidToTypelib.items(): d[typelibCLSID, lcid, major, minor] = None for typelibCLSID, lcid, major, minor in d.keys(): mod = GetModuleForTypelib(typelibCLSID, lcid, major, minor) print "%s - %s" % (mod.__doc__, typelibCLSID)
def _Dump(): print "Cache is in directory", win32com.__gen_path__ files = glob.glob(win32com.__gen_path__+ "\*.py") for file in files: name = os.path.splitext(os.path.split(file)[1])[0] if name[0] != '_': mod = _GetModule(name) print "%s - %s" % (mod.__doc__, name)
usageString = """\ Usage: gencache [-q] [-d] [-r] -q - Quiet -d - Dump the cache (typelibrary description and filename). -r - Rebuild the cache dictionary from the existing .py files """
def _Dump(): print "Cache is in directory", win32com.__gen_path__ files = glob.glob(win32com.__gen_path__+ "\*.py") for file in files: name = os.path.splitext(os.path.split(file)[1])[0] if name[0] != '_': mod = _GetModule(name) print "%s - %s" % (mod.__doc__, name)
return project, string.join(retPaths, "/")
return project, string.join(retPaths, "/"), database
def FindVssProjectInfo(fullfname): """Looks up the file system for an INI file describing the project. Looking up the tree is for ni style packages. Returns (projectName, pathToFileName) where pathToFileName contains the path from the ini file to the actual file. """ path, fnameonly = os.path.split(fullfname) origPat...
myob = call_func(classSpec) self._wrap_(myob) return pythoncom.WrapObject(self, reqIID)
def _CreateInstance_(self, clsid, reqIID): """Creates a new instance of a **wrapped** object
self.SendScintilla(win32con.EM_SETSEL, start, end)
self.SendScintilla(EM_EXSETSEL, start, end)
def SetSel(self, start=0, end=None): if type(start)==type(()): assert end is None, "If you pass a point in the first param, the second must be None" start, end = start elif end is None: end = start if start < 0: start = self.GetTextLength() if end < 0: end = self.GetTextLength() assert start <= self.GetTextLength(), "T...
print "Got", i
def testEmptySpec(self): spec = os.path.join(os.getcwd(), "*.foo_bar") num = 0 for i in win32file.FindFilesIterator(spec): print "Got", i num += 1 self.failUnlessEqual(0, num)
shutil.rmtree(test_path)
os.rmdir(test_path)
def testEmptyDir(self): test_path = os.path.join(win32api.GetTempPath(), "win32file_test_directory") try: shutil.rmtree(test_path) except os.error: pass os.mkdir(test_path) try: num = 0 for i in win32file.FindFilesIterator(os.path.join(test_path, "*")): num += 1 # Expecting "." and ".." only self.failUnlessEqual(2, num...
oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch)
try: oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) except pythoncom.com_error, details: import winerror if details[0] != winerror.E_NOINTERFACE: raise oobj = oobj._oleobj_
def __init__(self, oobj=None): if oobj is None: oobj = pythoncom.new(self.CLSID) elif type(self) == type(oobj): # An instance oobj = oobj._oleobj_.QueryInterface(self.CLSID, pythoncom.IID_IDispatch) # Must be a valid COM instance self.__dict__["_oleobj_"] = oobj # so we dont call __setattr__
self.butReplaceAll.EnableWindow(bCanReplace)
def CheckButtonStates(self): # We can do a "Replace" or "Replace All" if the current selection # is the same as the search text. ft = self.editFindText.GetWindowText() control = _GetControl()
lastSearch.replaceText = self.editReplaceText.GetWindowText() num = 0 while _ReplaceIt(None) != FOUND_NOTHING: num = num + 1
control = _GetControl(None) control.SetSel(0) if self.DoFindNext() == FOUND_NORMAL: lastSearch.replaceText = self.editReplaceText.GetWindowText() num = 0 while _ReplaceIt(control) == FOUND_NORMAL: num = num + 1
def OnReplaceAll(self, id, code): lastSearch.replaceText = self.editReplaceText.GetWindowText() num = 0 while _ReplaceIt(None) != FOUND_NOTHING: num = num + 1
_com_interfaces_ = [ pythoncom.IID_IEnumVARIANT ]
def unwrap(ob): """Unwraps an interface. Given an interface which wraps up a Gateway, return the object behind the gateway. """ ob = pythoncom.UnwrapObject(ob) # see if the object is a dispatcher if hasattr(ob, 'policy'): ob = ob.policy return ob._obj_
def __init__(self, data, index=0):
def __init__(self, data, index=0, iid = pythoncom.IID_IEnumVARIANT):
def __init__(self, data, index=0): self._list_ = data self.index = index
def NewEnum(seq, cls=ListEnumerator):
def NewEnum(seq, cls=ListEnumerator, iid=pythoncom.IID_IEnumVARIANT, usePolicy=None, useDispatcher=None):
def NewEnum(seq, cls=ListEnumerator): """Creates a new enumerator COM server. This function creates a new COM Server that implements the IID_IEnumVARIANT interface. A COM server that can enumerate the passed in sequence will be created, then wrapped up for return through the COM framework. Optionally, a custom COM se...
(the default is @ListEnumerator@).
(the default is @ListEnumerator@), and the specific IEnum interface can be specified.
def NewEnum(seq, cls=ListEnumerator): """Creates a new enumerator COM server. This function creates a new COM Server that implements the IID_IEnumVARIANT interface. A COM server that can enumerate the passed in sequence will be created, then wrapped up for return through the COM framework. Optionally, a custom COM se...
return pythoncom.WrapObject(policy.DefaultPolicy(cls(seq)), pythoncom.IID_IEnumVARIANT, pythoncom.IID_IEnumVARIANT)
ob = cls(seq, iid=iid) return wrap(ob, iid, usePolicy=usePolicy, useDispatcher=useDispatcher)
def NewEnum(seq, cls=ListEnumerator): """Creates a new enumerator COM server. This function creates a new COM Server that implements the IID_IEnumVARIANT interface. A COM server that can enumerate the passed in sequence will be created, then wrapped up for return through the COM framework. Optionally, a custom COM se...
if not hasattr(sys, "frozen") and sys.platform.startswith("win"):
if not hasattr(sys, "frozen") and sys.platform.startswith("win") and \ sys.hexversion < 0x2040000:
def do_gen_file_header(self): la = self.typelib.GetLibAttr() moduleDoc = self.typelib.GetDocumentation(-1) docDesc = "" if moduleDoc[1]: docDesc = moduleDoc[1]
parentNode = built_nodes[parentModule].realNode
if parentModule in built_nodes: parentNode = built_nodes[parentModule].realNode
def BuildModule(module, built_nodes, rootNode, create_node_fn, create_node_args ): if module: keep = module.__name__ keep = keep and (built_nodes.get(module) is None) if keep and hasattr(module, '__file__'): keep = string.lower(os.path.splitext(module.__file__)[1]) not in [".pyd", ".dll"]
trace("ScriptEngine QI - unknown IID", iid)
def _query_interface_(self, iid): if self.debugManager: return self.debugManager._query_interface_for_debugger_(iid) trace("ScriptEngine QI - unknown IID", iid) return 0
def WriteSinkEventMap(obj): print '\t_dispid_to_func_ = {'
def WriteSinkEventMap(obj, stream): print >> stream, '\t_dispid_to_func_ = {'
def WriteSinkEventMap(obj): print '\t_dispid_to_func_ = {' for name, entry in obj.propMapGet.items() + obj.propMapPut.items() + obj.mapFuncs.items(): fdesc = entry.desc print '\t\t%9d : "%s",' % (entry.desc[0], MakeEventMethodName(entry.names[0])) print '\t\t}'
print '\t\t%9d : "%s",' % (entry.desc[0], MakeEventMethodName(entry.names[0])) print '\t\t}'
print >> stream, '\t\t%9d : "%s",' % (entry.desc[0], MakeEventMethodName(entry.names[0])) print >> stream, '\t\t}'
def WriteSinkEventMap(obj): print '\t_dispid_to_func_ = {' for name, entry in obj.propMapGet.items() + obj.propMapPut.items() + obj.mapFuncs.items(): fdesc = entry.desc print '\t\t%9d : "%s",' % (entry.desc[0], MakeEventMethodName(entry.names[0])) print '\t\t}'
def WriteAliasesForItem(item, aliasItems):
def WriteAliasesForItem(item, aliasItems, stream):
def WriteAliasesForItem(item, aliasItems): for alias in aliasItems.values(): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems)
alias.WriteAliasItem(aliasItems)
alias.WriteAliasItem(aliasItems, stream)
def WriteAliasesForItem(item, aliasItems): for alias in aliasItems.values(): if item.doc and alias.aliasDoc and (alias.aliasDoc[0]==item.doc[0]): alias.WriteAliasItem(aliasItems)
def WriteAliasItem(self, aliasDict):
def WriteAliasItem(self, aliasDict, stream):
def WriteAliasItem(self, aliasDict): # we could have been written as part of an alias dependency if self.bWritten: return
aliasDict[depName].WriteAliasItem(aliasDict) print self.doc[0] + " = " + depName
aliasDict[depName].WriteAliasItem(aliasDict, stream) print >> stream, self.doc[0] + " = " + depName
def WriteAliasItem(self, aliasDict): # we could have been written as part of an alias dependency if self.bWritten: return
print "
print >> stream, "
def WriteAliasItem(self, aliasDict): # we could have been written as part of an alias dependency if self.bWritten: return
print self.doc[0] + " = None print
print >> stream, self.doc[0] + " = None print >> stream
def WriteAliasItem(self, aliasDict): # we could have been written as part of an alias dependency if self.bWritten: return
def WriteEnumerationItems(self):
def WriteEnumerationItems(self, stream):
def WriteEnumerationItems(self): enumName = self.doc[0] # Write in name alpha order names = self.mapVars.keys() names.sort() for name in names: entry = self.mapVars[name] vdesc = entry.desc if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] if type(val)==type(0): if val==0x80000000L: # special case use = "0x80000000L" ...
print "\t%-30s=%-10s (build.MakePublicAttributeName(name, True), use, enumName)
print >> stream, "\t%-30s=%-10s (build.MakePublicAttributeName(name, True), use, enumName)
def WriteEnumerationItems(self): enumName = self.doc[0] # Write in name alpha order names = self.mapVars.keys() names.sort() for name in names: entry = self.mapVars[name] vdesc = entry.desc if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] if type(val)==type(0): if val==0x80000000L: # special case use = "0x80000000L" ...
print "%s_vtables_dispatch_ = %d" % (self.python_name, self.bIsDispatch) print "%s_vtables_ = [" % (self.python_name, )
stream = generator.file print >> stream, "%s_vtables_dispatch_ = %d" % (self.python_name, self.bIsDispatch) print >> stream, "%s_vtables_ = [" % (self.python_name, )
def WriteVTableMap(self, generator): print "%s_vtables_dispatch_ = %d" % (self.python_name, self.bIsDispatch) print "%s_vtables_ = [" % (self.python_name, ) for v in self.vtableFuncs: chunks = [] names, dispid, desc = v arg_desc = desc[2]
print "".join(chunks) print "]" print
print >> stream, "".join(chunks) print >> stream, "]" print >> stream
def WriteVTableMap(self, generator): print "%s_vtables_dispatch_ = %d" % (self.python_name, self.bIsDispatch) print "%s_vtables_ = [" % (self.python_name, ) for v in self.vtableFuncs: chunks = [] names, dispid, desc = v arg_desc = desc[2]
print
print >> generator.file
def WriteClass(self, generator): if not self.bIsDispatch and not self.type_attr.typekind == pythoncom.TKIND_DISPATCH: return # This is pretty screwey - now we have vtable support we # should probably rethink this (ie, maybe write both sides for sinks, etc) if self.bIsSink: self.WriteEventSinkClassHeader(generator) self...
print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1])
stream = generator.file print >> stream, 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print >> stream, '\t' + build._safeQuotedString(doc[1])
def WriteClassHeader(self, generator): generator.checkWriteDispatchBaseClass() doc = self.doc print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (pro...
print "\t
print >> stream, "\t
def WriteClassHeader(self, generator): generator.checkWriteDispatchBaseClass() doc = self.doc print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (pro...
print "\tCLSID = " + repr(self.clsid)
print >> stream, "\tCLSID = " + repr(self.clsid)
def WriteClassHeader(self, generator): generator.checkWriteDispatchBaseClass() doc = self.doc print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (pro...
print "\tcoclass_clsid = None"
print >> stream, "\tcoclass_clsid = None"
def WriteClassHeader(self, generator): generator.checkWriteDispatchBaseClass() doc = self.doc print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (pro...
print "\tcoclass_clsid = " + repr(self.coclass_clsid) print
print >> stream, "\tcoclass_clsid = " + repr(self.coclass_clsid) print >> stream
def WriteClassHeader(self, generator): generator.checkWriteDispatchBaseClass() doc = self.doc print 'class ' + self.python_name + '(DispatchBaseClass):' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (pro...
print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1])
stream = generator.file print >> stream, 'class ' + self.python_name + ':' if doc[1]: print >> stream, '\t' + build._safeQuotedString(doc[1])
def WriteEventSinkClassHeader(self, generator): generator.checkWriteEventBaseClass() doc = self.doc print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (progId) except p...
print "\t
print >> stream, "\t
def WriteEventSinkClassHeader(self, generator): generator.checkWriteEventBaseClass() doc = self.doc print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (progId) except p...
print '\tCLSID = CLSID_Sink = ' + repr(self.clsid)
print >> stream, '\tCLSID = CLSID_Sink = ' + repr(self.clsid)
def WriteEventSinkClassHeader(self, generator): generator.checkWriteEventBaseClass() doc = self.doc print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (progId) except p...
print "\tcoclass_clsid = None"
print >> stream, "\tcoclass_clsid = None"
def WriteEventSinkClassHeader(self, generator): generator.checkWriteEventBaseClass() doc = self.doc print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (progId) except p...
print "\tcoclass_clsid = " + repr(self.coclass_clsid) print '\t_public_methods_ = [] WriteSinkEventMap(self) print print '\tdef __init__(self, oobj = None):' print "\t\tif oobj is None:" print "\t\t\tself._olecp = None" print "\t\telse:" print '\t\t\timport win32com.server.util' print '\t\t\tfrom win32com.server.policy...
print >> stream, "\tcoclass_clsid = " + repr(self.coclass_clsid) print >> stream, '\t_public_methods_ = [] WriteSinkEventMap(self, stream) print >> stream print >> stream, '\tdef __init__(self, oobj = None):' print >> stream, "\t\tif oobj is None:" print >> stream, "\t\t\tself._olecp = None" print >> stream, "\t\telse:...
def WriteEventSinkClassHeader(self, generator): generator.checkWriteEventBaseClass() doc = self.doc print 'class ' + self.python_name + ':' if doc[1]: print '\t' + build._safeQuotedString(doc[1]) try: progId = pythoncom.ProgIDFromCLSID(self.clsid) print "\t# This class is creatable by the name '%s'" % (progId) except p...
print "\t print "\t
stream = generator.file print >> stream, "\t print >> stream, "\t
def WriteCallbackClassBody(self, generator): print "\t# Event Handlers" print "\t# If you create handlers, they should have the following prototypes:" for name, entry in self.propMapGet.items() + self.propMapPut.items() + self.mapFuncs.items(): fdesc = entry.desc methName = MakeEventMethodName(entry.names[0]) print '#\...
print ' if entry.doc and entry.doc[1]: print ' print
print >> stream, ' if entry.doc and entry.doc[1]: print >> stream, ' print >> stream
print '#\tdef ' + methName + '(self' + build.BuildCallList(fdesc, entry.names, "defaultNamedOptArg", "defaultNamedNotOptArg","defaultUnnamedArg", "pythoncom.Missing") + '):'
print '\t
print >> stream, '\t
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print line print "\t_prop_map_get_ = {"
print >> stream, line print >> stream, "\t_prop_map_get_ = {"
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print "\t\t
print >> stream, "\t\t
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print '\t\t"%s": %s,' % (key, mapEntry)
print >> stream, '\t\t"%s": %s,' % (key, mapEntry)
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print '\t\t"%s": %s,' % (key, mapEntry) print "\t}" print "\t_prop_map_put_ = {"
print >> stream, '\t\t"%s": %s,' % (key, mapEntry) print >> stream, "\t}" print >> stream, "\t_prop_map_put_ = {"
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print '\t\t"%s" : ((%s, LCID, %d, 0),(%s)),' % (key, details[0], pythoncom.DISPATCH_PROPERTYPUT, defArgDesc)
print >> stream, '\t\t"%s" : ((%s, LCID, %d, 0),(%s)),' % (key, details[0], pythoncom.DISPATCH_PROPERTYPUT, defArgDesc)
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print '\t\t"%s": ((%s, LCID, %d, 0),%s),' % (key, details[0], details[4], defArgDesc) print "\t}"
print >> stream, '\t\t"%s": ((%s, LCID, %d, 0),%s),' % (key, details[0], details[4], defArgDesc) print >> stream, "\t}"
def WriteClassBody(self, generator): # Write in alpha order. names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) itemCount = None for name in names: entry=self.mapFuncs[name] # skip [restricted] methods, unle...
print "\t
print >> stream, "\t
ret = [ "\tdef __call__(self):\n\t\treturn self._ApplyTypes_(*%s)" % propArgs]
print line print "\t print "\tdef __unicode__(self, *args):" print "\t\ttry:" print "\t\t\treturn unicode(self.__call__(*args))" print "\t\texcept pythoncom.com_error:" print "\t\t\treturn repr(self)" print "\tdef __str__(self, *args):" print "\t\treturn str(self.__unicode__(*args))" print "\tdef __int__(self, *args):"...
print >> stream, line print >> stream, "\t print >> stream, "\tdef __unicode__(self, *args):" print >> stream, "\t\ttry:" print >> stream, "\t\t\treturn unicode(self.__call__(*args))" print >> stream, "\t\texcept pythoncom.com_error:" print >> stream, "\t\t\treturn repr(self)" print >> stream, "\tdef __str__(self, *arg...
ret = [ "\tdef __call__(self):\n\t\treturn self._ApplyTypes_(*%s)" % propArgs]
print '\tdef __iter__(self):' print '\t\t"Return a Python iterator for this object"' print '\t\tob = self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),())' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4]) print '\t\treturn win32com.client.util.Iterator(ob)'
print >> stream, '\tdef __iter__(self):' print >> stream, '\t\t"Return a Python iterator for this object"' print >> stream, '\t\tob = self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),())' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4]) print >> stream, '\t\treturn win32com.client.util.Iterator(ob)'
print '\tdef __iter__(self):'
print '\tdef _NewEnum(self):' print '\t\t"Create an enumerator from this object"' print '\t\treturn win32com.client.util.WrapEnum(self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),()),%s)' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4], resultCLSID) print '\tdef __getitem__(self, index):' print '\t\t"Allow this class to be...
print >> stream, '\tdef _NewEnum(self):' print >> stream, '\t\t"Create an enumerator from this object"' print >> stream, '\t\treturn win32com.client.util.WrapEnum(self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),()),%s)' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4], resultCLSID) print >> stream, '\tdef __getitem__(self,...
print '\tdef _NewEnum(self):'
print '\t print '\tdef __getitem__(self, item):' print '\t\treturn self._get_good_object_(self._oleobj_.Invoke(*(%d, LCID, %d, 1, item)), "Item")' % (entry.desc[0], invoketype)
print >> stream, '\t print >> stream, '\tdef __getitem__(self, item):' print >> stream, '\t\treturn self._get_good_object_(self._oleobj_.Invoke(*(%d, LCID, %d, 1, item)), "Item")' % (entry.desc[0], invoketype)
print '\tdef __getitem__(self, index):'
print "\t
print >> stream, "\t
ret = [ "\tdef __len__(self):\n\t\treturn self._ApplyTypes_(*%s)" % propArgs]
print line
print >> stream, line
ret = [ "\tdef __len__(self):\n\t\treturn self._ApplyTypes_(*%s)" % propArgs]
print "\t print "\tdef __nonzero__(self):" print "\t\treturn %s" % (TrueRepr,)
print >> stream, "\t print >> stream, "\tdef __nonzero__(self):" print >> stream, "\t\treturn %s" % (TrueRepr,)
ret = [ "\tdef __len__(self):\n\t\treturn self._ApplyTypes_(*%s)" % propArgs]
print "import sys"
print >> stream, "import sys"
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print "__import__('%s.%s')" % (generator.base_mod_name, ref.python_name) print "%s = sys.modules['%s.%s'].%s" % (ref.python_name, generator.base_mod_name, ref.python_name, ref.python_name)
print >> stream, "__import__('%s.%s')" % (generator.base_mod_name, ref.python_name) print >> stream, "%s = sys.modules['%s.%s'].%s" % (ref.python_name, generator.base_mod_name, ref.python_name, ref.python_name)
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print "
print >> stream, "
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print 'class %s(CoClassBaseClass): if doc and doc[1]: print '\t print '\tCLSID = %r' % (self.clsid,) print '\tcoclass_sources = ['
print >> stream, 'class %s(CoClassBaseClass): if doc and doc[1]: print >> stream, '\t print >> stream, '\tCLSID = %r' % (self.clsid,) print >> stream, '\tcoclass_sources = ['
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print '\t\t%s,' % (key) print '\t]'
print >> stream, '\t\t%s,' % (key) print >> stream, '\t]'
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print '\tdefault_source = %s' % (defName,) print '\tcoclass_interfaces = ['
print >> stream, '\tdefault_source = %s' % (defName,) print >> stream, '\tcoclass_interfaces = ['
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print '\t\t%s,' % (key,) print '\t]'
print >> stream, '\t\t%s,' % (key,) print >> stream, '\t]'
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...
print '\tdefault_interface = %s' % (defName,)
print >> stream, '\tdefault_interface = %s' % (defName,)
def WriteClass(self, generator): generator.checkWriteCoClassBaseClass() doc = self.doc if generator.generate_type == GEN_DEMAND_CHILD: # Some special imports we must setup. referenced_items = [] for ref, flag in self.sources: referenced_items.append(ref) for ref, flag in self.interfaces: referenced_items.append(ref) pr...