Merge lp:~trb143/openlp/json-2 into lp:openlp/2.0

Proposed by Tim Bentley
Status: Superseded
Proposed branch: lp:~trb143/openlp/json-2
Merge into: lp:openlp/2.0
Diff against target: 69 lines (+20/-4)
3 files modified
openlp/core/ui/generaltab.py (+2/-2)
openlp/core/ui/themeform.py (+2/-2)
openlp/core/utils/__init__.py (+16/-0)
To merge this branch: bzr merge lp:~trb143/openlp/json-2
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Needs Fixing
Raoul Snyman Approve
Review via email: mp+174274@code.launchpad.net

This proposal supersedes a proposal from 2013-07-11.

This proposal has been superseded by a proposal from 2013-07-11.

Description of the change

Two bug fixes for 2.0.2

To post a comment you must log in.
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote : Posted in a previous version of this proposal

or not os.path.exists()

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

A test for ``is_not_image_file(file_name)`` ?

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Oops, doesn't need a test.

review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Please move

58 + formats = [unicode(fmt)
59 + for fmt in QtGui.QImageReader.supportedImageFormats()]

to the else block.

Also use lower(). On windows is PNG == png

review: Needs Fixing
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

formats = map(unicode, QtGui.QImageReader.supportedImageFormats())
formats = map(unicode.lower, formats)

Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

> formats = map(unicode, QtGui.QImageReader.supportedImageFormats())
> formats = map(unicode.lower, formats)

Ah... rubbish... the extension needs to the lower() call.

lp:~trb143/openlp/json-2 updated
2145. By Tim Bentley

make suffix lower

2146. By Tim Bentley

pedent

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openlp/core/ui/generaltab.py'
--- openlp/core/ui/generaltab.py 2012-12-30 19:41:24 +0000
+++ openlp/core/ui/generaltab.py 2013-07-11 20:18:25 +0000
@@ -92,14 +92,14 @@
92 self.monitorLayout.addWidget(self.customWidthLabel, 3, 3)92 self.monitorLayout.addWidget(self.customWidthLabel, 3, 3)
93 self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox)93 self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
94 self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')94 self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
95 self.customWidthValueEdit.setMaximum(9999)95 self.customWidthValueEdit.setRange(1, 9999)
96 self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3)96 self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3)
97 self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox)97 self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox)
98 self.customHeightLabel.setObjectName(u'customHeightLabel')98 self.customHeightLabel.setObjectName(u'customHeightLabel')
99 self.monitorLayout.addWidget(self.customHeightLabel, 3, 4)99 self.monitorLayout.addWidget(self.customHeightLabel, 3, 4)
100 self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox)100 self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
101 self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')101 self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
102 self.customHeightValueEdit.setMaximum(9999)102 self.customHeightValueEdit.setRange(1, 9999)
103 self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4)103 self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4)
104 self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)104 self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
105 self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')105 self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
106106
=== modified file 'openlp/core/ui/themeform.py'
--- openlp/core/ui/themeform.py 2013-03-19 19:22:10 +0000
+++ openlp/core/ui/themeform.py 2013-07-11 20:18:25 +0000
@@ -36,7 +36,7 @@
36from openlp.core.lib.theme import BackgroundType, BackgroundGradientType36from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
37from openlp.core.lib.ui import UiStrings, critical_error_message_box37from openlp.core.lib.ui import UiStrings, critical_error_message_box
38from openlp.core.ui import ThemeLayoutForm38from openlp.core.ui import ThemeLayoutForm
39from openlp.core.utils import get_images_filter39from openlp.core.utils import get_images_filter, is_not_image_file
40from themewizard import Ui_ThemeWizard40from themewizard import Ui_ThemeWizard
4141
42log = logging.getLogger(__name__)42log = logging.getLogger(__name__)
@@ -233,7 +233,7 @@
233 background_image = BackgroundType.to_string(BackgroundType.Image)233 background_image = BackgroundType.to_string(BackgroundType.Image)
234 if self.page(self.currentId()) == self.backgroundPage and \234 if self.page(self.currentId()) == self.backgroundPage and \
235 self.theme.background_type == background_image and \235 self.theme.background_type == background_image and \
236 self.imageFileEdit.text().isEmpty():236 is_not_image_file(self.imageFileEdit.text()):
237 QtGui.QMessageBox.critical(self,237 QtGui.QMessageBox.critical(self,
238 translate('OpenLP.ThemeWizard', 'Background Image Empty'),238 translate('OpenLP.ThemeWizard', 'Background Image Empty'),
239 translate('OpenLP.ThemeWizard', 'You have not selected a '239 translate('OpenLP.ThemeWizard', 'You have not selected a '
240240
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2013-04-11 10:06:44 +0000
+++ openlp/core/utils/__init__.py 2013-07-11 20:18:25 +0000
@@ -364,6 +364,22 @@
364 visible_formats, actual_formats)364 visible_formats, actual_formats)
365 return IMAGES_FILTER365 return IMAGES_FILTER
366366
367def is_not_image_file(file_name):
368 """
369 Validate that the file is an image file.
370
371 ``file_name``
372 File name to be checked.
373 """
374 if file_name.isEmpty():
375 return True
376 else:
377 formats = [unicode(fmt).lower()
378 for fmt in QtGui.QImageReader.supportedImageFormats()]
379 file_part, file_extension = os.path.splitext(unicode(file_name))
380 if file_extension[1:].lower() in formats and os.path.exists(file_name):
381 return False
382 return True
367383
368def join_url(base, *args):384def join_url(base, *args):
369 """385 """

Subscribers

People subscribed via source and target branches