genpy.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:remoteControlPPT 作者: htwenning 项目源码 文件源码
def do_gen_file_header(self):
    la = self.typelib.GetLibAttr()
    moduleDoc = self.typelib.GetDocumentation(-1)
    docDesc = ""
    if moduleDoc[1]:
      docDesc = moduleDoc[1]

    # Reset all the 'per file' state
    self.bHaveWrittenDispatchBaseClass = 0
    self.bHaveWrittenCoClassBaseClass = 0
    self.bHaveWrittenEventBaseClass = 0
    # You must provide a file correctly configured for writing unicode.
    # We assert this is it may indicate somewhere in pywin32 that needs
    # upgrading.
    assert self.file.encoding, self.file
    encoding = self.file.encoding # or "mbcs"

    print >> self.file, '# -*- coding: %s -*-' % (encoding,)
    print >> self.file, '# Created by makepy.py version %s' % (makepy_version,)
    print >> self.file, '# By python version %s' % \
                        (sys.version.replace("\n", "-"),)
    if self.sourceFilename:
        print >> self.file, "# From type library '%s'" % (os.path.split(self.sourceFilename)[1],)
    print >> self.file, '# On %s' % time.ctime(time.time())

    print >> self.file, build._makeDocString(docDesc)

    print >> self.file, 'makepy_version =', repr(makepy_version)
    print >> self.file, 'python_version = 0x%x' % (sys.hexversion,)
    print >> self.file
    print >> self.file, 'import win32com.client.CLSIDToClass, pythoncom, pywintypes'
    print >> self.file, 'import win32com.client.util'
    print >> self.file, 'from pywintypes import IID'
    print >> self.file, 'from win32com.client import Dispatch'
    print >> self.file
    print >> self.file, '# The following 3 lines may need tweaking for the particular server'
    print >> self.file, '# Candidates are pythoncom.Missing, .Empty and .ArgNotFound'
    print >> self.file, 'defaultNamedOptArg=pythoncom.Empty'
    print >> self.file, 'defaultNamedNotOptArg=pythoncom.Empty'
    print >> self.file, 'defaultUnnamedArg=pythoncom.Empty'
    print >> self.file
    print >> self.file, 'CLSID = ' + repr(la[0])
    print >> self.file, 'MajorVersion = ' + str(la[3])
    print >> self.file, 'MinorVersion = ' + str(la[4])
    print >> self.file, 'LibraryFlags = ' + str(la[5])
    print >> self.file, 'LCID = ' + hex(la[1])
    print >> self.file
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号