mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Fix #897
This commit is contained in:
parent
f9085386a6
commit
2c9437bef4
@ -6,8 +6,6 @@
|
|||||||
# which should be included with this package. The terms are also available at
|
# which should be included with this package. The terms are also available at
|
||||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
import urllib.parse
|
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex, QItemSelection
|
from PyQt5.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex, QItemSelection
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QComboBox,
|
QComboBox,
|
||||||
@ -105,13 +103,11 @@ class DirectoriesModel(TreeModel):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def dropMimeData(self, mime_data, action, row, column, parent_index):
|
def dropMimeData(self, mime_data, action, row, column, parent_index):
|
||||||
# the data in mimeData is urlencoded **in utf-8**!!! What we do is to decode, the mime data
|
# the data in mimeData is urlencoded **in utf-8**
|
||||||
# with 'ascii', which works since it's urlencoded. Then, we pass that to urllib.
|
|
||||||
if not mime_data.hasFormat("text/uri-list"):
|
if not mime_data.hasFormat("text/uri-list"):
|
||||||
return False
|
return False
|
||||||
data = bytes(mime_data.data("text/uri-list")).decode("ascii")
|
data = bytes(mime_data.data("text/uri-list")).decode("ascii")
|
||||||
unquoted = urllib.parse.unquote(data)
|
urls = data.split("\r\n")
|
||||||
urls = unquoted.split("\r\n")
|
|
||||||
paths = [QUrl(url).toLocalFile() for url in urls if url]
|
paths = [QUrl(url).toLocalFile() for url in urls if url]
|
||||||
for path in paths:
|
for path in paths:
|
||||||
self.model.add_directory(path)
|
self.model.add_directory(path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user