Added code to skip-all missing files during service save

This commit is contained in:
Stevan Pettit 2011-08-10 17:29:44 -04:00
parent a66f7f3365
commit c0978d8e22

View File

@ -474,6 +474,7 @@ class ServiceManager(QtGui.QWidget):
item[u'service_item'].get_service_repr()}) item[u'service_item'].get_service_repr()})
if not item[u'service_item'].uses_file(): if not item[u'service_item'].uses_file():
continue continue
skipMissing = False
for frame in item[u'service_item'].get_frames(): for frame in item[u'service_item'].get_frames():
if item[u'service_item'].is_image(): if item[u'service_item'].is_image():
path_from = frame[u'path'] path_from = frame[u'path']
@ -483,19 +484,24 @@ class ServiceManager(QtGui.QWidget):
if path_from in write_list: if path_from in write_list:
continue continue
if not os.path.exists(path_from): if not os.path.exists(path_from):
Receiver.send_message(u'cursor_normal') if not skipMissing:
title = unicode(translate('OpenLP.ServiceManager', Receiver.send_message(u'cursor_normal')
'Service File Missing')) title = unicode(translate('OpenLP.ServiceManager',
message = unicode(translate('OpenLP.ServiceManager', 'Service File Missing'))
'File missing from service\n\n %s \n\n' message = unicode(translate('OpenLP.ServiceManager',
'Continue saving?' % path_from )) 'File missing from service\n\n %s \n\n'
answer = QtGui.QMessageBox.critical(self, title, message, 'Continue saving?' % path_from ))
QtGui.QMessageBox.StandardButtons( answer = QtGui.QMessageBox.critical(self, title,
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) message,
if answer == QtGui.QMessageBox.No: QtGui.QMessageBox.StandardButtons(
self.mainwindow.finishedProgressBar() QtGui.QMessageBox.Yes | QtGui.QMessageBox.No |
return False QtGui.QMessageBox.YesToAll))
Receiver.send_message(u'cursor_busy') if answer == QtGui.QMessageBox.No:
self.mainwindow.finishedProgressBar()
return False
if answer == QtGui.QMessageBox.YesToAll:
skipMissing = True
Receiver.send_message(u'cursor_busy')
else: else:
file_size = os.path.getsize(path_from) file_size = os.path.getsize(path_from)
write_list.append(path_from) write_list.append(path_from)