forked from openlp/openlp
started fixing deletion bug in media manager (custom still to be done)
This commit is contained in:
parent
5de4832ae7
commit
eccd2999ee
@ -119,13 +119,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
if check_item_selected(self.ListView, translate('ImagePlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
items = self.ListView.selectedIndexes()
|
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||||
row_list = []
|
|
||||||
for item in items:
|
|
||||||
row_list.append(item.row())
|
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
for item in row_list:
|
for row in row_list:
|
||||||
text = self.ListView.item(item)
|
text = self.ListView.item(row)
|
||||||
if text:
|
if text:
|
||||||
try:
|
try:
|
||||||
os.remove(os.path.join(self.servicePath,
|
os.remove(os.path.join(self.servicePath,
|
||||||
@ -133,7 +130,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
except OSError:
|
except OSError:
|
||||||
#if not present do not worry
|
#if not present do not worry
|
||||||
pass
|
pass
|
||||||
self.ListView.takeItem(item)
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
|
|
||||||
|
@ -143,8 +143,9 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
if check_item_selected(self.ListView, translate('MediaPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
row_list = [item.row() for item in self.ListView.selectedIndexes()]
|
||||||
row = self.ListView.row(item)
|
row_list.sort(reverse=True)
|
||||||
|
for row in row_list:
|
||||||
self.ListView.takeItem(row)
|
self.ListView.takeItem(row)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
SettingsManager.set_list(self.settingsSection,
|
||||||
self.settingsSection, self.getFileList())
|
self.settingsSection, self.getFileList())
|
||||||
|
@ -180,18 +180,22 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if check_item_selected(self.ListView,
|
if check_item_selected(self.ListView,
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
item = self.ListView.currentItem()
|
items = self.ListView.selectedIndexes()
|
||||||
row = self.ListView.row(item)
|
row_list = [item.row() for item in items]
|
||||||
self.ListView.takeItem(row)
|
row_list.sort(reverse=True)
|
||||||
SettingsManager.set_list(self.settingsSection,
|
for item in items:
|
||||||
self.settingsSection, self.getFileList())
|
filepath = unicode(item.data(
|
||||||
filepath = unicode(item.data(QtCore.Qt.UserRole).toString())
|
QtCore.Qt.UserRole).toString())
|
||||||
#not sure of this has errors
|
#not sure of this has errors
|
||||||
#John please can you look at .
|
#John please can you look at .
|
||||||
for cidx in self.controllers:
|
for cidx in self.controllers:
|
||||||
doc = self.controllers[cidx].add_doc(filepath)
|
doc = self.controllers[cidx].add_doc(filepath)
|
||||||
doc.presentation_deleted()
|
doc.presentation_deleted()
|
||||||
doc.close_presentation()
|
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):
|
def generateSlideData(self, service_item, item=None):
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
|
Loading…
Reference in New Issue
Block a user