openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06168
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/49317
Fixes, cleanups and UiStrings
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/49317
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/htmlbuilder.py'
--- openlp/core/lib/htmlbuilder.py 2011-01-23 15:36:15 +0000
+++ openlp/core/lib/htmlbuilder.py 2011-02-10 23:03:57 +0000
@@ -28,7 +28,8 @@
from PyQt4 import QtWebKit
-from openlp.core.lib import BackgroundType, BackgroundGradientType
+from openlp.core.lib import BackgroundType, BackgroundGradientType, \
+ VerticalType
log = logging.getLogger(__name__)
@@ -536,12 +537,7 @@
align = u'right'
else:
align = u'left'
- if theme.display_vertical_align == 2:
- valign = u'bottom'
- elif theme.display_vertical_align == 1:
- valign = u'middle'
- else:
- valign = u'top'
+ valign = VerticalType.to_string(theme.display_vertical_align)
if theme.font_main_outline:
left_margin = int(theme.font_main_outline_size) * 2
else:
@@ -634,13 +630,7 @@
"""
if not alertTab:
return u''
- align = u''
- if alertTab.location == 2:
- align = u'bottom'
- elif alertTab.location == 1:
- align = u'middle'
- else:
- align = u'top'
+ align = VerticalType.to_string(alertTab.location)
alert = style % (width, align, alertTab.font_face, alertTab.font_size,
alertTab.font_color, alertTab.bg_color)
return alert
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2011-02-08 02:45:37 +0000
+++ openlp/core/lib/theme.py 2011-02-10 23:03:57 +0000
@@ -164,6 +164,7 @@
elif type_string == u'leftBottom':
return BackgroundGradientType.LeftBottom
+
class HorizontalType(object):
"""
Type enumeration for horizontal alignment.
@@ -172,6 +173,19 @@
Center = 1
Right = 2
+ @staticmethod
+ def to_string(horizontal_type):
+ """
+ Return a string representation of a horizontal type.
+ """
+ if horizontal_type == Horizontal.Right:
+ return u'right'
+ elif horizontal_type == Horizontal.Center:
+ return u'center'
+ else:
+ return u'left'
+
+
class VerticalType(object):
"""
Type enumeration for vertical alignment.
@@ -180,6 +194,19 @@
Middle = 1
Bottom = 2
+ @staticmethod
+ def to_string(vertical_type):
+ """
+ Return a string representation of a vertical type.
+ """
+ if vertical_type == VerticalType.Bottom:
+ return u'bottom'
+ elif vertical_type == VerticalType.Middle:
+ return u'middle'
+ else:
+ return u'top'
+
+
BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
u'slide_transition']
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2011-02-10 18:35:59 +0000
+++ openlp/core/lib/ui.py 2011-02-10 23:03:57 +0000
@@ -64,12 +64,14 @@
New = translate('OpenLP.Ui', 'New')
NewType = unicode(translate('OpenLP.Ui', 'New %s'))
OLPV2 = translate('OpenLP.Ui', 'OpenLP 2.0')
+ OpenType = unicode(translate('OpenLP.Ui', 'Open %s'))
Preview = translate('OpenLP.Ui', 'Preview')
PreviewSelect = unicode(translate('OpenLP.Ui', 'Preview the selected %s.'))
ReplaceBG = translate('OpenLP.Ui', 'Replace Background')
ReplaceLiveBG = translate('OpenLP.Ui', 'Replace Live Background')
ResetBG = translate('OpenLP.Ui', 'Reset Background')
ResetLiveBG = translate('OpenLP.Ui', 'Reset Live Background')
+ SaveType = unicode(translate('OpenLP.Ui', 'Save %s'))
SendSelectLive = unicode(translate('OpenLP.Ui',
'Send the selected %s live.'))
Service = translate('OpenLP.Ui', 'Service')
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-02-10 18:59:59 +0000
+++ openlp/core/ui/mainwindow.py 2011-02-10 23:03:57 +0000
@@ -324,14 +324,12 @@
UiStrings.CreateANew % UiStrings.Service.toLower())
self.FileNewItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+N'))
self.FileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
- self.FileOpenItem.setToolTip(
- translate('OpenLP.MainWindow', 'Open Service'))
+ self.FileOpenItem.setToolTip(UiStrings.OpenType % UiStrings.Service)
self.FileOpenItem.setStatusTip(
translate('OpenLP.MainWindow', 'Open an existing service.'))
self.FileOpenItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+O'))
self.FileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
- self.FileSaveItem.setToolTip(
- translate('OpenLP.MainWindow', 'Save Service'))
+ self.FileSaveItem.setToolTip(UiStrings.SaveType % UiStrings.Service)
self.FileSaveItem.setStatusTip(
translate('OpenLP.MainWindow', 'Save the current service to disk.'))
self.FileSaveItem.setShortcut(translate('OpenLP.MainWindow', 'Ctrl+S'))
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-02-10 18:35:59 +0000
+++ openlp/core/ui/servicemanager.py 2011-02-10 23:03:57 +0000
@@ -100,12 +100,12 @@
UiStrings.CreateANew % UiStrings.Service.toLower(),
self.onNewServiceClicked)
self.toolbar.addToolbarButton(
- translate('OpenLP.ServiceManager', 'Open Service'),
+ UiStrings.OpenType % UiStrings.Service,
u':/general/general_open.png',
translate('OpenLP.ServiceManager', 'Load an existing service'),
self.onLoadServiceClicked)
self.toolbar.addToolbarButton(
- translate('OpenLP.ServiceManager', 'Save Service'),
+ UiStrings.SaveType % UiStrings.Service,
u':/general/general_save.png',
translate('OpenLP.ServiceManager', 'Save this service'),
self.saveFile)
@@ -465,7 +465,7 @@
save the file.
"""
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.mainwindow,
- translate('OpenLP.ServiceManager', 'Save Service'),
+ UiStrings.SaveType % UiStrings.Service,
SettingsManager.get_last_dir(
self.mainwindow.serviceSettingsSection),
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)')))
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2011-02-10 04:06:16 +0000
+++ openlp/core/ui/thememanager.py 2011-02-10 23:03:57 +0000
@@ -34,7 +34,8 @@
from openlp.core.lib import OpenLPToolbar, ThemeXML, get_text_file_string, \
build_icon, Receiver, SettingsManager, translate, check_item_selected, \
- BackgroundType, BackgroundGradientType, check_directory_exists
+ BackgroundType, BackgroundGradientType, check_directory_exists, \
+ VerticalType
from openlp.core.lib.ui import UiStrings, critical_error_message_box
from openlp.core.theme import Theme
from openlp.core.ui import FileRenameForm, ThemeForm
@@ -762,11 +763,11 @@
newtheme.font_main_outline = True
newtheme.font_main_outline_color = \
unicode(theme.OutlineColor.name())
- vAlignCorrection = 0
+ vAlignCorrection = VerticalType.Top
if theme.VerticalAlign == 2:
- vAlignCorrection = 1
+ vAlignCorrection = VerticalType.Middle
elif theme.VerticalAlign == 1:
- vAlignCorrection = 2
+ vAlignCorrection = VerticalType.Bottom
newtheme.display_horizontal_align = theme.HorizontalAlign
newtheme.display_vertical_align = vAlignCorrection
return newtheme.extract_xml()
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2011-02-10 19:37:02 +0000
+++ openlp/core/ui/wizard.py 2011-02-10 23:03:57 +0000
@@ -27,11 +27,12 @@
The :mod:``wizard`` module provides generic wizard tools for OpenLP.
"""
import logging
+import os
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon, Receiver
-from openlp.core.lib.ui import add_welcome_page
+from openlp.core.lib import build_icon, Receiver, SettingsManager
+from openlp.core.lib.ui import UiStrings, add_welcome_page
log = logging.getLogger(__name__)
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2011-02-10 19:37:02 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2011-02-10 23:03:57 +0000
@@ -33,9 +33,9 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver, SettingsManager, translate
+from openlp.core.lib import Receiver, translate
from openlp.core.lib.db import delete_database
-from openlp.core.lib.ui import UiStrings, critical_error_message_box
+from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard
from openlp.core.utils import AppLocation, string_is_unicode
from openlp.plugins.bibles.lib.manager import BibleFormat