~phill-ridout/openlp/bug1209515

« back to all changes in this revision

Viewing changes to openlp/core/utils/__init__.py

  • Committer: Tim Bentley
  • Date: 2013-07-15 19:33:50 UTC
  • mfrom: (2250.1.24 general)
  • Revision ID: tim.bentley@gmail.com-20130715193350-npygrmen3xxbhphh
rename new url from live to main
fix display constraints
fix missing image test
add tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
246
246
    return IMAGES_FILTER
247
247
 
248
248
 
 
249
def is_not_image_file(file_name):
 
250
    """
 
251
    Validate that the file is not an image file.
 
252
 
 
253
    ``file_name``
 
254
        File name to be checked.
 
255
    """
 
256
    if not file_name:
 
257
        return True
 
258
    else:
 
259
        formats = [unicode(fmt).lower() for fmt in QtGui.QImageReader.supportedImageFormats()]
 
260
        file_part, file_extension = os.path.splitext(unicode(file_name))
 
261
        if file_extension[1:].lower() in formats and os.path.exists(file_name):
 
262
            return False
 
263
        return True
 
264
 
 
265
 
249
266
def split_filename(path):
250
267
    """
251
268
    Return a list of the parts in a given path.