PyQt4 Drag & Drop - python

Qt4 has support for Drag & Drop actions and I've used them like in the tutorial. Now I want to be able to drag external elements (files) into the GUI form and perform actions based on that (like get the full path and copy it somewhere).
I'm not sure whether this is a limitation like something Qt cannot do. Does someone know how you can do that with Qt? Simply drag a file into a GUI...
Thanks,
Marius

Most file managers provide drag-and-drop data using the text/uri-list target.
Regarding the linked tutorial, first you need to set the widget to accept dropping text/uri-list data, then you can retrieve the URIs by calling event.mimeData().urls(). The return value is a list of QUrl objects.

Related

QCompleter show current suggestion as placeholder in lineEdit

I want to create a suggestions system for a console I'm embedding into my interface, but there's one feature I want to add that I don't see how to. My inspiration is how minecraft consoles work:
As you can see, the autocomplete tries to fill up the rest of the lineEdit based on what the first suggestion in the input is. I assume that this behaviour could be replicated using the placeholder text system we have now, but I don't really see how to make the placeholder show when there's text written. Any ideas?

Is there a PyQt5 widget for drop-down "file explorer" menu?

I am working on a small project using PyQt5 (Python 3) and I want a widget where a user can select/modify a file, somewhat akin to the left-hand side of file explorer on Windows:
This cannot be done with QFileDialog as I want to display files that are not on the user's drive.
I have tried writing my own, however I am a beginner and I lack the skills to do it correctly (hence the reason why I'm trying to learn). I can provide the code if that would be useful.
Is there such a thing built in to pyqt? Has anyone created one before, with source code available?
Thanks in advance.
EDIT: More specifically I don't want a way to access remote files, just a widget that displays entries (along with icons, preferably) and subentries in a sort of drop-down menu, like the section of file explorer mentioned above. It doesn't necessarily have to be to do with files, consider it a drop-down menu if that helps.
I know this is old but for anyone looking for an answer it's the QTreeView widget.

Is it possible to create elements using Bokeh widget DIV that respond to bokeh server commands?

I've been using Bokeh's datatable, but there are a few things I'd like to do that I don't know how to accomplish using the DataTable class. For example, I don't think it's possible add icons (or any images) to different rows, or setting the table to single selection only. So, I've been thinking about implementing just a HTML table, and writing it with the DIV widget.
However, I'd still like to add interactive features to the table, like buttons, or the icons mentioned above. Then, when an event is generated (e.g. onClick), that event is captured by the Bokeh server, and I can write the handlers in Python to do things such as modifying the data in ColumnDataSource, for example.
Is this possible? Or is there a better way to accomplish this?
Thanks!
I think the approprate way to achieve what you want is to create a custom widget:
Extending Bokeh Documentation
Custom Widget Example
I do not paste here the complete example because it is too long.

Sidebar Object on Sublime Plugin

I want to build a plugin in order to affect the sidebar. Mainly visual stuff at first.
But I can't find any documentation about it.
Is it possible, as we can obtain view() and window() in the plugin, to have something like sidebar(), and be able to treat all the nodes on the Folders sections (for individual files) and interact with them?
Thanks!
There is no sidebar API in Sublime currently, so unfortunately what you are trying to do isn't possible at present.

Best starting point for multiple selection in file/folder tree structure wxPython

I'm looking to create a window with two panels, with a collapsible folder browser in the left panel and a list of files in the right panel that are contained in the selected folder on the left (similar to nautilus or an older windows explorer). Both the folders on the left and files on the right need a check box beside them so users can make a selection of a mix of folders and files across their whole file system.
I've had a look around and found similar-ish built-in bits in wx like GenericDirCtrl but before I get started I wanted to ask if anyone had come across something like this before that's available or if there was a better starting point that GenericDirCtrl?
I've got it all working now. I used CustomTreeCtrl for the tree and a list control that has multi inheritance from ListCtrl and CheckListCtrlMixin for the report like list with check boxes.
I can share the code if anyone's interested
There isn't a built-in file explorer. The GenericDirCtrl or one of the other tree controls is a good place to start for the tree. Then use a ListCtrl (or ObjectListView) for the other panel. Something like that should give you the functionality you need.

Categories

Resources