def dropEvent(self, event): urls = event.mimeData().urls() paths = [qurl_to_path(url) for url in urls] if any(path.endswith('.glu') for path in paths): if len(paths) != 1: raise Exception("When dragging and dropping files onto glue, " "only a single .glu session file can be " "dropped at a time, or multiple datasets, but " "not a mix of both.") else: self.restore_session_and_close(paths[0]) else: self.load_data(paths) event.accept()