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

Proposed by Tim Bentley
Status: Merged
Merged at revision: 2149
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) Approve
Raoul Snyman Pending
Review via email: mp+174291@code.launchpad.net

This proposal supersedes 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 : Posted in a previous version of this proposal

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

review: Needs Fixing
Revision history for this message
Raoul Snyman (raoul-snyman) wrote : Posted in a previous version of this proposal

Oops, doesn't need a test.

review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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

Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote : Posted in a previous version of this proposal

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

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/generaltab.py'
2--- openlp/core/ui/generaltab.py 2012-12-30 19:41:24 +0000
3+++ openlp/core/ui/generaltab.py 2013-07-11 20:41:30 +0000
4@@ -92,14 +92,14 @@
5 self.monitorLayout.addWidget(self.customWidthLabel, 3, 3)
6 self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
7 self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
8- self.customWidthValueEdit.setMaximum(9999)
9+ self.customWidthValueEdit.setRange(1, 9999)
10 self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3)
11 self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox)
12 self.customHeightLabel.setObjectName(u'customHeightLabel')
13 self.monitorLayout.addWidget(self.customHeightLabel, 3, 4)
14 self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
15 self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
16- self.customHeightValueEdit.setMaximum(9999)
17+ self.customHeightValueEdit.setRange(1, 9999)
18 self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4)
19 self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
20 self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')
21
22=== modified file 'openlp/core/ui/themeform.py'
23--- openlp/core/ui/themeform.py 2013-03-19 19:22:10 +0000
24+++ openlp/core/ui/themeform.py 2013-07-11 20:41:30 +0000
25@@ -36,7 +36,7 @@
26 from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
27 from openlp.core.lib.ui import UiStrings, critical_error_message_box
28 from openlp.core.ui import ThemeLayoutForm
29-from openlp.core.utils import get_images_filter
30+from openlp.core.utils import get_images_filter, is_not_image_file
31 from themewizard import Ui_ThemeWizard
32
33 log = logging.getLogger(__name__)
34@@ -233,7 +233,7 @@
35 background_image = BackgroundType.to_string(BackgroundType.Image)
36 if self.page(self.currentId()) == self.backgroundPage and \
37 self.theme.background_type == background_image and \
38- self.imageFileEdit.text().isEmpty():
39+ is_not_image_file(self.imageFileEdit.text()):
40 QtGui.QMessageBox.critical(self,
41 translate('OpenLP.ThemeWizard', 'Background Image Empty'),
42 translate('OpenLP.ThemeWizard', 'You have not selected a '
43
44=== modified file 'openlp/core/utils/__init__.py'
45--- openlp/core/utils/__init__.py 2013-04-11 10:06:44 +0000
46+++ openlp/core/utils/__init__.py 2013-07-11 20:41:30 +0000
47@@ -364,6 +364,22 @@
48 visible_formats, actual_formats)
49 return IMAGES_FILTER
50
51+def is_not_image_file(file_name):
52+ """
53+ Validate that the file is not an image file.
54+
55+ ``file_name``
56+ File name to be checked.
57+ """
58+ if file_name.isEmpty():
59+ return True
60+ else:
61+ formats = [unicode(fmt).lower()
62+ for fmt in QtGui.QImageReader.supportedImageFormats()]
63+ file_part, file_extension = os.path.splitext(unicode(file_name))
64+ if file_extension[1:].lower() in formats and os.path.exists(file_name):
65+ return False
66+ return True
67
68 def join_url(base, *args):
69 """

Subscribers

People subscribed via source and target branches