This commit is contained in:
Andreas Preikschat 2011-04-24 17:06:17 +02:00
commit fdc4104c16
9 changed files with 142 additions and 39 deletions

View File

@ -140,6 +140,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
return FirstTimePage.Songs return FirstTimePage.Songs
elif self.currentId() == FirstTimePage.Progress: elif self.currentId() == FirstTimePage.Progress:
return -1 return -1
elif self.currentId() == FirstTimePage.NoInternet:
return FirstTimePage.Progress
else: else:
return self.currentId() + 1 return self.currentId() + 1
@ -147,11 +149,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
""" """
Detects Page changes and updates as approprate. Detects Page changes and updates as approprate.
""" """
if pageId == FirstTimePage.NoInternet: if pageId == FirstTimePage.Defaults:
self.finishButton.setVisible(True)
self.finishButton.setEnabled(True)
self.nextButton.setVisible(False)
elif pageId == FirstTimePage.Defaults:
self.themeComboBox.clear() self.themeComboBox.clear()
for iter in xrange(self.themesListWidget.count()): for iter in xrange(self.themesListWidget.count()):
item = self.themesListWidget.item(iter) item = self.themesListWidget.item(iter)

View File

@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \
build_icon, translate translate
from openlp.core.ui import HideMode from openlp.core.ui import HideMode
@ -69,8 +69,6 @@ class MainDisplay(DisplayWidget):
self.hideMode = None self.hideMode = None
self.videoHide = False self.videoHide = False
self.override = {} self.override = {}
mainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
self.setWindowIcon(mainIcon)
self.retranslateUi() self.retranslateUi()
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |

View File

@ -71,7 +71,7 @@ class Ui_MainWindow(object):
mainWindow.setObjectName(u'MainWindow') mainWindow.setObjectName(u'MainWindow')
mainWindow.resize(self.settingsmanager.width, mainWindow.resize(self.settingsmanager.width,
self.settingsmanager.height) self.settingsmanager.height)
mainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) mainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-64x64.png'))
mainWindow.setDockNestingEnabled(True) mainWindow.setDockNestingEnabled(True)
# Set up the main container, which contains all the other form widgets. # Set up the main container, which contains all the other form widgets.
self.MainContent = QtGui.QWidget(mainWindow) self.MainContent = QtGui.QWidget(mainWindow)

View File

@ -75,6 +75,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Add a tab to the form at a specific location Add a tab to the form at a specific location
""" """
log.debug(u'Inserting %s tab' % tab.tabTitle) log.debug(u'Inserting %s tab' % tab.tabTitle)
# add the tab to get it to display in the correct part of the screen
pos = self.stackedLayout.addWidget(tab) pos = self.stackedLayout.addWidget(tab)
if is_active: if is_active:
item_name = QtGui.QListWidgetItem(tab.tabTitleVisible) item_name = QtGui.QListWidgetItem(tab.tabTitleVisible)
@ -82,7 +83,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
item_name.setIcon(icon) item_name.setIcon(icon)
self.settingListWidget.insertItem(location, item_name) self.settingListWidget.insertItem(location, item_name)
else: else:
self.stackedLayout.takeAt(location) # then remove tab to stop the UI displaying it even if
# it is not required.
self.stackedLayout.takeAt(pos)
def accept(self): def accept(self):
""" """

View File

@ -27,6 +27,8 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <io.h>
#include <direct.h>
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -88,7 +90,12 @@ DllExport BOOL CheckInstalled()
char cmdLine[MAX_PATH * 2]; char cmdLine[MAX_PATH * 2];
DEBUG("CheckInstalled\n"); 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 // Open the PointPoint, count the slides and take a snapshot of each slide
@ -160,7 +167,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect,
pptView[id].rect.bottom = rect.bottom; pptView[id].rect.bottom = rect.bottom;
pptView[id].rect.right = rect.right; 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, filename);
strcat_s(cmdLine, MAX_PATH * 2, "\""); strcat_s(cmdLine, MAX_PATH * 2, "\"");
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));
@ -189,7 +196,7 @@ DllExport int OpenPPT(char *filename, HWND hParentWnd, RECT rect,
Sleep(10); Sleep(10);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, 0, NULL, &si, &pi)) 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); ClosePPT(id);
return -1; return -1;
} }
@ -344,16 +351,71 @@ BOOL SavePPTInfo(int id)
// Get the path of the PowerPoint viewer from the registry // Get the path of the PowerPoint viewer from the registry
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize) 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; HKEY hKey;
DWORD dwType, dwSize; DWORD dwType, dwSize;
LRESULT lResult; 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, if ((RegOpenKeyEx(HKEY_CLASSES_ROOT,
"PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey) "PowerPointViewer.Show.12\\shell\\Show\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS) != ERROR_SUCCESS)
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT, && (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) "Applications\\PPTVIEW.EXE\\shell\\open\\command", 0, KEY_READ, &hKey)
!= ERROR_SUCCESS) != ERROR_SUCCESS)
&& (RegOpenKeyEx(HKEY_CLASSES_ROOT, && (RegOpenKeyEx(HKEY_CLASSES_ROOT,
@ -373,7 +435,6 @@ BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize)
} }
// remove "%1" from end of key value // remove "%1" from end of key value
pptViewerPath[strlen(pptViewerPath) - 4] = '\0'; pptViewerPath[strlen(pptViewerPath) - 4] = '\0';
DEBUG("GetPPTViewerPath: exit ok\n");
return TRUE; return TRUE;
} }

View File

@ -49,6 +49,7 @@ LRESULT CALLBACK CbtProc(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK CwpProc(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam);
BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize); BOOL GetPPTViewerPath(char *pptViewerPath, int stringSize);
BOOL GetPPTViewerPathFromReg(char *pptViewerPath, int stringSize);
HBITMAP CaptureWindow(HWND hWnd); HBITMAP CaptureWindow(HWND hWnd);
VOID SaveBitmap(CHAR* filename, HBITMAP hBmp) ; VOID SaveBitmap(CHAR* filename, HBITMAP hBmp) ;
VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename); VOID CaptureAndSaveWindow(HWND hWnd, CHAR* filename);

View File

@ -65,10 +65,12 @@ class SongsPlugin(Plugin):
def initialise(self): def initialise(self):
log.info(u'Songs Initialising') log.info(u'Songs Initialising')
Plugin.initialise(self) Plugin.initialise(self)
self.songImportItem.setVisible(True)
self.songExportItem.setVisible(True)
self.toolsReindexItem.setVisible(True) self.toolsReindexItem.setVisible(True)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_action(self.SongImportItem, UiStrings().Import) action_list.add_action(self.songImportItem, UiStrings().Import)
action_list.add_action(self.SongExportItem, UiStrings().Export) action_list.add_action(self.songExportItem, UiStrings().Export)
action_list.add_action(self.toolsReindexItem, UiStrings().Tools) action_list.add_action(self.toolsReindexItem, UiStrings().Tools)
def addImportMenuItem(self, import_menu): def addImportMenuItem(self, import_menu):
@ -81,13 +83,13 @@ class SongsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
# Main song import menu item - will eventually be the only one # Main song import menu item - will eventually be the only one
self.SongImportItem = base_action(import_menu, u'SongImportItem') self.songImportItem = base_action(import_menu, u'songImportItem')
self.SongImportItem.setText(translate('SongsPlugin', '&Song')) self.songImportItem.setText(translate('SongsPlugin', '&Song'))
self.SongImportItem.setToolTip(translate('SongsPlugin', self.songImportItem.setToolTip(translate('SongsPlugin',
'Import songs using the import wizard.')) 'Import songs using the import wizard.'))
import_menu.addAction(self.SongImportItem) import_menu.addAction(self.songImportItem)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.SongImportItem, QtCore.QObject.connect(self.songImportItem,
QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked)
def addExportMenuItem(self, export_menu): def addExportMenuItem(self, export_menu):
@ -100,13 +102,13 @@ class SongsPlugin(Plugin):
use it as their parent. use it as their parent.
""" """
# Main song import menu item - will eventually be the only one # Main song import menu item - will eventually be the only one
self.SongExportItem = base_action(export_menu, u'SongExportItem') self.songExportItem = base_action(export_menu, u'songExportItem')
self.SongExportItem.setText(translate('SongsPlugin', '&Song')) self.songExportItem.setText(translate('SongsPlugin', '&Song'))
self.SongExportItem.setToolTip(translate('SongsPlugin', self.songExportItem.setToolTip(translate('SongsPlugin',
'Exports songs using the export wizard.')) 'Exports songs using the export wizard.'))
export_menu.addAction(self.SongExportItem) export_menu.addAction(self.songExportItem)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.SongExportItem, QtCore.QObject.connect(self.songExportItem,
QtCore.SIGNAL(u'triggered()'), self.onSongExportItemClicked) QtCore.SIGNAL(u'triggered()'), self.onSongExportItemClicked)
def addToolsMenuItem(self, tools_menu): def addToolsMenuItem(self, tools_menu):
@ -256,9 +258,12 @@ class SongsPlugin(Plugin):
""" """
log.info(u'Songs Finalising') log.info(u'Songs Finalising')
self.manager.finalise() self.manager.finalise()
self.songImportItem.setVisible(False)
self.songExportItem.setVisible(False)
self.toolsReindexItem.setVisible(False) self.toolsReindexItem.setVisible(False)
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.remove_action(self.SongImportItem, UiStrings().Import) action_list.remove_action(self.songImportItem, UiStrings().Import)
action_list.remove_action(self.SongExportItem, UiStrings().Export) action_list.remove_action(self.songExportItem, UiStrings().Export)
action_list.remove_action(self.toolsReindexItem, UiStrings().Tools) action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
Plugin.finalise(self) Plugin.finalise(self)

View File

@ -52,6 +52,12 @@ UPX
http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then http://upx.sourceforge.net/, extract it into C:\%PROGRAMFILES%\UPX, and then
add that directory to your PATH environment variable. 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
PyInstaller should be a checkout of revision 844 of trunk, and in a 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 directory called, "pyinstaller" on the same level as OpenLP's Bazaar shared
@ -81,6 +87,10 @@ OpenLP
shared repository directory. This means your code should be in a directory shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name". 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 windows-builder.py
This script, of course. It should be in the "scripts" directory of OpenLP. This script, of course. It should be in the "scripts" directory of OpenLP.
@ -98,6 +108,8 @@ sphinx_exe = os.path.join(os.path.split(python_exe)[0], u'Scripts',
u'sphinx-build.exe') u'sphinx-build.exe')
hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop', hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop',
u'hhc.exe') 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 # Base paths
script_path = os.path.split(os.path.abspath(__file__))[0] script_path = os.path.split(os.path.abspath(__file__))[0]
@ -119,6 +131,8 @@ winres_path = os.path.join(branch_path, u'resources', u'windows')
build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP') 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') dist_path = os.path.join(branch_path, u'dist', u'OpenLP')
enchant_path = os.path.join(site_packages, u'enchant') 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(): def update_code():
os.chdir(branch_path) os.chdir(branch_path)
@ -264,17 +278,40 @@ def run_innosetup():
if code != 0: if code != 0:
raise Exception(u'Error running Inno Setup') 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(): def main():
skip_update = False
import sys import sys
if len(sys.argv) > 1 and (sys.argv[1] == u'-v' or sys.argv[1] == u'--verbose'): for arg in sys.argv:
print "Script path:", script_path if arg == u'-v' or arg == u'--verbose':
print "Branch path:", branch_path print "Script path:", script_path
print "Source path:", source_path print "Branch path:", branch_path
print "\"dist\" path:", dist_path print "Source path:", source_path
print "PyInstaller:", pyi_build print "\"dist\" path:", dist_path
print "Inno Setup path:", innosetup_path print "PyInstaller:", pyi_build
print "Windows resources:", winres_path print "Inno Setup path:", innosetup_exe
update_code() 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() run_pyinstaller()
write_version_file() write_version_file()
copy_enchant() copy_enchant()