示例#1
0
def RegisterPythonwin(searchPaths):
    """Knows how to register Pythonwin components
	"""
    import regutil
    suffix = IsDebug()
    #	FindRegisterApp("Pythonwin", "docview.py", searchPaths)

    FindRegisterHelpFile("PyWin32.chm", searchPaths, "Pythonwin Reference")

    FindRegisterPythonExe("pythonwin%s.exe" % suffix, searchPaths,
                          "Pythonwin%s.exe" % suffix)

    fnamePythonwin = regutil.GetRegisteredExe("Pythonwin%s.exe" % suffix)
    fnamePython = regutil.GetRegisteredExe("Python%s.exe" % suffix)

    regutil.RegisterShellCommand(
        "Edit",
        QuotedFileName(fnamePythonwin) + " /edit \"%1\"")
    regutil.RegisterDDECommand("Edit", "Pythonwin", "System",
                               '[self.OpenDocumentFile(r"%1")]')

    FindRegisterPackage("pywin", "__init__.py", searchPaths, "Pythonwin")
    #	FindRegisterModule("win32ui", "win32ui%s.pyd" % suffix, searchPaths)
    #	FindRegisterModule("win32uiole", "win32uiole%s.pyd" % suffix, searchPaths)

    regutil.RegisterFileExtensions(defPyIcon=fnamePythonwin + ",0",
                                   defPycIcon=fnamePythonwin + ",5",
                                   runCommand=QuotedFileName(fnamePython) +
                                   " \"%1\" %*")
示例#2
0
def RegisterShellInfo(searchPaths):
    """Registers key parts of the Python installation with the Windows Shell.

       Assumes a valid, minimal Python installation exists
       (ie, SetupCore() has been previously successfully run)
    """
    import regutil, win32con
    suffix = IsDebug()
    # Set up a pointer to the .exe's
    exePath = FindRegisterPythonExe("Python%s.exe" % suffix, searchPaths)
    regutil.SetRegistryDefaultValue(".py", "Python.File", win32con.HKEY_CLASSES_ROOT)
    regutil.RegisterShellCommand("Open", QuotedFileName(exePath)+" \"%1\" %*", "&Run")
    regutil.SetRegistryDefaultValue("Python.File\\DefaultIcon", "%s,0" % exePath, win32con.HKEY_CLASSES_ROOT)

    FindRegisterHelpFile("Python.hlp", searchPaths, "Main Python Documentation")
    FindRegisterHelpFile("ActivePython.chm", searchPaths, "Main Python Documentation")