Skip to content

Instantly share code, notes, and snippets.

@psifertex
Last active August 29, 2015 14:19
Show Gist options
  • Save psifertex/a06b260e010c54b623bf to your computer and use it in GitHub Desktop.
Save psifertex/a06b260e010c54b623bf to your computer and use it in GitHub Desktop.
diff --git a/binja.py b/binja.py
index b8faf81..78bf1ce 100755
--- a/binja.py
+++ b/binja.py
@@ -264,6 +264,8 @@ class MainWindow(QMainWindow):
self.setCentralWidget(self.splitter)
+ self.setAcceptDrops(True)
+
self.status = QStatusBar(self)
self.status_text = QLabel(self)
self.status_text.setFont(getMonospaceFont())
@@ -342,6 +344,19 @@ class MainWindow(QMainWindow):
def create_tab_from_data(self, data):
self.create_tab(BinaryData(data), "")
+ def dragEnterEvent(self, event):
+ if event.mimeData().hasFormat("text/uri-list"):
+ event.acceptProposedAction()
+
+ def dropEvent(self, event):
+ for i in event.mimeData().urls():
+ if (i.isLocalFile()):
+ QMessageBox.critical(self, "Error", "Dropped file "+i.toLocalFile()+" is not local.")
+ return
+ if not open_file_name(i.toLocalFile()):
+ return
+ event.accept()
+
def new(self):
self.create_tab(BinaryData(), "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment