Patch from Paul McNett to check for the Acrobat version more robustly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-06-07 18:47:19 +00:00
parent 40a426b367
commit b40cb84f3f

View File

@@ -22,20 +22,26 @@ def get_acroversion():
global _acroversion global _acroversion
if _acroversion == None: if _acroversion == None:
import _winreg import _winreg
acrosoft = [r'SOFTWARE\Adobe\Acrobat Reader\%version%\InstallPath', adobesoft = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'Software\Adobe')
r'SOFTWARE\Adobe\Adobe Acrobat\%version%\InstallPath',] acrokeys, acroversions = [], []
for index in range(_winreg.QueryInfoKey(adobesoft)[0]):
for regkey in acrosoft: key = _winreg.EnumKey(adobesoft, index)
for version in ('8.0', '7.0', '6.0', '5.0', '4.0'): if "acrobat" in key.lower():
acrokeys.append(_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\Adobe\\%s' % key))
for acrokey in acrokeys:
print acrokey
for index in range(_winreg.QueryInfoKey(acrokey)[0]):
key = _winreg.EnumKey(acrokey, index)
try: try:
path = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE, acroversions.append(float(key))
regkey.replace('%version%', version))
_acroversion = version
break
except: except:
continue pass
acroversions.sort(reverse=True)
if acroversions:
_acroversion = acroversions[0]
return _acroversion return _acroversion
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# The ActiveX module from Acrobat 7.0 has changed and it seems to now # The ActiveX module from Acrobat 7.0 has changed and it seems to now
@@ -54,7 +60,7 @@ def get_acroversion():
# Co-ordinates passed as parameters are in points (1/72 inch). # Co-ordinates passed as parameters are in points (1/72 inch).
if get_acroversion() >= '7.0': if get_acroversion() >= 7.0:
from wx.lib.activexwrapper import MakeActiveXClass from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache import win32com.client.gencache