mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Fixed a py3k-induced bug when drag & dropping directories in the directories panel.
This commit is contained in:
parent
f67f14a78d
commit
01db7c4948
@ -96,13 +96,13 @@ class DirectoriesModel(TreeModel):
|
||||
return None
|
||||
|
||||
def dropMimeData(self, mimeData, action, row, column, parentIndex):
|
||||
# the data in mimeData is urlencoded **in utf-8**!!! which means that urllib.unquote has
|
||||
# to be called on the utf-8 encoded string, and *only then*, decoded to unicode.
|
||||
# the data in mimeData is urlencoded **in utf-8**!!! What we do is to decode, the mime data
|
||||
# with 'ascii', which works since it's urlencoded. Then, we pass that to urllib.
|
||||
if not mimeData.hasFormat('text/uri-list'):
|
||||
return False
|
||||
data = str(mimeData.data('text/uri-list'))
|
||||
data = bytes(mimeData.data('text/uri-list')).decode('ascii')
|
||||
unquoted = urllib.parse.unquote(data)
|
||||
urls = str(unquoted, 'utf-8').split('\r\n')
|
||||
urls = unquoted.split('\r\n')
|
||||
paths = [str(QUrl(url).toLocalFile()) for url in urls if url]
|
||||
for path in paths:
|
||||
self.model.add_directory(path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user