Merge pull request #76 from swt2c/fix_pdfviewer_py3

Fix pdfviewer for Python 3
This commit is contained in:
Robin Dunn
2016-05-09 21:59:45 -07:00
5 changed files with 9 additions and 8 deletions

View File

@@ -121,5 +121,5 @@ See ./bitmaps/ReadMe.txt for further details
"""
from viewer import pdfViewer
from buttonpanel import pdfButtonPanel
from .viewer import pdfViewer
from .buttonpanel import pdfButtonPanel

View File

@@ -18,7 +18,7 @@ This module is used to compute Bezier curves for PDF rendering.
"""
import wx
from vec2d import *
from .vec2d import *
def calculate_bezier(p, steps = 30):
"""

View File

@@ -18,7 +18,7 @@ which can be used together with the :class:`~lib.pdfviewer.viewer.pdfViewer`.
"""
import sys, os, time
import images
from . import images
import wx
import wx.lib.agw.buttonpanel as bp

View File

@@ -35,7 +35,7 @@ to be separated out if this was ever developed to be more general purpose.
"""
import copy
from math import asin, pi
import bezier
from . import bezier
import wx
class dcGraphicsState:

View File

@@ -29,6 +29,7 @@ import types
import copy
import shutil
import wx.lib.six as six
from wx.lib.six import BytesIO
USE_CAIRO = True
@@ -63,7 +64,7 @@ elif fpypdf == 1:
from pyPdf.pdf import ContentStream, PageObject
from pyPdf.filters import ASCII85Decode, FlateDecode
from dcgraphics import dcGraphicsContext
from .dcgraphics import dcGraphicsContext
import wx
have_cairo = False
@@ -207,9 +208,9 @@ class pdfViewer(wx.ScrolledWindow):
a file-like object.
"""
if isinstance(pdf_file, types.StringTypes):
if isinstance(pdf_file, six.string_types):
# it must be a filename/path string, open it as a file
f = file(pdf_file, 'rb')
f = open(pdf_file, 'rb')
self.pdfpathname = pdf_file
else:
# assume it is a file-like object