forked from openlp/openlp
head
This commit is contained in:
commit
ac7126d929
@ -391,21 +391,26 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.iconFromFile(image, thumb)
|
self.iconFromFile(image, thumb)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def iconFromFile(self, image, thumb):
|
def iconFromFile(self, image_path, thumb_path):
|
||||||
"""
|
"""
|
||||||
Create a thumbnail icon from a given image.
|
Create a thumbnail icon from a given image.
|
||||||
|
|
||||||
``image``
|
``image_path``
|
||||||
The image file to create the icon from.
|
The image file to create the icon from.
|
||||||
|
|
||||||
``thumb``
|
``thumb_path``
|
||||||
The filename to save the thumbnail to
|
The filename to save the thumbnail to.
|
||||||
"""
|
"""
|
||||||
icon = build_icon(unicode(image))
|
ext = os.path.splitext(thumb_path)[1].lower()
|
||||||
pixmap = icon.pixmap(QtCore.QSize(88, 50))
|
reader = QtGui.QImageReader(image_path)
|
||||||
ext = os.path.splitext(thumb)[1].lower()
|
ratio = float(reader.size().width()) / float(reader.size().height())
|
||||||
pixmap.save(thumb, ext[1:])
|
reader.setScaledSize(QtCore.QSize(int(ratio * 88), 88))
|
||||||
return icon
|
thumb = reader.read()
|
||||||
|
thumb.save(thumb_path, ext[1:])
|
||||||
|
if os.path.exists(thumb_path):
|
||||||
|
return build_icon(unicode(thumb_path))
|
||||||
|
# Fallback for files with animation support.
|
||||||
|
return build_icon(unicode(image_path))
|
||||||
|
|
||||||
def loadList(self, list):
|
def loadList(self, list):
|
||||||
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
raise NotImplementedError(u'MediaManagerItem.loadList needs to be '
|
||||||
|
@ -106,7 +106,7 @@ class ScreenList(object):
|
|||||||
"""
|
"""
|
||||||
# Do not log at start up.
|
# Do not log at start up.
|
||||||
if changed_screen != -1:
|
if changed_screen != -1:
|
||||||
log.info(u'screen_count_changed %d' % number)
|
log.info(u'screen_count_changed %d' % self.desktop.numScreens())
|
||||||
# Remove unplugged screens.
|
# Remove unplugged screens.
|
||||||
for screen in copy.deepcopy(self.screen_list):
|
for screen in copy.deepcopy(self.screen_list):
|
||||||
if screen[u'number'] == self.desktop.numScreens():
|
if screen[u'number'] == self.desktop.numScreens():
|
||||||
|
@ -772,7 +772,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
log.exception(u'The second_search_results does not have as '
|
log.exception(u'The second_search_results does not have as '
|
||||||
'many verses as the search_results.')
|
'many verses as the search_results.')
|
||||||
break
|
break
|
||||||
bible_text = u' %s %d%s%d (%s, %s)' % (verse.book.name,
|
bible_text = u'%s %d%s%d (%s, %s)' % (verse.book.name,
|
||||||
verse.chapter, verse_separator, verse.verse, version,
|
verse.chapter, verse_separator, verse.verse, version,
|
||||||
second_version)
|
second_version)
|
||||||
else:
|
else:
|
||||||
@ -830,7 +830,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
bible_text = u''
|
bible_text = u''
|
||||||
# If we are 'Verse Per Line' then force a new line.
|
# If we are 'Verse Per Line' then force a new line.
|
||||||
elif self.settings.layout_style == LayoutStyle.VersePerLine:
|
elif self.settings.layout_style == LayoutStyle.VersePerLine:
|
||||||
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s%s %s\n' % (bible_text, verse_text, text)
|
||||||
# We have to be 'Continuous'.
|
# We have to be 'Continuous'.
|
||||||
else:
|
else:
|
||||||
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
bible_text = u'%s %s %s\n' % (bible_text, verse_text, text)
|
||||||
|
Loading…
Reference in New Issue
Block a user