Stevan Pettit has proposed merging lp:~smpettit/openlp/save_service into 
lp:openlp.

Requested reviews:
  Andreas Preikschat (googol)
  Tim Bentley (trb143)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~smpettit/openlp/save_service/+merge/71117

Bug #802150

Added code to servicemanager to check if a file is missing during a "save 
service".

If a file is missing, the user is notified and given the choice to continue 
saving (without the missing file) or abort the save.

Removed un-needed commented code.

Exit the dialog if user selects "no" to the missing file message

Added "Yes to All" button.  If user selects this button, the missing file 
dialog is not displayed again.  This gives the user the option whether or not  
to see all missing files.
-- 
https://code.launchpad.net/~smpettit/openlp/save_service/+merge/71117
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-08-02 18:17:07 +0000
+++ openlp/core/ui/servicemanager.py	2011-08-10 21:44:37 +0000
@@ -487,6 +487,7 @@
                 item[u'service_item'].get_service_repr()})
             if not item[u'service_item'].uses_file():
                 continue
+            skipMissing = False
             for frame in item[u'service_item'].get_frames():
                 if item[u'service_item'].is_image():
                     path_from = frame[u'path']
@@ -495,25 +496,29 @@
                 # Only write a file once
                 if path_from in write_list:
                     continue
-                file_size = os.path.getsize(path_from)
-                size_limit = 52428800 # 50MiB
-                #if file_size > size_limit:
-                #    # File exeeds size_limit bytes, ask user
-                #    message = unicode(translate('OpenLP.ServiceManager',
-                #        'Do you want to include \n%.1f MB file "%s"\n'
-                #        'into the service file?\nThis may take some time.\n\n'
-                #        'Please note that you need to\ntake care of that file'
-                #        ' yourself,\nif you leave it out.')) % \
-                #        (file_size/1048576, os.path.split(path_from)[1])
-                #    ans = QtGui.QMessageBox.question(self.mainwindow,
-                #        translate('OpenLP.ServiceManager', 'Including Large '
-                #        'File'), message, QtGui.QMessageBox.StandardButtons(
-                #        QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel),
-                #        QtGui.QMessageBox.Ok)
-                #    if ans == QtGui.QMessageBox.Cancel:
-                #        continue
-                write_list.append(path_from)
-                total_size += file_size
+                if not os.path.exists(path_from):
+                    if not skipMissing:
+                        Receiver.send_message(u'cursor_normal')
+                        title = unicode(translate('OpenLP.ServiceManager',
+                            'Service File Missing'))
+                        message = unicode(translate('OpenLP.ServiceManager',
+                            'File missing from service\n\n %s \n\n'
+                            'Continue saving?' % path_from ))
+                        answer = QtGui.QMessageBox.critical(self, title,
+                            message,
+                            QtGui.QMessageBox.StandardButtons(
+                            QtGui.QMessageBox.Yes | QtGui.QMessageBox.No |
+                            QtGui.QMessageBox.YesToAll))
+                        if answer == QtGui.QMessageBox.No:
+                            self.mainwindow.finishedProgressBar()
+                            return False
+                        if answer == QtGui.QMessageBox.YesToAll:
+                            skipMissing = True
+                        Receiver.send_message(u'cursor_busy')
+                else:
+                    file_size = os.path.getsize(path_from)
+                    write_list.append(path_from)
+                    total_size += file_size
         log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' %
             total_size)
         service_content = cPickle.dumps(service)

_______________________________________________
Mailing list: https://launchpad.net/~openlp-core
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to