Patch for wx/lib/pdfwin.py
Paul McNett
p at ulmcnett.com
Tue Jun 5 15:37:26 PDT 2007
Attached is (I believe) a more intelligent discoverer of the =
latest-installed Acrobat Reader version for use with ActiveX_PDFWindow.
I tested it on my WinXP / Acrobat 8.0 setup and it worked fine.
Paul
-------------- next part --------------
--- pdfwin.py.old 2007-06-05 15:34:03.000000000 -0700
+++ pdfwin.py 2007-06-05 15:33:14.000000000 -0700
@@ -22,19 +22,24 @@
global _acroversion
if _acroversion =3D=3D None:
import _winreg
- acrosoft =3D [r'SOFTWARE\Adobe\Acrobat Reader\%version%\InstallPat=
h',
- r'SOFTWARE\Adobe\Adobe Acrobat\%version%\InstallPath',]
- =
- for regkey in acrosoft:
- for version in ('7.0', '6.0', '5.0', '4.0'):
+ adobesoft =3D _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'Softwa=
re\Adobe')
+ acrokeys, acroversions =3D [], []
+ for index in range(_winreg.QueryInfoKey(adobesoft)[0]):
+ key =3D _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 =3D _winreg.EnumKey(acrokey, index)
try:
- path =3D _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE,
- regkey.replace('%version%', =
version))
- _acroversion =3D version
- break
+ acroversions.append(float(key))
except:
- continue
+ pass
+ acroversions.sort(reverse=3DTrue)
+ _acroversion =3D acroversions[0]
return _acroversion
+ =
=
#----------------------------------------------------------------------
=
@@ -54,7 +59,7 @@
# Co-ordinates passed as parameters are in points (1/72 inch).
=
=
-if get_acroversion() >=3D '7.0':
+if get_acroversion() >=3D 7.0:
=
from wx.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache
More information about the wxpython-dev
mailing list