Giter Site home page Giter Site logo

Drop file on support about mu HOT 8 CLOSED

mu-editor avatar mu-editor commented on May 22, 2024
Drop file on support

from mu.

Comments (8)

NDevox avatar NDevox commented on May 22, 2024

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.

from mu.

askvictor avatar askvictor commented on May 22, 2024

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)

from mu.

ZanderBrown avatar ZanderBrown commented on May 22, 2024

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!

from mu.

ntoll avatar ntoll commented on May 22, 2024

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?

from mu.

ZanderBrown avatar ZanderBrown commented on May 22, 2024

That makes sense

from mu.

ZanderBrown avatar ZanderBrown commented on May 22, 2024

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

from mu.

ntoll avatar ntoll commented on May 22, 2024

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. ;-)

from mu.

ntoll avatar ntoll commented on May 22, 2024

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

from mu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.