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,18 +484,23 @@ 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):
if not skipMissing:
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
title = unicode(translate('OpenLP.ServiceManager', title = unicode(translate('OpenLP.ServiceManager',
'Service File Missing')) 'Service File Missing'))
message = unicode(translate('OpenLP.ServiceManager', message = unicode(translate('OpenLP.ServiceManager',
'File missing from service\n\n %s \n\n' 'File missing from service\n\n %s \n\n'
'Continue saving?' % path_from )) 'Continue saving?' % path_from ))
answer = QtGui.QMessageBox.critical(self, title, message, answer = QtGui.QMessageBox.critical(self, title,
message,
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No |
QtGui.QMessageBox.YesToAll))
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
self.mainwindow.finishedProgressBar() self.mainwindow.finishedProgressBar()
return False return False
if answer == QtGui.QMessageBox.YesToAll:
skipMissing = True
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
else: else:
file_size = os.path.getsize(path_from) file_size = os.path.getsize(path_from)