← Back to team overview

openlp-core team mailing list archive

[Bug 599066] Re: Media Manager does not delete images accurately

 

** Changed in: openlp
       Status: Fix Committed => Fix Released

-- 
Media Manager does not delete images accurately
https://bugs.launchpad.net/bugs/599066
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.

Status in OpenLP - Worship Presentation Software: Fix Released

Bug description:
Hello!

onDeleteClick in images/lib/mediaitem does not delete the images accurately. Just try to delete more than one image at one time. It will not work (unless you know what is going wrong). It depends in what sequence you select the images.

The Problem is, that
"ListView.selectedIndexes()" does not sort anything (rather saves everything in the order we pass it on = the sequence we click the images). [1]

If I would do this:

    for item in items:
        log.debug(u'Row: %s' % item.row())

My log file will show something like this:
... Row: 8
... Row: 11
... Row: 1
... Row: 9

Until this point everything is alright, but when we go on with "self.ListView.takeItem(item.row())" we start deleting things (-> the rows start changing (in this case row 11 and row 9 are affected by this, because we deleted row 8)).

To solve this problem we need to sort the array (by the row numbers) or something similar. If I would do this:

    for item in items:
        log.debug(u'Row: %s' % item.row())

My log file should show something like this:
... Row: 11
... Row: 9
... Row: 8
... Row: 1

You can check this by selecting some images in the media manager starting from the bottom. This will work, because "items" is now coincidentally in the right order.


Cheers

[1] http://doc.trolltech.com/4.6/qabstractitemview.html#selectedIndexes







References