Vector35 / deprecated-binaryninja-python

Deprecated Binary Ninja prototype written in Python
GNU General Public License v2.0
518 stars 128 forks source link

Drag & Drop files to open #3

Closed ColdHeat closed 9 years ago

ColdHeat commented 9 years ago

Dragging files onto different windows/tabs to open them would be a very welcome addition to Binja.

psifertex commented 9 years ago

Yeah, that's been on the desired feature list for a while. My workaround in the meantime is to ⌘-o / ⌃-o and then just drop onto the file picker. It's an extra keystroke, but not too much work.

psifertex commented 9 years ago

So I looked into doing this (AKA, cribbed off of @D0ntPanic and the C++ implementation) and it turns out there's a bug in QT 4.8 that blocks us on OS X: https://bugreports.qt.io/browse/QTBUG-40449

Unfortunately, the version of pyside we're using isn't compatible with QT 5.4

I guess we could add OS detection and disable the feature on OS X, but that's kinda annoying. If anyone wants to look into this more, here's a start:

https://gist.github.com/psifertex/a06b260e010c54b623bf

(note that open_file_name is unimplemented but should be obvious from def open what it should be)

ColdHeat commented 9 years ago

How do you feel about requiring PyObjC on OSX?

Despite the bug you can directly call into Foundation to get the right path. I'm trying to get the right call through ctypes but it's not fun.

psifertex commented 9 years ago

Yeah, I looked in to that, but It's a pretty big dependency. brew install pyobjc took about 20 minutes to build. If you can do it through ctypes I'd /much/ prefer that.

ColdHeat commented 9 years ago

I'll keep working on it although instead of building you can do something like:

import sys
sys.path.append('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC')
import Foundation
psifertex commented 9 years ago

Hmm, it's in a default install? That might be doable.

psifertex commented 9 years ago

Thanks for pointing out it was already installed, Tested as working on Windows and OS X, if someone can check linux that'd be helpful.

ColdHeat commented 9 years ago

Works on Linux :+1: