forked from openlp/openlp
Some refactoring
This commit is contained in:
parent
2535bda1bb
commit
61da0e8ad9
@ -28,3 +28,4 @@ tests.kdev4
|
||||
*.nja
|
||||
*.orig
|
||||
__pycache__
|
||||
*.dll
|
||||
|
@ -121,15 +121,16 @@ class PptviewDocument(PresentationDocument):
|
||||
the background PptView task started earlier.
|
||||
"""
|
||||
log.debug('LoadPresentation')
|
||||
temp_folder = self.get_temp_folder()
|
||||
size = ScreenList().current['size']
|
||||
rect = RECT(size.x(), size.y(), size.right(), size.bottom())
|
||||
file_path = os.path.normpath(self.filepath)
|
||||
preview_path = os.path.join(self.get_temp_folder(), 'slide')
|
||||
preview_path = os.path.join(temp_folder, 'slide')
|
||||
# Ensure that the paths are null terminated
|
||||
file_path = file_path.encode('utf-16-le') + b'\0'
|
||||
preview_path = preview_path.encode('utf-16-le') + b'\0'
|
||||
if not os.path.isdir(self.get_temp_folder()):
|
||||
os.makedirs(self.get_temp_folder())
|
||||
if not os.path.isdir(temp_folder):
|
||||
os.makedirs(temp_folder)
|
||||
self.ppt_id = self.controller.process.OpenPPT(file_path, None, rect, preview_path)
|
||||
if self.ppt_id >= 0:
|
||||
self.create_thumbnails()
|
||||
|
@ -223,12 +223,12 @@ DllExport int OpenPPT(wchar_t *filename, HWND hParentWnd, RECT rect,
|
||||
{
|
||||
if (steps <= pptView[id].steps)
|
||||
{
|
||||
Sleep(100);
|
||||
Sleep(25);
|
||||
DEBUG(L"OpenPPT: Step %d/%d\n", steps, pptView[id].steps);
|
||||
steps++;
|
||||
NextStep(id);
|
||||
}
|
||||
Sleep(10);
|
||||
Sleep(75);
|
||||
}
|
||||
DEBUG(L"OpenPPT: Slides %d, Steps %d, first slide steps %d\n",
|
||||
pptView[id].slideCount, pptView[id].steps,
|
||||
|
@ -96,8 +96,14 @@ class PresentationDocument(object):
|
||||
"""
|
||||
Constructor for the PresentationController class
|
||||
"""
|
||||
self.slidenumber = 0
|
||||
self.controller = controller
|
||||
self._setup(name)
|
||||
|
||||
def _setup(self, name):
|
||||
"""
|
||||
Run some initial setup. This method is separate from __init__ in order to mock it out in tests.
|
||||
"""
|
||||
self.slidenumber = 0
|
||||
self.filepath = name
|
||||
check_directory_exists(self.get_thumbnail_folder())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user