Fix large Service Files

This commit is contained in:
Tim Bentley 2011-04-29 09:45:36 +01:00
parent f83d52621a
commit 7908ac4f67
4 changed files with 23 additions and 14 deletions

View File

@ -554,4 +554,4 @@ class MediaManagerItem(QtGui.QWidget):
item_id = remoteItem
else:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
return item_id
return item_id

View File

@ -591,7 +591,7 @@ class ServiceManager(QtGui.QWidget):
serviceItem.renderer = self.mainwindow.renderer
serviceItem.set_from_service(item, self.servicePath)
self.validateItem(serviceItem)
self.addServiceItem(serviceItem)
self.addServiceItem(serviceItem, repaint=False)
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' %
serviceItem.name.lower(), serviceItem)
@ -601,8 +601,6 @@ class ServiceManager(QtGui.QWidget):
self.setModified(False)
QtCore.QSettings().setValue(
'service/last file', QtCore.QVariant(fileName))
self.mainwindow.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
else:
critical_error_message_box(
message=translate('OpenLP.ServiceManager',
@ -633,6 +631,9 @@ class ServiceManager(QtGui.QWidget):
fileTo.close()
if zip:
zip.close()
self.mainwindow.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
self.repaintServiceList(-1, -1)
def loadLastFile(self):
"""
@ -1066,7 +1067,8 @@ class ServiceManager(QtGui.QWidget):
newItem)
self.setModified()
def addServiceItem(self, item, rebuild=False, expand=None, replace=False):
def addServiceItem(self, item, rebuild=False, expand=None, replace=False,
repaint=True):
"""
Add a Service item to the list
@ -1099,7 +1101,8 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems.append({u'service_item': item,
u'order': len(self.serviceItems) + 1,
u'expanded': expand})
self.repaintServiceList(len(self.serviceItems) - 1, -1)
if repaint:
self.repaintServiceList(len(self.serviceItems) - 1, -1)
else:
self.serviceItems.insert(self.dropPosition,
{u'service_item': item, u'order': self.dropPosition,

View File

@ -77,7 +77,7 @@ class ImageMediaItem(MediaManagerItem):
u'thumbnails')
check_directory_exists(self.servicePath)
self.loadList(SettingsManager.load_list(
self.settingsSection, self.settingsSection))
self.settingsSection, self.settingsSection), True)
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
@ -107,11 +107,13 @@ class ImageMediaItem(MediaManagerItem):
SettingsManager.set_list(self.settingsSection,
self.settingsSection, self.getFileList())
def loadList(self, list):
def loadList(self, list, initialLoad=False):
Receiver.send_message(u'cursor_busy')
self.parent.formparent.displayProgressBar(len(list))
if not initialLoad:
self.parent.formparent.displayProgressBar(len(list))
for imageFile in list:
self.parent.formparent.incrementProgressBar()
if not initialLoad:
self.parent.formparent.incrementProgressBar()
filename = os.path.split(unicode(imageFile))[1]
thumb = os.path.join(self.servicePath, filename)
if os.path.exists(thumb):
@ -126,7 +128,8 @@ class ImageMediaItem(MediaManagerItem):
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
self.listView.addItem(item_name)
Receiver.send_message(u'cursor_normal')
self.parent.formparent.finishedProgressBar()
if not initialLoad:
self.parent.formparent.finishedProgressBar()
def generateSlideData(self, service_item, item=None, xmlVersion=False):
items = self.listView.selectedIndexes()

View File

@ -159,9 +159,11 @@ class PresentationMediaItem(MediaManagerItem):
for file in currlist:
titles.append(os.path.split(file)[1])
Receiver.send_message(u'cursor_busy')
self.parent.formparent.displayProgressBar(len(list))
if not initialLoad:
self.parent.formparent.displayProgressBar(len(list))
for file in list:
self.parent.formparent.incrementProgressBar()
if not initialLoad:
self.parent.formparent.incrementProgressBar()
if currlist.count(file) > 0:
continue
filename = os.path.split(unicode(file))[1]
@ -202,7 +204,8 @@ class PresentationMediaItem(MediaManagerItem):
item_name.setIcon(icon)
self.listView.addItem(item_name)
Receiver.send_message(u'cursor_normal')
self.parent.formparent.finishedProgressBar()
if not initialLoad:
self.parent.formparent.finishedProgressBar()
def onDeleteClick(self):
"""