Skip to content

Commit

Permalink
FIXUP: factor out loop-invariant func in dropEvent()
Browse files Browse the repository at this point in the history
  • Loading branch information
deeplow committed Apr 8, 2024
1 parent 1489fdd commit c7a8442
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,11 @@ def dragLeaveEvent(self, ev: QtGui.QDragLeaveEvent) -> None:
def dropEvent(self, ev: QtGui.QDropEvent) -> None:
ev.setDropAction(QtCore.Qt.CopyAction)
documents = []
supported_exts = get_supported_extensions()
for url_path in ev.mimeData().urls():
doc_path = url_path.toLocalFile()
doc_ext = os.path.splitext(doc_path)[1]
if doc_ext in get_supported_extensions():
if doc_ext in supported_exts:
documents += [Document(doc_path)]

# Ignore anything dropped that's not a file (e.g. text)
Expand Down

0 comments on commit c7a8442

Please sign in to comment.