Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop file on support #74

Closed
gbaman opened this issue Feb 6, 2016 · 8 comments
Closed

Drop file on support #74

gbaman opened this issue Feb 6, 2016 · 8 comments

Comments

@gbaman
Copy link

gbaman commented Feb 6, 2016

It would be great to be able to simply drop a .py file onto the application in the menu bar. Although not a majorly important feature, it would be great to see it there. Have had a few times so far where I have gone to drop a script on it and then remembered I can't just yet.

@NDevox
Copy link
Contributor

NDevox commented Feb 9, 2016

Really nice idea actually.

Looks like there is a dropped event in PyQt. So we could implement something like this: http://stackoverflow.com/questions/4151637/pyqt4-drag-and-drop-files-into-qlistwidget

Where we take the file path, check it exists and then open a new tab with the file on it.

@askvictor
Copy link
Contributor

For bonus points: implement drag-and-drop for the file pane (i.e. from the OS file manager to the project folder or the device)

@ZanderBrown
Copy link
Contributor

Played a bit and it seems quite doable, just got to get my head around how the relationship between EditorPane & Editor. EditorPane is the obvious place for receiving drop events but Editor is responsible for loading files, unfortunately, EditorPane doesn't seem to have a reference to it's Editor

More to play with!

@ntoll
Copy link
Member

ntoll commented Mar 13, 2018

OK... there's a way in Qt to register event handlers with events (signals) emitted by a widget. The EditorPane will emit a signal along with the appropriate context when a file is dropped onto it. However, from the Editor (which has a reference to the EditorPane object), you'll be able to register a function in the Editor to handle the event from the pane. In this way the UI logic (in the pane) is separated from the logic in the editor (handling the drop event).

Does this make sense?

@ZanderBrown
Copy link
Contributor

That makes sense

@ZanderBrown
Copy link
Contributor

One was a pain to write but I weirdly enjoyed writing the tests for this

@ntoll
Copy link
Member

ntoll commented Mar 23, 2018

WRT Travis... pyflakes is complaining that an import is unused... I'll fix this up as part of the review.

@ZanderBrown heh... writing tests can be plenty of fun. ;-)

@ntoll
Copy link
Member

ntoll commented Mar 23, 2018

Better late than never... many thanks to @ZanderBrown for the work! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants