From b40cb84f3f7a29e6f7c5bc961df81b56d6e6f425 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 7 Jun 2007 18:47:19 +0000 Subject: [PATCH] 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 --- wxPython/wx/lib/pdfwin.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/wxPython/wx/lib/pdfwin.py b/wxPython/wx/lib/pdfwin.py index c87e45da7e..d924625db4 100644 --- a/wxPython/wx/lib/pdfwin.py +++ b/wxPython/wx/lib/pdfwin.py @@ -22,19 +22,25 @@ def get_acroversion(): global _acroversion if _acroversion == None: import _winreg - acrosoft = [r'SOFTWARE\Adobe\Acrobat Reader\%version%\InstallPath', - r'SOFTWARE\Adobe\Adobe Acrobat\%version%\InstallPath',] - - for regkey in acrosoft: - for version in ('8.0', '7.0', '6.0', '5.0', '4.0'): + adobesoft = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'Software\Adobe') + acrokeys, acroversions = [], [] + for index in range(_winreg.QueryInfoKey(adobesoft)[0]): + key = _winreg.EnumKey(adobesoft, index) + 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: - path = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE, - regkey.replace('%version%', version)) - _acroversion = version - break + acroversions.append(float(key)) except: - continue + pass + acroversions.sort(reverse=True) + if acroversions: + _acroversion = acroversions[0] return _acroversion + #---------------------------------------------------------------------- @@ -54,7 +60,7 @@ def get_acroversion(): # 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 import win32com.client.gencache