@@ -208,6 +208,8 @@ def keyPressEvent(self, e):
208208
209209class FileDropListView (QListView ):
210210
211+ ValidExtenstions = ["xtf" , "XTF" , "itf" , "ITF" , "ili" ]
212+
211213 files_dropped = pyqtSignal (list )
212214
213215 def __init__ (self , parent = None ):
@@ -216,14 +218,20 @@ def __init__(self, parent=None):
216218 self .setDragDropMode (QListView .InternalMove )
217219
218220 def dragEnterEvent (self , event ):
219- event .acceptProposedAction ()
221+ for url in event .mimeData ().urls ():
222+ if (
223+ pathlib .Path (url .toLocalFile ()).suffix [1 :]
224+ in FileDropListView .ValidExtenstions
225+ ):
226+ event .acceptProposedAction ()
227+ break
220228
221229 def dropEvent (self , event ):
222230 dropped_files = [
223231 url .toLocalFile ()
224232 for url in event .mimeData ().urls ()
225233 if pathlib .Path (url .toLocalFile ()).suffix [1 :]
226- in [ "xtf" , "XTF" , "itf" , "ITF" , "ili" ]
234+ in FileDropListView . ValidExtenstions
227235 ]
228236 self .files_dropped .emit (dropped_files )
229237 event .acceptProposedAction ()
0 commit comments