Error dialog buttons don't behave properly when flushing metadata

Bug #384974 reported by Stani
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani

Bug Description

One more thing. After the error the execution is aborted even if I select 'Skip to Next image' and there are hundreds of other images to process.

Stani (stani)
Changed in phatch:
assignee: nobody → stani (stani)
importance: Undecided → Medium
Stani (stani)
summary: - Skip to next action aborts execution
+ Error dialog buttons don't behave properly
Revision history for this message
Nadia Alramli (nadiana) wrote : Re: Error dialog buttons don't behave properly

I'm attaching a test case. Abort is not stopping the execution. Thanks!

Stani (stani)
Changed in phatch:
importance: Medium → High
Stani (stani)
Changed in phatch:
status: New → In Progress
Revision history for this message
Stani (stani) wrote :
Download full text (3.9 KiB)

Very good bug report, thanks! Luckily it was only for metadata saving, not for regular actions.

$ bzr diff
=== modified file 'phatch/core/api.py'
--- phatch/core/api.py 2009-06-08 18:55:29 +0000
+++ phatch/core/api.py 2009-06-09 14:43:36 +0000
@@ -291,8 +291,14 @@
 def flush_metadata(photo,image_file,result):
     try:
         photo.flush_metadata()
+ result['skip'] = False
+ result['abort'] = False
+ #log non fatal errors/warnings
+ flush_log(photo, image_file)
+ return photo, result
     except Exception, details:
- folder, image = os.path.split(ensure_unicode(image_file))
+ photo.metadata = {}
+ folder, image = os.path.split(ensure_unicode(image_file))
         reason = exception_to_unicode(details)
         message = u'%s\n%s\n\n%s'%(
             _("Can not write metadata to image '%s' in folder:")%image,
@@ -301,7 +307,6 @@
         )
         return process_error(photo,message,image_file,action=None,
             result=result,ignore=True)
- flush_log(photo, image_file)

 def apply_action(action,photo,setting,cache,image_file,result):
@@ -321,8 +326,8 @@
             folder,
             reason,
         )
- ignore = True
- return process_error(photo,message,image_file,action,result,ignore)
+ return process_error(photo,message,image_file,action,
+ result,ignore=True)

 def apply_actions(actions,settings,paths=None,drop=False):
     """Do all the actions."""
@@ -407,7 +412,10 @@
         #do the actions
         for action_index, action in enumerate(actions):
             if action.flush_metadata_before:
- flush_metadata(photo,image_file,result)
+ photo, result = flush_metadata(photo,image_file,result)
+ if result['abort']: return
+ elif result['skip']:
+ break
             #update progress
             progress_result = {}
             send.progress_update_index(progress_result,image_index,action_index)
@@ -421,9 +429,9 @@
             if result['abort']: return
             elif result['skip']:
                 break
- flush_metadata(photo,image_file,result)
- flush_log(photo, image_file, action)
+ photo, result = flush_metadata(photo,image_file,result)
         del photo, progress_result, action_index, action
+ if result['abort']: return
     send.progress_close()
     #mention amount of photos and duration
     delta = time.time()-start

=== modified file 'phatch/core/lib/_pyexiv2.py'
--- phatch/core/lib/_pyexiv2.py 2009-06-09 13:56:09 +0000
+++ phatch/core/lib/_pyexiv2.py 2009-06-09 14:02:24 +0000
@@ -145,7 +145,7 @@
     if ext:
         format = ext.upper()
     if (format and not(format in WRITE_EXIF+WRITE_IPTC)):
- return 'pyexiv2: writing metadata to %s is not supported'%format
+ raise Exception('pyexiv2: writing metadata to %s is not supported'%format)
     image = pyexiv2.Image(path)
     image.readMetadata()
     warnings = []

=== modified file 'phatch/core/pil.py'
--- phatc...

Read more...

summary: - Error dialog buttons don't behave properly
+ Error dialog buttons don't behave properly when flushing metadata
Changed in phatch:
status: In Progress → Fix Committed
Stani (stani)
Changed in phatch:
milestone: none → 0.2.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.