forked from openlp/openlp
Fix import of files that contain non-ascii chars.
QStringList containing QStrings is converted to std list containing unicode strings. Thus, we don't need these unicode() calls on the contents of the list anymore.
This commit is contained in:
parent
c45d6915c7
commit
1e53bd37a6
@ -342,8 +342,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
SettingsManager.get_last_dir(self.settingsSection),
|
SettingsManager.get_last_dir(self.settingsSection),
|
||||||
self.onNewFileMasks)
|
self.onNewFileMasks)
|
||||||
# Convert QStringList containing QStrings to a Python list containing unicode strings
|
# Convert QStringList containing QStrings to a Python list containing unicode strings
|
||||||
files = [unicode(f) for f in files]
|
files = map(unicode, files)
|
||||||
log.info(u'New files(s) %s', unicode(files))
|
log.info(u'New files(s) %s', files)
|
||||||
if files:
|
if files:
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
self.validateAndLoad(files)
|
self.validateAndLoad(files)
|
||||||
|
@ -130,17 +130,17 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
# Sort the images by its filename considering language specific
|
# Sort the images by its filename considering language specific
|
||||||
# characters.
|
# characters.
|
||||||
images.sort(cmp=locale_compare,
|
images.sort(cmp=locale_compare,
|
||||||
key=lambda filename: os.path.split(unicode(filename))[1])
|
key=lambda filename: os.path.split(filename)[1])
|
||||||
for imageFile in images:
|
for imageFile in images:
|
||||||
filename = os.path.split(unicode(imageFile))[1]
|
filename = os.path.split(imageFile)[1]
|
||||||
thumb = os.path.join(self.servicePath, filename)
|
thumb = os.path.join(self.servicePath, filename)
|
||||||
if not os.path.exists(unicode(imageFile)):
|
if not os.path.exists(imageFile):
|
||||||
icon = build_icon(u':/general/general_delete.png')
|
icon = build_icon(u':/general/general_delete.png')
|
||||||
else:
|
else:
|
||||||
if validate_thumb(unicode(imageFile), thumb):
|
if validate_thumb(imageFile, thumb):
|
||||||
icon = build_icon(thumb)
|
icon = build_icon(thumb)
|
||||||
else:
|
else:
|
||||||
icon = create_thumb(unicode(imageFile), thumb)
|
icon = create_thumb(imageFile, thumb)
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setIcon(icon)
|
item_name.setIcon(icon)
|
||||||
item_name.setToolTip(imageFile)
|
item_name.setToolTip(imageFile)
|
||||||
|
@ -299,21 +299,21 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
# Sort the media by its filename considering language specific
|
# Sort the media by its filename considering language specific
|
||||||
# characters.
|
# characters.
|
||||||
media.sort(cmp=locale_compare,
|
media.sort(cmp=locale_compare,
|
||||||
key=lambda filename: os.path.split(unicode(filename))[1])
|
key=lambda filename: os.path.split(filename)[1])
|
||||||
for track in media:
|
for track in media:
|
||||||
track_info = QtCore.QFileInfo(track)
|
track_info = QtCore.QFileInfo(track)
|
||||||
if not os.path.exists(track):
|
if not os.path.exists(track):
|
||||||
filename = os.path.split(unicode(track))[1]
|
filename = os.path.split(track)[1]
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setIcon(build_icon(ERROR))
|
item_name.setIcon(build_icon(ERROR))
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||||
elif track_info.isFile():
|
elif track_info.isFile():
|
||||||
filename = os.path.split(unicode(track))[1]
|
filename = os.path.split(track)[1]
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setIcon(build_icon(VIDEO))
|
item_name.setIcon(build_icon(VIDEO))
|
||||||
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
|
||||||
else:
|
else:
|
||||||
filename = os.path.split(unicode(track))[1]
|
filename = os.path.split(track)[1]
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
#TODO: add the appropriate Icon
|
#TODO: add the appropriate Icon
|
||||||
#item_name.setIcon(build_icon(DVD_ICON))
|
#item_name.setIcon(build_icon(DVD_ICON))
|
||||||
|
@ -175,13 +175,13 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
# Sort the presentations by its filename considering language specific
|
# Sort the presentations by its filename considering language specific
|
||||||
# characters.
|
# characters.
|
||||||
files.sort(cmp=locale_compare,
|
files.sort(cmp=locale_compare,
|
||||||
key=lambda filename: os.path.split(unicode(filename))[1])
|
key=lambda filename: os.path.split(filename)[1])
|
||||||
for file in files:
|
for file in files:
|
||||||
if not initialLoad:
|
if not initialLoad:
|
||||||
self.plugin.formParent.incrementProgressBar()
|
self.plugin.formParent.incrementProgressBar()
|
||||||
if currlist.count(file) > 0:
|
if currlist.count(file) > 0:
|
||||||
continue
|
continue
|
||||||
filename = os.path.split(unicode(file))[1]
|
filename = os.path.split(file)[1]
|
||||||
if not os.path.exists(file):
|
if not os.path.exists(file):
|
||||||
item_name = QtGui.QListWidgetItem(filename)
|
item_name = QtGui.QListWidgetItem(filename)
|
||||||
item_name.setIcon(build_icon(ERROR))
|
item_name.setIcon(build_icon(ERROR))
|
||||||
@ -201,7 +201,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
controller_name = self.findControllerByType(filename)
|
controller_name = self.findControllerByType(filename)
|
||||||
if controller_name:
|
if controller_name:
|
||||||
controller = self.controllers[controller_name]
|
controller = self.controllers[controller_name]
|
||||||
doc = controller.add_document(unicode(file))
|
doc = controller.add_document(file)
|
||||||
thumb = os.path.join(doc.get_thumbnail_folder(),
|
thumb = os.path.join(doc.get_thumbnail_folder(),
|
||||||
u'icon.png')
|
u'icon.png')
|
||||||
preview = doc.get_thumbnail_path(1, True)
|
preview = doc.get_thumbnail_path(1, True)
|
||||||
|
Loading…
Reference in New Issue
Block a user