Fix screen size and rendering issues

This commit is contained in:
Tim Bentley 2010-03-13 15:11:31 +00:00
commit 2d934c8ed9
15 changed files with 89 additions and 35 deletions

View File

@ -34,7 +34,6 @@ from PyQt4 import QtCore, QtGui
log = logging.getLogger() log = logging.getLogger()
import openlp
from openlp.core.lib import Receiver, str_to_bool from openlp.core.lib import Receiver, str_to_bool
from openlp.core.resources import qInitResources from openlp.core.resources import qInitResources
from openlp.core.ui import MainWindow, SplashScreen, ScreenList from openlp.core.ui import MainWindow, SplashScreen, ScreenList

View File

@ -43,7 +43,8 @@ class Renderer(object):
""" """
self._rect = None self._rect = None
self._debug = False 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_shadow_size_footer = 0
self._display_outline_size_footer = 0 self._display_outline_size_footer = 0
self.theme_name = None self.theme_name = None
@ -149,7 +150,7 @@ class Renderer(object):
def pre_render_text(self, text): def pre_render_text(self, text):
metrics = QtGui.QFontMetrics(self.mainFont) metrics = QtGui.QFontMetrics(self.mainFont)
#work out line width #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. #number of lines on a page - adjust for rounding up.
line_height = metrics.height() line_height = metrics.height()
if self._theme.display_shadow: if self._theme.display_shadow:
@ -224,6 +225,7 @@ class Renderer(object):
``rect_footer`` ``rect_footer``
The footer text block. The footer text block.
""" """
log.debug(u'set_text_rectangle %s , %s' %(rect_main, rect_footer) )
self._rect = rect_main self._rect = rect_main
self._rect_footer = rect_footer self._rect_footer = rect_footer
@ -447,8 +449,8 @@ class Renderer(object):
rightextent = x + w rightextent = x + w
# shift right from last line's rh edge # shift right from last line's rh edge
if self._theme.display_wrapStyle == 1 and linenum != 0: if self._theme.display_wrapStyle == 1 and linenum != 0:
rightextent = self._first_line_right_extent + \ rightextent = self._first_line_right_extent #+ \
self._right_margin #self._right_margin
if rightextent > maxx: if rightextent > maxx:
rightextent = maxx rightextent = maxx
x = rightextent - w x = rightextent - w

View File

@ -53,7 +53,7 @@ blankthemexml=\
<weight>Normal</weight> <weight>Normal</weight>
<italics>False</italics> <italics>False</italics>
<indentation>0</indentation> <indentation>0</indentation>
<location override="False" x="10" y="10" width="1024" height="730"/> <location override="False" x="10" y="10" width="1004" height="730"/>
</font> </font>
<font type="footer"> <font type="footer">
<name>Arial</name> <name>Arial</name>
@ -62,7 +62,7 @@ blankthemexml=\
<weight>Normal</weight> <weight>Normal</weight>
<italics>False</italics> <italics>False</italics>
<indentation>0</indentation> <indentation>0</indentation>
<location override="False" x="10" y="730" width="1024" height="38"/> <location override="False" x="10" y="730" width="1004" height="38"/>
</font> </font>
<display> <display>
<shadow color="#000000" size="5">True</shadow> <shadow color="#000000" size="5">True</shadow>

View File

@ -621,6 +621,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.screens.set_current_display(updated_display) self.screens.set_current_display(updated_display)
self.RenderManager.update_display(updated_display) self.RenderManager.update_display(updated_display)
self.mainDisplay.setup(updated_display) self.mainDisplay.setup(updated_display)
#Trigger after changes have been made
Receiver.send_message(u'config_updated')
self.activateWindow() self.activateWindow()
def closeEvent(self, event): def closeEvent(self, event):

View File

@ -190,6 +190,8 @@ class ServiceManager(QtGui.QWidget):
QtCore.SIGNAL(u'presentation types'), self.onPresentationTypes) QtCore.SIGNAL(u'presentation types'), self.onPresentationTypes)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'servicemanager_next_item'), self.nextItem) 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 # Last little bits of setting up
self.config = PluginConfig(u'ServiceManager') self.config = PluginConfig(u'ServiceManager')
self.servicePath = self.config.get_data_path() self.servicePath = self.config.get_data_path()
@ -617,7 +619,7 @@ class ServiceManager(QtGui.QWidget):
for item in tempServiceItems: for item in tempServiceItems:
self.addServiceItem(item[u'service_item'], False, item[u'expanded']) self.addServiceItem(item[u'service_item'], False, item[u'expanded'])
#Set to False as items may have changed rendering #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) self.parent.serviceChanged(False, self.serviceName)
def addServiceItem(self, item, rebuild=False, expand=True): def addServiceItem(self, item, rebuild=False, expand=True):

View File

@ -65,7 +65,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
def accept(self): def accept(self):
for tab_index in range(0, self.SettingsTabWidget.count()): for tab_index in range(0, self.SettingsTabWidget.count()):
self.SettingsTabWidget.widget(tab_index).save() self.SettingsTabWidget.widget(tab_index).save()
Receiver.send_message(u'config_updated')
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
def postSetUp(self): def postSetUp(self):

View File

@ -299,6 +299,8 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'%s_change' % prefix), self.onSlideChange) QtCore.SIGNAL(u'%s_change' % prefix), self.onSlideChange)
QtCore.QObject.connect(self.Splitter, QtCore.QObject.connect(self.Splitter,
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter) QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
def widthChanged(self): def widthChanged(self):
""" """
@ -377,6 +379,17 @@ class SlideController(QtGui.QWidget):
self.Mediabar.setVisible(True) self.Mediabar.setVisible(True)
self.volumeSlider.setAudioOutput(self.audio) 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): def addServiceItem(self, item):
""" """
Method to install the service item into the controller Method to install the service item into the controller

View File

@ -45,9 +45,9 @@ class AppLocation(object):
if dir_type == AppLocation.AppDir: if dir_type == AppLocation.AppDir:
return os.path.abspath(os.path.split(sys.argv[0])[0]) return os.path.abspath(os.path.split(sys.argv[0])[0])
elif dir_type == AppLocation.ConfigDir: 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') 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', path = os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp') u'Application Support', u'openlp')
else: else:
@ -58,9 +58,9 @@ class AppLocation(object):
path = os.path.join(os.getenv(u'HOME'), u'.openlp') path = os.path.join(os.getenv(u'HOME'), u'.openlp')
return path return path
elif dir_type == AppLocation.DataDir: 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') 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', path = os.path.join(os.getenv(u'HOME'), u'Library',
u'Application Support', u'openlp', u'Data') u'Application Support', u'openlp', u'Data')
else: else:
@ -100,4 +100,4 @@ def check_latest_version(config, current_version):
from registry import Registry from registry import Registry
from confighelper import ConfigHelper 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']

View File

@ -32,6 +32,7 @@ from PyQt4 import QtCore, QtGui
from bibleimportwizard import Ui_BibleImportWizard from bibleimportwizard import Ui_BibleImportWizard
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib.manager import BibleFormat from openlp.plugins.bibles.lib.manager import BibleFormat
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -258,9 +259,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
Load the list of Crosswalk and BibleGateway bibles. Load the list of Crosswalk and BibleGateway bibles.
""" """
#Load and store Crosswalk Bibles #Load and store Crosswalk Bibles
filepath = os.path.abspath(os.path.join( filepath = AppLocation.get_directory(AppLocation.PluginsDir)
os.path.split(os.path.abspath(__file__))[0], filepath = os.path.join(filepath, u'bibles', u'resources')
u'..', u'resources'))
fbibles = None fbibles = None
try: try:
self.web_bible_list[DownloadLocation.Crosswalk] = {} self.web_bible_list[DownloadLocation.Crosswalk] = {}

View File

@ -31,6 +31,7 @@ import sqlite3
from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulSoup
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from common import BibleCommon, SearchResults from common import BibleCommon, SearchResults
from db import BibleDB from db import BibleDB
from openlp.plugins.bibles.lib.models import Book from openlp.plugins.bibles.lib.models import Book
@ -43,8 +44,9 @@ class HTTPBooks(object):
@staticmethod @staticmethod
def get_cursor(): def get_cursor():
if HTTPBooks.cursor is None: if HTTPBooks.cursor is None:
filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), filepath = os.path.join(
u'..', u'resources', u'httpbooks.sqlite') AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
u'resources', u'httpbooks.sqlite')
conn = sqlite3.connect(filepath) conn = sqlite3.connect(filepath)
HTTPBooks.cursor = conn.cursor() HTTPBooks.cursor = conn.cursor()
return HTTPBooks.cursor return HTTPBooks.cursor

View File

@ -33,6 +33,7 @@ import re
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.lib import Receiver from openlp.core.lib import Receiver
from openlp.core.utils import AppLocation
from db import BibleDB from db import BibleDB
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -66,9 +67,9 @@ class OSISBible(BibleDB):
self.q_regex = re.compile(r'<q (.*?)>') self.q_regex = re.compile(r'<q (.*?)>')
self.spaces_regex = re.compile(r'([ ]{2,})') self.spaces_regex = re.compile(r'([ ]{2,})')
self.books = {} self.books = {}
filepath = os.path.split(os.path.abspath(__file__))[0] filepath = os.path.join(
filepath = os.path.abspath(os.path.join( AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
filepath, u'..', u'resources', u'osisbooks.csv')) u'resources', u'osisbooks.csv')
fbibles = None fbibles = None
try: try:
fbibles = open(filepath, u'r') fbibles = open(filepath, u'r')

View File

@ -27,6 +27,7 @@ import os
import logging import logging
from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus from openlp.core.lib import Plugin, build_icon, Receiver, PluginStatus
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import * from openlp.plugins.presentations.lib import *
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -84,11 +85,13 @@ class PresentationPlugin(Plugin):
If Not do not install the plugin. If Not do not install the plugin.
""" """
log.debug(u'check_pre_conditions') log.debug(u'check_pre_conditions')
dir = os.path.join(os.path.dirname(__file__), u'lib') controller_dir = os.path.join(
for filename in os.listdir(dir): AppLocation.get_directory(AppLocation.PluginsDir),
u'presentations', u'lib')
for filename in os.listdir(controller_dir):
if filename.endswith(u'controller.py') and \ if filename.endswith(u'controller.py') and \
not filename == 'presentationcontroller.py': not filename == 'presentationcontroller.py':
path = os.path.join(dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.plugins.presentations.lib.' + \ modulename = u'openlp.plugins.presentations.lib.' + \
os.path.splitext(filename)[0] os.path.splitext(filename)[0]

View File

@ -5,7 +5,7 @@
#define MyAppVerName "OpenLP 2.0" #define MyAppVerName "OpenLP 2.0"
#define MyAppPublisher "OpenLP Developers" #define MyAppPublisher "OpenLP Developers"
#define MyAppURL "http://openlp.org/" #define MyAppURL "http://openlp.org/"
#define MyAppExeName "openlp.exe" #define MyAppExeName "OpenLP.exe"
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
@ -20,12 +20,14 @@ AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL} AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName} DefaultDirName={pf}\{#MyAppName}
DefaultGroupName=OpenLP 2.0 DefaultGroupName=OpenLP 2.0
AllowNoIcons=yes AllowNoIcons=true
LicenseFile=LICENSE.txt LicenseFile=LICENSE.txt
OutputBaseFilename=OpenLP-2.0-setup OutputBaseFilename=OpenLP-1.9.0-bzr737-setup
Compression=lzma Compression=lzma
SolidCompression=true 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] [Languages]
Name: english; MessagesFile: compiler:Default.isl Name: english; MessagesFile: compiler:Default.isl
@ -51,14 +53,16 @@ Name: slovenian; MessagesFile: compiler:Languages\Slovenian.isl
Name: spanish; MessagesFile: compiler:Languages\Spanish.isl Name: spanish; MessagesFile: compiler:Languages\Spanish.isl
[Tasks] [Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}
[Files] [Files]
Source: C:\Documents and Settings\raoul\My Documents\My Projects\openlp\pyinstaller\dist\openlp\*; DestDir: {app}; Flags: ignoreversion Source: ..\..\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: ..\..\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: ..\..\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\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 ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]

View File

@ -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

View File

@ -0,0 +1 @@
hiddenimports = ['lxml.etree']