← Back to team overview

openlp-core team mailing list archive

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

 

Tim Bentley has proposed merging lp:~trb143/openlp/json-2 into lp:openlp/2.0.

Requested reviews:
  Andreas Preikschat (googol)
Related bugs:
  Bug #1196926 in OpenLP: "Zero division error when display size set to zero"
  https://bugs.launchpad.net/openlp/+bug/1196926
  Bug #1197376 in OpenLP: "Typing a path for a theme background causes a key error"
  https://bugs.launchpad.net/openlp/+bug/1197376

For more details, see:
https://code.launchpad.net/~trb143/openlp/json-2/+merge/174274

Two bug fixes for 2.0.2
-- 
https://code.launchpad.net/~trb143/openlp/json-2/+merge/174274
Your team OpenLP Core is subscribed to branch lp:openlp/2.0.
=== 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 19:20:50 +0000
@@ -92,14 +92,14 @@
         self.monitorLayout.addWidget(self.customWidthLabel, 3, 3)
         self.customWidthValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
         self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
-        self.customWidthValueEdit.setMaximum(9999)
+        self.customWidthValueEdit.setRange(1, 9999)
         self.monitorLayout.addWidget(self.customWidthValueEdit, 4, 3)
         self.customHeightLabel = QtGui.QLabel(self.monitorGroupBox)
         self.customHeightLabel.setObjectName(u'customHeightLabel')
         self.monitorLayout.addWidget(self.customHeightLabel, 3, 4)
         self.customHeightValueEdit = QtGui.QSpinBox(self.monitorGroupBox)
         self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
-        self.customHeightValueEdit.setMaximum(9999)
+        self.customHeightValueEdit.setRange(1, 9999)
         self.monitorLayout.addWidget(self.customHeightValueEdit, 4, 4)
         self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox)
         self.displayOnMonitorCheck.setObjectName(u'monitorComboBox')

=== 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 19:20:50 +0000
@@ -36,7 +36,7 @@
 from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
 from openlp.core.lib.ui import UiStrings, critical_error_message_box
 from openlp.core.ui import ThemeLayoutForm
-from openlp.core.utils import get_images_filter
+from openlp.core.utils import get_images_filter, is_not_image_file
 from themewizard import Ui_ThemeWizard
 
 log = logging.getLogger(__name__)
@@ -233,7 +233,7 @@
         background_image = BackgroundType.to_string(BackgroundType.Image)
         if self.page(self.currentId()) == self.backgroundPage and \
             self.theme.background_type == background_image and \
-            self.imageFileEdit.text().isEmpty():
+            is_not_image_file(self.imageFileEdit.text()):
             QtGui.QMessageBox.critical(self,
                 translate('OpenLP.ThemeWizard', 'Background Image Empty'),
                 translate('OpenLP.ThemeWizard', 'You have not selected a '

=== 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 19:20:50 +0000
@@ -364,6 +364,22 @@
             visible_formats, actual_formats)
     return IMAGES_FILTER
 
+def is_not_image_file(file_name):
+    """
+    Validate that the file is an image file.
+
+    ``file_name``
+        File name to be checked.
+    """
+    formats = [unicode(fmt)
+            for fmt in QtGui.QImageReader.supportedImageFormats()]
+    if file_name.isEmpty():
+        return True
+    else:
+        file_part, file_extension = os.path.splitext(unicode(file_name))
+        if file_extension[1:] in formats and os.path.exists(file_name):
+            return False
+        return True
 
 def join_url(base, *args):
     """


Follow ups