tided up pptviewcontroller and ppttest

This commit is contained in:
Philip Ridout 2013-10-15 21:58:56 +01:00
parent eb614bdf38
commit 2e10a4b0ea
2 changed files with 9 additions and 11 deletions

View File

@ -127,16 +127,15 @@ class PptviewDocument(PresentationDocument):
rect = renderer.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
file_system_encoding = 'utf-16-le'
filepath = os.path.normpath(self.filepath)
preview_path = os.path.join(self.get_temp_folder(), u'slide')
# Add a null char on the end otherwise we get spurious issues with
# the encoding.
file_path = os.path.normpath(self.filepath) + u'\0'
preview_path = os.path.join(self.get_temp_folder(), u'slide') + u'\0'
file_path = file_path.encode(file_system_encoding)
preview_path = preview_path.encode(file_system_encoding)
if not os.path.isdir(self.get_temp_folder()):
os.makedirs(self.get_temp_folder())
filepath = filepath.encode(file_system_encoding)
preview_path = preview_path.encode(file_system_encoding)
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
self.pptid = self.controller.process.OpenPPT(file_path, None, rect,
preview_path)
if self.pptid >= 0:
self.create_thumbnails()

View File

@ -174,9 +174,8 @@ class PPTViewer(QtGui.QWidget):
rect = RECT(int(self.xEdit.text()), int(self.yEdit.text()),
int(self.widthEdit.text()), int(self.heightEdit.text()))
filename = os.path.normpath(unicode(self.pptEdit.text())).encode('utf-16-le')
folder = unicode(self.folderEdit.text()).replace(u'/', u'\\')
self.pptid = self.pptdll.OpenPPT(filename, None, rect, filename.encode('utf-16-le') + folder.encode('utf-16-le'))
#self.pptid = self.pptdll.OpenPPT(filename, None, rect, filename + folder)
folder = os.path.normpath(unicode(self.folderEdit.text())).encode('utf-16-le')
self.pptid = self.pptdll.OpenPPT(filename, None, rect, folder)
print u'id: ' + unicode(self.pptid)
if oldid >= 0:
self.pptdll.ClosePPT(oldid);