The update does not solve my problem. I still can’t sort by column. Are you able to sort by the column?
You added some code for images, but I am not sure how this relates to actually solving my problem. I was able to install the Python Imaging Library (PIL) here http://www.pythonware.com/products/pil/ and import it like so
from PIL import Image
but I am not sure what module
import images
refers to.
Since this thread is getting long I just wanted to confirm the problem is not resolved and I would like to have newly added entries to a ListCtrl be sortable. I’m attaching a copy of the current code I have and would really appreciate anyone’s help.
As I had mentioned it is not solved until "self.itemDataMap" directory is updated when you drop a file.
I still can't sort by column. Are you able to sort by the column?
If you click on the column headers BEFORE dropping the first file you can now see that the up/down arrows show to indicate sort order.
If you click AFTER you drop a file you will get an exception as "self.itemDatamap" is still empty and does not contain the data of the dropped item.
You added some code for images, but I am not sure how this relates to actually solving my problem.
Don't you want an indication what the sort order is?
I also moved the "columnSorterMixin" to your FileWindow class and it gets initialized - I did that based on what I saw in the wxPython demo for the listctrl.
I would just do a compare of my version against yours then you see all changes.
I would create a global ordered dict to try to solve all disputes and changes when run across.
You would have to utilize the global Keyword and also keep track of what you want to be first/last and also a py27 OrderedDict would be in order for this matter.
ListCtrls and TreeCtrls can be a bit tricky for this depending on what the desired end affect will be upon dropping the target.
The wxPyWiki has a bunch of examples(maybe older(code)) for List/Tree Ctrl specific stuff and it also has Drap and Drop Stuff, which is probably the problem you want to customize anyway…
Drag and Drop can be tricky. First you need to know (everything Type) that was dropped.
Ex.
for DropTarget in dir(wx):
if DropTarget.startswith(‘DT_’):
print('DropTarget = ', DropTarget)
Then proceed thru a list of options of types as to which need processed, which then are sent to specific functions dealing with each type.
···
On Thursday, October 24, 2013 4:07:56 AM UTC-5, werner wrote:
On 24/10/2013 10:51, RedHotChiliPepper wrote:
Hi Werner -
The update does not solve my problem.
As I had mentioned it is not solved until “self.itemDataMap” directory
is updated when you drop a file.
I still can’t sort by column. Are you able to sort by the column?
If you click on the column headers BEFORE dropping the first file you
can now see that the up/down arrows show to indicate sort order.
If you click AFTER you drop a file you will get an exception as
“self.itemDatamap” is still empty and does not contain the data of the
dropped item.
You added some code for images, but I am not sure how this relates to
actually solving my problem.
Don’t you want an indication what the sort order is?
I also moved the “columnSorterMixin” to your FileWindow class and it
gets initialized - I did that based on what I saw in the wxPython demo
for the listctrl.
I would just do a compare of my version against yours then you see all
changes.
Werner - thanks so much! This seems to be working great. Thanks for clarifying I needed images.py from the wxpython demo, I thought I needed to install the Python Imaging Library.
-s
···
On Thursday, October 24, 2013 8:53:00 AM UTC-4, werner wrote:
Hi,
Attached is now a working version (with 2.9.4 or 3.0 Phoenix for me).
I moved the drop handler to FileWindow class as it made things easier.
You still need to get ‘images.py’ from the wxPython or use another
source for the ‘up/down’ images.