String fixes

This commit is contained in:
Tim Bentley 2010-08-28 16:49:51 +01:00
parent 764c3d42c9
commit 5ba4de64ca
5 changed files with 24 additions and 15 deletions

View File

@ -229,7 +229,7 @@ def context_menu_separator(base):
def image_to_byte(image): def image_to_byte(image):
""" """
Resize an image to fit on the current screen for the web and retuns Resize an image to fit on the current screen for the web and returns
it as a byte stream. it as a byte stream.
``image`` ``image``
@ -253,12 +253,16 @@ def resize_image(image, width, height, background=QtCore.Qt.black):
``image`` ``image``
The image to resize. The image to resize.
``width`` ``width``
The new image width. The new image width.
``height`` ``height``
The new image height. The new image height.
``background ``
``background``
The background colour defaults to black. The background colour defaults to black.
""" """
preview = QtGui.QImage(image) preview = QtGui.QImage(image)
if not preview.isNull(): if not preview.isNull():

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, resize_image, build_html, ServiceItem, \ from openlp.core.lib import Receiver, resize_image, build_html, ServiceItem, \
image_to_byte image_to_byte
from openlp.core.ui import HideMode from openlp.core.ui import HideMode
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -58,6 +58,9 @@ class DisplayWidget(QtGui.QGraphicsView):
self.setStyleSheet(u'border: none;') self.setStyleSheet(u'border: none;')
def keyPressEvent(self, event): def keyPressEvent(self, event):
"""
Handle key events from display screen
"""
# Key events only needed for live # Key events only needed for live
if not self.live: if not self.live:
return return
@ -104,6 +107,9 @@ class MainDisplay(DisplayWidget):
QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay)
def setup(self): def setup(self):
"""
Set up and build the output screen
"""
log.debug(u'Setup live = %s for %s ' % (self.isLive, log.debug(u'Setup live = %s for %s ' % (self.isLive,
self.screens.monitor_number)) self.screens.monitor_number))
self.screen = self.screens.current self.screen = self.screens.current
@ -332,6 +338,9 @@ class MainDisplay(DisplayWidget):
self.footer(serviceItem.foot_text) self.footer(serviceItem.foot_text)
def footer(self, text): def footer(self, text):
"""
Display the Footer
"""
log.debug(u'footer') log.debug(u'footer')
js = "show_footer('" + \ js = "show_footer('" + \
text.replace("\\", "\\\\").replace("\'", "\\\'") + "')" text.replace("\\", "\\\\").replace("\'", "\\\'") + "')"

View File

@ -317,7 +317,7 @@ class SlideController(QtGui.QWidget):
self.SlidePreview.setSizePolicy(sizePolicy) self.SlidePreview.setSizePolicy(sizePolicy)
self.SlidePreview.setFixedSize( self.SlidePreview.setFixedSize(
QtCore.QSize(self.settingsmanager.slidecontroller_image, QtCore.QSize(self.settingsmanager.slidecontroller_image,
self.settingsmanager.slidecontroller_image / self.ratio )) self.settingsmanager.slidecontroller_image / self.ratio))
self.SlidePreview.setFrameShape(QtGui.QFrame.Box) self.SlidePreview.setFrameShape(QtGui.QFrame.Box)
self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain) self.SlidePreview.setFrameShadow(QtGui.QFrame.Plain)
self.SlidePreview.setLineWidth(1) self.SlidePreview.setLineWidth(1)
@ -404,7 +404,7 @@ class SlideController(QtGui.QWidget):
self.display.setup() self.display.setup()
self.SlidePreview.setFixedSize( self.SlidePreview.setFixedSize(
QtCore.QSize(self.settingsmanager.slidecontroller_image, QtCore.QSize(self.settingsmanager.slidecontroller_image,
self.settingsmanager.slidecontroller_image / self.ratio )) self.settingsmanager.slidecontroller_image / self.ratio))
def widthChanged(self): def widthChanged(self):
""" """

View File

@ -139,13 +139,13 @@ class ThemeManager(QtGui.QWidget):
""" """
log.debug(u'changeGlobalFromTab %s', themeName) log.debug(u'changeGlobalFromTab %s', themeName)
for count in range (0, self.themeListWidget.count()): for count in range (0, self.themeListWidget.count()):
#reset the old name # reset the old name
item = self.themeListWidget.item(count) item = self.themeListWidget.item(count)
oldName = item.text() oldName = item.text()
newName = unicode(item.data(QtCore.Qt.UserRole).toString()) newName = unicode(item.data(QtCore.Qt.UserRole).toString())
if oldName != newName: if oldName != newName:
self.themeListWidget.item(count).setText(newName) self.themeListWidget.item(count).setText(newName)
#Set the new name # Set the new name
if themeName == newName: if themeName == newName:
name = unicode(translate('OpenLP.ThemeManager', name = unicode(translate('OpenLP.ThemeManager',
'%s (default)')) % newName '%s (default)')) % newName
@ -161,11 +161,11 @@ class ThemeManager(QtGui.QWidget):
for count in range (0, self.themeListWidget.count()): for count in range (0, self.themeListWidget.count()):
item = self.themeListWidget.item(count) item = self.themeListWidget.item(count)
oldName = item.text() oldName = item.text()
#reset the old name # reset the old name
if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()): if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.themeListWidget.item(count).setText( self.themeListWidget.item(count).setText(
unicode(item.data(QtCore.Qt.UserRole).toString())) unicode(item.data(QtCore.Qt.UserRole).toString()))
#Set the new name # Set the new name
if count == selected_row: if count == selected_row:
self.global_theme = unicode( self.global_theme = unicode(
self.themeListWidget.item(count).text()) self.themeListWidget.item(count).text())
@ -346,11 +346,10 @@ class ThemeManager(QtGui.QWidget):
log.debug(u'Load themes from dir') log.debug(u'Load themes from dir')
self.themelist = [] self.themelist = []
self.themeListWidget.clear() self.themeListWidget.clear()
#root, dirs, files = os.walk(self.path)
dirList = os.listdir(self.path) dirList = os.listdir(self.path)
for name in dirList: for name in dirList:
if name.endswith(u'.png'): if name.endswith(u'.png'):
#check to see file is in theme root directory # check to see file is in theme root directory
theme = os.path.join(self.path, name) theme = os.path.join(self.path, name)
if os.path.exists(theme): if os.path.exists(theme):
textName = os.path.splitext(name)[0] textName = os.path.splitext(name)[0]
@ -731,8 +730,6 @@ class ThemeManager(QtGui.QWidget):
theme.display_slideTransition = theme.display_slideTransition theme.display_slideTransition = theme.display_slideTransition
theme.font_footer_color = theme.font_footer_color.strip() theme.font_footer_color = theme.font_footer_color.strip()
theme.font_footer_height = int(theme.font_footer_height.strip()) theme.font_footer_height = int(theme.font_footer_height.strip())
# theme.font_footer_indentation = \
# int(theme.font_footer_indentation.strip())
theme.font_footer_italics = str_to_bool(theme.font_footer_italics) theme.font_footer_italics = str_to_bool(theme.font_footer_italics)
theme.font_footer_name = theme.font_footer_name.strip() theme.font_footer_name = theme.font_footer_name.strip()
#theme.font_footer_override #theme.font_footer_override
@ -745,7 +742,6 @@ class ThemeManager(QtGui.QWidget):
theme.font_main_color = theme.font_main_color.strip() theme.font_main_color = theme.font_main_color.strip()
theme.font_main_height = int(theme.font_main_height.strip()) theme.font_main_height = int(theme.font_main_height.strip())
theme.font_main_italics = str_to_bool(theme.font_main_italics) theme.font_main_italics = str_to_bool(theme.font_main_italics)
# theme.font_main_indentation = int(theme.font_main_indentation)
theme.font_main_name = theme.font_main_name.strip() theme.font_main_name = theme.font_main_name.strip()
#theme.font_main_override #theme.font_main_override
theme.font_main_proportion = int(theme.font_main_proportion.strip()) theme.font_main_proportion = int(theme.font_main_proportion.strip())

View File

@ -83,7 +83,7 @@ class AlertsPlugin(Plugin):
self.liveController.alertTab = self.alertsTab self.liveController.alertTab = self.alertsTab
def finalise(self): def finalise(self):
log.info(u'Alerts Finaliseing') log.info(u'Alerts Finalising')
Plugin.finalise(self) Plugin.finalise(self)
self.toolsAlertItem.setVisible(False) self.toolsAlertItem.setVisible(False)