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()
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

View File

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

View File

@ -53,7 +53,7 @@ blankthemexml=\
<weight>Normal</weight>
<italics>False</italics>
<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 type="footer">
<name>Arial</name>
@ -62,7 +62,7 @@ blankthemexml=\
<weight>Normal</weight>
<italics>False</italics>
<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>
<display>
<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.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):

View File

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

View File

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

View File

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

View File

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

View File

@ -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] = {}

View File

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

View File

@ -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'<q (.*?)>')
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')

View File

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

View File

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

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']