diff --git a/openlp.pyw b/openlp.pyw index c4a5fb428..1de9c8417 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -34,7 +34,6 @@ from PyQt4 import QtCore, QtGui log = logging.getLogger() -import openlp from openlp.core.lib import Receiver, str_to_bool from openlp.core.resources import qInitResources from openlp.core.ui import MainWindow, SplashScreen, ScreenList diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index f0da82b0e..15e289dc9 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -43,7 +43,8 @@ class Renderer(object): """ self._rect = None self._debug = False - self._right_margin = 64 # the amount of right indent + # the amount of right indent + self._right_margin = 64 self._display_shadow_size_footer = 0 self._display_outline_size_footer = 0 self.theme_name = None @@ -149,7 +150,7 @@ class Renderer(object): def pre_render_text(self, text): metrics = QtGui.QFontMetrics(self.mainFont) #work out line width - line_width = self._rect.width() - self._right_margin + line_width = self._rect.width() #- self._right_margin #number of lines on a page - adjust for rounding up. line_height = metrics.height() if self._theme.display_shadow: @@ -224,6 +225,7 @@ class Renderer(object): ``rect_footer`` The footer text block. """ + log.debug(u'set_text_rectangle %s , %s' %(rect_main, rect_footer) ) self._rect = rect_main self._rect_footer = rect_footer @@ -447,8 +449,8 @@ class Renderer(object): rightextent = x + w # shift right from last line's rh edge if self._theme.display_wrapStyle == 1 and linenum != 0: - rightextent = self._first_line_right_extent + \ - self._right_margin + rightextent = self._first_line_right_extent #+ \ + #self._right_margin if rightextent > maxx: rightextent = maxx x = rightextent - w diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index cbd46d597..1271609a9 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -53,7 +53,7 @@ blankthemexml=\ Normal False 0 - + Arial @@ -62,7 +62,7 @@ blankthemexml=\ Normal False 0 - + True diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 41b6d245f..d7213860f 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -621,6 +621,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.screens.set_current_display(updated_display) self.RenderManager.update_display(updated_display) self.mainDisplay.setup(updated_display) + #Trigger after changes have been made + Receiver.send_message(u'config_updated') self.activateWindow() def closeEvent(self, event): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e2e343f9e..7176cda99 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -190,6 +190,8 @@ class ServiceManager(QtGui.QWidget): QtCore.SIGNAL(u'presentation types'), self.onPresentationTypes) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'config_updated'), self.regenerateServiceItems) # Last little bits of setting up self.config = PluginConfig(u'ServiceManager') self.servicePath = self.config.get_data_path() @@ -617,7 +619,7 @@ class ServiceManager(QtGui.QWidget): for item in tempServiceItems: self.addServiceItem(item[u'service_item'], False, item[u'expanded']) #Set to False as items may have changed rendering - #does not impact the saved song so True may aslo be valid + #does not impact the saved song so True may also be valid self.parent.serviceChanged(False, self.serviceName) def addServiceItem(self, item, rebuild=False, expand=True): diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 4a3902347..0f183e40c 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -65,7 +65,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): def accept(self): for tab_index in range(0, self.SettingsTabWidget.count()): self.SettingsTabWidget.widget(tab_index).save() - Receiver.send_message(u'config_updated') return QtGui.QDialog.accept(self) def postSetUp(self): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 71b12d95d..0af64819a 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -299,6 +299,8 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'%s_change' % prefix), self.onSlideChange) QtCore.QObject.connect(self.Splitter, QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem) def widthChanged(self): """ @@ -377,6 +379,17 @@ class SlideController(QtGui.QWidget): self.Mediabar.setVisible(True) self.volumeSlider.setAudioOutput(self.audio) + def refreshServiceItem(self): + """ + Method to update the service item if the screen has changed + """ + log.debug(u'refreshServiceItem') + if self.serviceItem: + if self.serviceItem.is_text() or self.serviceItem.is_image(): + item = self.serviceItem + item.render() + self.addServiceManagerItem(item, self.selectedRow) + def addServiceItem(self, item): """ Method to install the service item into the controller diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 4083300a6..5d97dd8f2 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -45,9 +45,9 @@ class AppLocation(object): if dir_type == AppLocation.AppDir: return os.path.abspath(os.path.split(sys.argv[0])[0]) elif dir_type == AppLocation.ConfigDir: - if os.name == u'nt': + if sys.platform == u'win32': path = os.path.join(os.getenv(u'APPDATA'), u'openlp') - elif os.name == u'mac': + elif sys.platform == u'darwin': path = os.path.join(os.getenv(u'HOME'), u'Library', u'Application Support', u'openlp') else: @@ -58,9 +58,9 @@ class AppLocation(object): path = os.path.join(os.getenv(u'HOME'), u'.openlp') return path elif dir_type == AppLocation.DataDir: - if os.name == u'nt': + if sys.platform == u'win32': path = os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data') - elif os.name == u'mac': + elif sys.platform == u'darwin': path = os.path.join(os.getenv(u'HOME'), u'Library', u'Application Support', u'openlp', u'Data') else: @@ -100,4 +100,4 @@ def check_latest_version(config, current_version): from registry import Registry from confighelper import ConfigHelper -__all__ = [u'Registry', u'ConfigHelper', u'AppLocations', u'check_latest_version'] +__all__ = [u'Registry', u'ConfigHelper', u'AppLocation', u'check_latest_version'] diff --git a/openlp/plugins/bibles/forms/importwizardform.py b/openlp/plugins/bibles/forms/importwizardform.py index 03769abcd..422e869eb 100644 --- a/openlp/plugins/bibles/forms/importwizardform.py +++ b/openlp/plugins/bibles/forms/importwizardform.py @@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui from bibleimportwizard import Ui_BibleImportWizard from openlp.core.lib import Receiver +from openlp.core.utils import AppLocation from openlp.plugins.bibles.lib.manager import BibleFormat log = logging.getLogger(__name__) @@ -258,9 +259,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard): Load the list of Crosswalk and BibleGateway bibles. """ #Load and store Crosswalk Bibles - filepath = os.path.abspath(os.path.join( - os.path.split(os.path.abspath(__file__))[0], - u'..', u'resources')) + filepath = AppLocation.get_directory(AppLocation.PluginsDir) + filepath = os.path.join(filepath, u'bibles', u'resources') fbibles = None try: self.web_bible_list[DownloadLocation.Crosswalk] = {} diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index bd4ad8e0b..5a170d84c 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -31,6 +31,7 @@ import sqlite3 from BeautifulSoup import BeautifulSoup from openlp.core.lib import Receiver +from openlp.core.utils import AppLocation from common import BibleCommon, SearchResults from db import BibleDB from openlp.plugins.bibles.lib.models import Book @@ -43,8 +44,9 @@ class HTTPBooks(object): @staticmethod def get_cursor(): if HTTPBooks.cursor is None: - filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), - u'..', u'resources', u'httpbooks.sqlite') + filepath = os.path.join( + AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', + u'resources', u'httpbooks.sqlite') conn = sqlite3.connect(filepath) HTTPBooks.cursor = conn.cursor() return HTTPBooks.cursor diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 658ac8a0b..e4cb79e73 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -33,6 +33,7 @@ import re from PyQt4 import QtCore from openlp.core.lib import Receiver +from openlp.core.utils import AppLocation from db import BibleDB log = logging.getLogger(__name__) @@ -66,9 +67,9 @@ class OSISBible(BibleDB): self.q_regex = re.compile(r'') self.spaces_regex = re.compile(r'([ ]{2,})') self.books = {} - filepath = os.path.split(os.path.abspath(__file__))[0] - filepath = os.path.abspath(os.path.join( - filepath, u'..', u'resources', u'osisbooks.csv')) + filepath = os.path.join( + AppLocation.get_directory(AppLocation.PluginsDir), u'bibles', + u'resources', u'osisbooks.csv') fbibles = None try: fbibles = open(filepath, u'r') diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index e39259a36..3f33090f6 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -27,6 +27,7 @@ import os import logging from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus +from openlp.core.utils import AppLocation from openlp.plugins.presentations.lib import * log = logging.getLogger(__name__) @@ -84,11 +85,13 @@ class PresentationPlugin(Plugin): If Not do not install the plugin. """ log.debug(u'check_pre_conditions') - dir = os.path.join(os.path.dirname(__file__), u'lib') - for filename in os.listdir(dir): + controller_dir = os.path.join( + AppLocation.get_directory(AppLocation.PluginsDir), + u'presentations', u'lib') + for filename in os.listdir(controller_dir): if filename.endswith(u'controller.py') and \ not filename == 'presentationcontroller.py': - path = os.path.join(dir, filename) + path = os.path.join(controller_dir, filename) if os.path.isfile(path): modulename = u'openlp.plugins.presentations.lib.' + \ os.path.splitext(filename)[0] diff --git a/resources/innosetup/OpenLP-2.0.iss b/resources/innosetup/OpenLP-2.0.iss index 4b25d6a28..41e9cd84b 100644 --- a/resources/innosetup/OpenLP-2.0.iss +++ b/resources/innosetup/OpenLP-2.0.iss @@ -5,7 +5,7 @@ #define MyAppVerName "OpenLP 2.0" #define MyAppPublisher "OpenLP Developers" #define MyAppURL "http://openlp.org/" -#define MyAppExeName "openlp.exe" +#define MyAppExeName "OpenLP.exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -20,12 +20,14 @@ AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName=OpenLP 2.0 -AllowNoIcons=yes +AllowNoIcons=true LicenseFile=LICENSE.txt -OutputBaseFilename=OpenLP-2.0-setup +OutputBaseFilename=OpenLP-1.9.0-bzr737-setup Compression=lzma SolidCompression=true -SetupIconFile=OpenLP.ico +SetupIconFile=C:\Program Files\Inno Setup 5\Examples\Setup.ico +WizardImageFile=C:\Program Files\Inno Setup 5\WizModernImage-IS.bmp +WizardSmallImageFile=C:\Program Files\Inno Setup 5\WizModernSmallImage-IS.bmp [Languages] Name: english; MessagesFile: compiler:Default.isl @@ -51,14 +53,16 @@ Name: slovenian; MessagesFile: compiler:Languages\Slovenian.isl Name: spanish; MessagesFile: compiler:Languages\Spanish.isl [Tasks] -Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked -Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked +Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons} +Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons} [Files] -Source: C:\Documents and Settings\raoul\My Documents\My Projects\openlp\pyinstaller\dist\openlp\*; DestDir: {app}; Flags: ignoreversion -Source: C:\Documents and Settings\raoul\My Documents\My Projects\openlp\pyinstaller\dist\openlp\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs -Source: C:\Documents and Settings\raoul\My Documents\My Projects\openlp\pyinstaller\dist\openlp\Microsoft.VC90.CRT\*; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion recursesubdirs createallsubdirs -Source: C:\Documents and Settings\raoul\My Documents\My Projects\openlp\pyinstaller\dist\openlp\qt4_plugins\*; DestDir: {app}\qt4_plugins; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion +Source: ..\..\dist\OpenLP\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\..\dist\OpenLP\Microsoft.VC90.CRT\*; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\..\dist\OpenLP\qt4_plugins\*; DestDir: {app}\qt4_plugins; Flags: ignoreversion recursesubdirs createallsubdirs +Source: ..\..\dist\OpenLP\eggs\*; DestDir: {app}\eggs; Flags: ignoreversion recursesubdirs createallsubdirs +Source: openlp.conf; DestDir: {userappdata}\openlp; Flags: ignoreversion onlyifdoesntexist ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/resources/innosetup/openlp.conf b/resources/innosetup/openlp.conf new file mode 100644 index 000000000..aab3b2260 --- /dev/null +++ b/resources/innosetup/openlp.conf @@ -0,0 +1,26 @@ +[bibles] +status = 1 + +[media] +status = 1 + +[alerts] +status = 1 + +[presentations] +status = 1 + +[custom] +status = 1 + +[remotes] +status = 0 + +[images] +status = 1 + +[songusage] +status = 1 + +[songs] +status = 1 diff --git a/resources/pyinstaller/hook-lxml.objectify.py b/resources/pyinstaller/hook-lxml.objectify.py new file mode 100644 index 000000000..071a0dca4 --- /dev/null +++ b/resources/pyinstaller/hook-lxml.objectify.py @@ -0,0 +1 @@ +hiddenimports = ['lxml.etree']