openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #08226
[Merge] lp:~j-corwin/openlp/present into lp:openlp
Jonathan Corwin has proposed merging lp:~j-corwin/openlp/present into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Andreas Preikschat (googol-hush)
Related bugs:
Bug #598361 in OpenLP: "AttributeError: 'NoneType' object has no attribute 'isPaused'"
https://bugs.launchpad.net/openlp/+bug/598361
Bug #608149 in OpenLP: "Presentations are not intuitive"
https://bugs.launchpad.net/openlp/+bug/608149
For more details, see:
https://code.launchpad.net/~j-corwin/openlp/present/+merge/58869
Additional fallback checks to try and locate PPTVIEW.EXE
Add the building of PPTVIEWLIB.DLL into the Windows Builds script, and so remove dll from repository
** Now tested!
--
https://code.launchpad.net/~j-corwin/openlp/present/+merge/58869
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp'
--- openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp 2011-03-24 19:04:02 +0000
+++ openlp/plugins/presentations/lib/pptviewlib/pptviewlib.cpp 2011-04-23 10:08:27 +0000
@@ -27,6 +27,8 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <io.h>
+#include <direct.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -88,7 +90,12 @@
char cmdLine[MAX_PATH * 2];
DEBUG("CheckInstalled\n");
- return GetPPTViewerPath(cmdLine, sizeof(cmdLine));
+ BOOL found = GetPPTViewerPath(cmdLine, sizeof(cmdLine));
+ if(found)
+ {
+ DEBUG("Exe: %s\n", cmdLine);
+ }
+ return found;
}
// Open the PointPoint, count the slides and take a snapshot of each slide
@@ -160,7 +167,7 @@
pptView[id].rect.bottom = rect.bottom;
pptView[id].rect.right = rect.right;
}
- strcat_s(cmdLine, MAX_PATH * 2, "/F /S \"");
+ strcat_s(cmdLine, MAX_PATH * 2, " /F /S \"");
strcat_s(cmdLine, MAX_PATH * 2, filename);
strcat_s(cmdLine, MAX_PATH * 2, "\"");
memset(&si, 0, sizeof(si));
@@ -189,7 +196,7 @@
Sleep(10);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, 0, NULL, &si, &pi))
{
- DEBUG("OpenPPT: CreateProcess failed\n");
+ DEBUG("OpenPPT: CreateProcess failed: %s\n", cmdLine);
ClosePPT(id);
return -1;
}
@@ -345,15 +352,70 @@
// Get the path of the PowerPoint viewer from the registry
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize)
{
+ char cwd[MAX_PATH];
+
+ DEBUG("GetPPTViewerPath: start\n");
+ if(GetPPTViewerPathFromReg(pptViewerPath, stringSize))
+ {
+ if(_access(pptViewerPath, 0) != -1)
+ {
+ DEBUG("GetPPTViewerPath: exit registry\n");
+ return TRUE;
+ }
+ }
+ // This is where it gets ugly. PPT2007 it seems no longer stores its
+ // location in the registry. So we have to use the defaults which will
+ // upset those who like to put things somewhere else
+
+ // Viewer 2007 in 64bit Windows:
+ if(_access("C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
+ 0) != -1)
+ {
+ strcpy_s(
+ "C:\\Program Files (x86)\\Microsoft Office\\Office12\\PPTVIEW.EXE",
+ stringSize, pptViewerPath);
+ DEBUG("GetPPTViewerPath: exit 64bit 2007\n");
+ return TRUE;
+ }
+ // Viewer 2007 in 32bit Windows:
+ if(_access("C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE", 0)
+ != -1)
+ {
+ strcpy_s("C:\\Program Files\\Microsoft Office\\Office12\\PPTVIEW.EXE",
+ stringSize, pptViewerPath);
+ DEBUG("GetPPTViewerPath: exit 32bit 2007\n");
+ return TRUE;
+ }
+ // Give them the opportunity to place it in the same folder as the app
+ _getcwd(cwd, MAX_PATH);
+ strcat_s(cwd, MAX_PATH, "\\PPTVIEW.EXE");
+ if(_access(cwd, 0) != -1)
+ {
+ strcpy_s(pptViewerPath, stringSize, cwd);
+ DEBUG("GetPPTViewerPath: exit local\n");
+ return TRUE;
+ }
+ DEBUG("GetPPTViewerPath: exit fail\n");
+ return FALSE;
+}
+BOOL GetPPTViewerPathFromReg(char *pptViewerPath, int stringSize)
+{
HKEY hKey;
DWORD dwType, dwSize;
LRESULT lResult;
- DEBUG("GetPPTViewerPath: start\n");
+ // The following registry settings are for, respectively, (I think)
+ // PPT Viewer 2007 (older versions. Latest not in registry) & PPT Viewer 2010
+ // PPT Viewer 2003 (recent versions)
+ // PPT Viewer 2003 (older versions)
+ // PPT Viewer 97
if ((RegOpenKeyEx(HKEY_CLASSES_ROOT,
"PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT,
+ "PowerPointViewer.Show.11\\shell\\Show\\command", 0, KEY_READ, &hKey)
+ != ERROR_SUCCESS)
+ && (RegOpenKeyEx(HKEY_CLASSES_ROOT,
"Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS)
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT,
@@ -373,7 +435,6 @@
}
// remove "%1" from end of key value
pptViewerPath[strlen(pptViewerPath) - 4] = '\0';
- DEBUG("GetPPTViewerPath: exit ok\n");
return TRUE;
}
=== removed file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.dll'
Binary files openlp/plugins/presentations/lib/pptviewlib/pptviewlib.dll 2011-03-16 23:22:11 +0000 and openlp/plugins/presentations/lib/pptviewlib/pptviewlib.dll 1970-01-01 00:00:00 +0000 differ
=== modified file 'openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h'
--- openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h 2011-03-24 19:04:02 +0000
+++ openlp/plugins/presentations/lib/pptviewlib/pptviewlib.h 2011-04-23 10:08:27 +0000
@@ -49,6 +49,7 @@
LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize);
+BOOL GetPPTViewerPathFromReg(char *pptViewerPath, int stringSize);
HBITMAP CaptureWindow(HWND hWnd);
VOID SaveBitmap(CHAR* filename, HBITMAP hBmp) ;
VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename);
=== modified file 'scripts/windows-builder.py'
--- scripts/windows-builder.py 2011-04-02 20:17:53 +0000
+++ scripts/windows-builder.py 2011-04-23 10:08:27 +0000
@@ -52,6 +52,12 @@
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable.
+Sphinx
+ This is used to build the documentation
+
+HTML Help Workshop
+ This is used to create the help file
+
PyInstaller
PyInstaller should be a checkout of revision 844 of trunk, and in a
directory called, "pyinstaller" on the same level as OpenLP's Bazaar shared
@@ -81,6 +87,10 @@
shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name".
+Visual C++ 2008 Express Edition
+ This is to build pptviewlib.dll, the library for controlling the
+ PowerPointViewer
+
windows-builder.py
This script, of course. It should be in the "scripts" directory of OpenLP.
@@ -98,6 +108,8 @@
u'sphinx-build.exe')
hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop',
u'hhc.exe')
+vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'),
+ u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe')
# Base paths
script_path = os.path.split(os.path.abspath(__file__))[0]
@@ -119,6 +131,8 @@
build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP')
dist_path = os.path.join(branch_path, u'dist', u'OpenLP')
enchant_path = os.path.join(site_packages, u'enchant')
+pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations',
+ u'lib', u'pptviewlib')
def update_code():
os.chdir(branch_path)
@@ -264,17 +278,40 @@
if code != 0:
raise Exception(u'Error running Inno Setup')
+def build_pptviewlib():
+ print u'Building PPTVIEWLIB.DLL...'
+ vcbuild = Popen((vcbuild_exe, u'/rebuild',
+ os.path.join(pptviewlib_path, u'pptviewlib.vcproj'), u'Release|Win32'))
+ code = vcbuild.wait()
+ if code != 0:
+ raise Exception(u'Error building pptviewlib.dll')
+ copy(os.path.join(pptviewlib_path, u'Release', u'pptviewlib.dll'),
+ pptviewlib_path)
+
def main():
+ skip_update = False
import sys
- if len(sys.argv) > 1 and (sys.argv[1] == u'-v' or sys.argv[1] == u'--verbose'):
- print "Script path:", script_path
- print "Branch path:", branch_path
- print "Source path:", source_path
- print "\"dist\" path:", dist_path
- print "PyInstaller:", pyi_build
- print "Inno Setup path:", innosetup_path
- print "Windows resources:", winres_path
- update_code()
+ for arg in sys.argv:
+ if arg == u'-v' or arg == u'--verbose':
+ print "Script path:", script_path
+ print "Branch path:", branch_path
+ print "Source path:", source_path
+ print "\"dist\" path:", dist_path
+ print "PyInstaller:", pyi_build
+ print "Inno Setup path:", innosetup_exe
+ print "Windows resources:", winres_path
+ print "VCBuild path:", vcbuild_exe
+ print "PPTVIEWLIB path:", pptviewlib_path
+ elif arg == u'--skip-update':
+ skip_update = True
+ elif arg == u'/?' or arg == u'-h' or arg == u'--help':
+ print u'Command options:'
+ print u' -v --verbose : More verbose output'
+ print u' --skip-update : Do not update or revert current branch'
+ exit()
+ if not skip_update:
+ update_code()
+ build_pptviewlib()
run_pyinstaller()
write_version_file()
copy_enchant()
Follow ups