Multiple or multi purpose drag and drop DropTargets

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple or multi purpose drag and drop DropTargets

Paul Wiseman

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Mike Stover
Might I suggest combining the last example from Mike Driscoll's blog post with: http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list
I don't have access to my dev computer at the moment to test any sample code at the moment but will definitely work on something to post here when I have the chance.

On Thursday, March 13, 2014 7:25:07 AM UTC-4, Paul wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (<a href="http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;">http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Mike Stover
Managed to create a small example combining Mike Driscoll's ObjectListView drag'ndrop example with the example listed in the link I provided above. I have 

On Thursday, March 13, 2014 10:07:29 AM UTC-4, Mike Stover wrote:
Might I suggest combining the last example from Mike Driscoll's blog post with: <a href="http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;">http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list
I don't have access to my dev computer at the moment to test any sample code at the moment but will definitely work on something to post here when I have the chance.

On Thursday, March 13, 2014 7:25:07 AM UTC-4, Paul wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (<a href="http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;">http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

filedrop.py (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Rufus V. Smith
In reply to this post by Paul Wiseman
On 3/13/2014 7:25 AM, Paul Wiseman wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
You can create a  wx.DataObjectComposite as shown here:

http://wiki.wxpython.org/DragAndDrop

I did it when I created a "converter" that could accept dragged text or filenames as input.
Works fine.


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Metallicow-2
In reply to this post by Mike Stover


On Thursday, March 13, 2014 10:11:54 AM UTC-5, Mike Stover wrote:
Managed to create a small example combining Mike Driscoll's ObjectListView drag'ndrop example with the example listed in the link I provided above. I have 

On Thursday, March 13, 2014 10:07:29 AM UTC-4, Mike Stover wrote:
Might I suggest combining the last example from Mike Driscoll's blog post with: <a href="http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;">http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list
I don't have access to my dev computer at the moment to test any sample code at the moment but will definitely work on something to post here when I have the chance.

On Thursday, March 13, 2014 7:25:07 AM UTC-4, Paul wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (<a href="http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;">http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?


Note that OLV is MSWindows only, so if you are looking for cross platform the attached sample you whipped up could be modified to a regular ListCtrl or VirtualList, etc.
I have a collection of oddball dragdrop target classes I use for my SourceCoder, one of which accepts just about any file type, sorts them all out into catagories options in a checklistbox setup like a rearrangeCtrl from the newer wxVersions, and also uses it's own class to allow adding to the lists if more files are dropped on it while it is still open and supports drag rearranging along with button options.
So basically in a nutshell, what you need to do is parse the dropped stuff for the drop target catagories you need to handle and send each type to whatever function you want to handle them in.
Other than basic Text and File Drop targets, you pretty much have to write all the custom glue code yourself. The wiki has some different examples floating around for various widgets that are easily modded for your various purposes.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Mike Driscoll


On Friday, March 14, 2014 6:45:59 PM UTC-5, Metallicow wrote:




Note that OLV is MSWindows only, so if you are looking for cross platform the attached sample you whipped up could be modified to a regular ListCtrl or VirtualList, etc.


OLV is not MS Windows only. It works fine for me on Linux. It's just a wrapper on top of the wx.ListCtrl, so it should work on all platforms. I do not have a Mac, so I can't test there.

- Mike

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Mike Stover
Can definitely confirm that it works on Mac, have a media library app that uses OLV to display a list of various media files on my Linux server, and tested it on Mac OSX 10.5.8 recently. The app was a little buggy, but that was more due to my coding than anything.

On Monday, March 17, 2014 9:35:53 AM UTC-4, Mike Driscoll wrote:


On Friday, March 14, 2014 6:45:59 PM UTC-5, Metallicow wrote:




Note that OLV is MSWindows only, so if you are looking for cross platform the attached sample you whipped up could be modified to a regular ListCtrl or VirtualList, etc.


OLV is not MS Windows only. It works fine for me on Linux. It's just a wrapper on top of the wx.ListCtrl, so it should work on all platforms. I do not have a Mac, so I can't test there.

- Mike

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Metallicow-2
In reply to this post by Mike Driscoll


On Monday, March 17, 2014 8:35:53 AM UTC-5, Mike Driscoll wrote:


On Friday, March 14, 2014 6:45:59 PM UTC-5, Metallicow wrote:




Note that OLV is MSWindows only, so if you are looking for cross platform the attached sample you whipped up could be modified to a regular ListCtrl or VirtualList, etc.


OLV is not MS Windows only. It works fine for me on Linux. It's just a wrapper on top of the wx.ListCtrl, so it should work on all platforms. I do not have a Mac, so I can't test there.

- Mike

Hmmm it isn't?, Ok, I guess I'll have to look into that again. I must have been mistaken. I recall when I tested it initially on linux, that there was some issues or wasn't working as I expected. Maybe I had introduced a typo or something in my code it didn't like...
I guess I should have tested the included demos also. Tho I wouldn't recall the version no. Just checked and I see the site version is this Version 2.7.0 (2014/02/26) which is recently updated so I'll try again fiddling with that.
Whatever version I was using was definitely older than that at the time. Maybe it was a un-bugfix version I happened to get my hands on.
Nice to know it works on mac also. Thanks.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Paul Wiseman
In reply to this post by Mike Stover



On 13 March 2014 16:11, Mike Stover <[hidden email]> wrote:
Managed to create a small example combining Mike Driscoll's ObjectListView drag'ndrop example with the example listed in the link I provided above. I have 


Awesome :) Was able to get it working using this example. Many Thanks!!
 

On Thursday, March 13, 2014 10:07:29 AM UTC-4, Mike Stover wrote:
Might I suggest combining the last example from Mike Driscoll's blog post with: http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list
I don't have access to my dev computer at the moment to test any sample code at the moment but will definitely work on something to post here when I have the chance.

On Thursday, March 13, 2014 7:25:07 AM UTC-4, Paul wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple or multi purpose drag and drop DropTargets

Mike Stover
Your welcome. Glad to have helped.

On Thursday, March 20, 2014 6:35:12 AM UTC-4, Paul wrote:



On 13 March 2014 16:11, Mike Stover <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="vrJExdXd6icJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">hakug...@...> wrote:
Managed to create a small example combining Mike Driscoll's ObjectListView drag'ndrop example with the example listed in the link I provided above. I have 


Awesome :) Was able to get it working using this example. Many Thanks!!
 

On Thursday, March 13, 2014 10:07:29 AM UTC-4, Mike Stover wrote:
Might I suggest combining the last example from Mike Driscoll's blog post with: <a href="http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwiki.wxpython.org%2FListControls%23Drag_and_Drop_with_a_striped_drag_list\46sa\75D\46sntz\0751\46usg\75AFQjCNFheLS_VVeolqP24mQYwFSqkusv4Q';return true;">http://wiki.wxpython.org/ListControls#Drag_and_Drop_with_a_striped_drag_list
I don't have access to my dev computer at the moment to test any sample code at the moment but will definitely work on something to post here when I have the chance.

On Thursday, March 13, 2014 7:25:07 AM UTC-4, Paul wrote:

I've successfully in the past created apps that have a wx.FileDropTarget that accepts files through drag and drop, and custom drag and drop targets from wx.PyDropTarget`.

I'm trying to create an app that has a single control (wx.ListCtrl) that accepts files to be dropped from the file system, and also allows a custom drag and drop so the user is able to reorder the list, after dropping files in.

There's examples of different uses of drag and drop here (<a href="http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.blog.pythonlibrary.org%2F2012%2F06%2F20%2Fwxpython-introduction-to-drag-and-drop%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzBc1kLPM3PdD1S9JMs_IauIkoIw';return true;">http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-and-drop/), all the examples work well individually however I've been unsuccessful at trying to get any working together.

As far as I'm aware you can only set one drop target on a control, I've tried using multiple inheritance to make a class that inherits from both wx.PyDropTarget and wx.FileDropTarget but this doesn't seem to work (neither type of drop works).

Does any know if this is possible?

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="vrJExdXd6icJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">wxpython-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.