started fixing deletion bug in media manager (custom still to be done)

This commit is contained in:
andreas 2010-06-28 20:20:05 +02:00
parent 5de4832ae7
commit eccd2999ee
3 changed files with 26 additions and 24 deletions

View File

@ -119,13 +119,10 @@ class ImageMediaItem(MediaManagerItem):
"""
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
'You must select an item to delete.')):
items = self.ListView.selectedIndexes()
row_list = []
for item in items:
row_list.append(item.row())
row_list = [item.row() for item in self.ListView.selectedIndexes()]
row_list.sort(reverse=True)
for item in row_list:
text = self.ListView.item(item)
for row in row_list:
text = self.ListView.item(row)
if text:
try:
os.remove(os.path.join(self.servicePath,
@ -133,7 +130,7 @@ class ImageMediaItem(MediaManagerItem):
except OSError:
#if not present do not worry
pass
self.ListView.takeItem(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())

View File

@ -143,8 +143,9 @@ class MediaMediaItem(MediaManagerItem):
"""
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
row_list = [item.row() for item in self.ListView.selectedIndexes()]
row_list.sort(reverse=True)
for row in row_list:
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())

View File

@ -180,18 +180,22 @@ class PresentationMediaItem(MediaManagerItem):
if check_item_selected(self.ListView,
translate('PresentationPlugin.MediaItem',
'You must select an item to delete.')):
item = self.ListView.currentItem()
row = self.ListView.row(item)
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
filepath = unicode(item.data(QtCore.Qt.UserRole).toString())
items = self.ListView.selectedIndexes()
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
for item in items:
filepath = unicode(item.data(
QtCore.Qt.UserRole).toString())
#not sure of this has errors
#John please can you look at .
for cidx in self.controllers:
doc = self.controllers[cidx].add_doc(filepath)
doc.presentation_deleted()
doc.close_presentation()
for row in row_list:
self.ListView.takeItem(row)
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
def generateSlideData(self, service_item, item=None):
items = self.ListView.selectedIndexes()