Notifications should not appear when cancel is pressed

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

Bug Description

The notification code should be embedded inside the apply_actions method.

Stani (stani)
Changed in phatch:
assignee: nobody → stani (stani)
importance: Undecided → Medium
status: New → Confirmed
Stani (stani)
summary: - Notification should not appear when cancel is pressed.
+ Notifications should not appear always appear
description: updated
summary: - Notifications should not appear always appear
+ Notifications should not appear when cancel is pressed
Stani (stani)
Changed in phatch:
status: Confirmed → In Progress
Revision history for this message
Stani (stani) wrote :
Download full text (5.6 KiB)

$ bzr commit -m "fix notifications"
Committing to: /home/stani/sync/python/phatch/trunk/
modified phatch/core/api.py
modified phatch/core/message.py
modified phatch/pyWx/gui.py
Committed revision 656.

$ bzr diff
=== modified file 'phatch/core/api.py'
--- phatch/core/api.py 2009-06-05 18:01:30 +0000
+++ phatch/core/api.py 2009-06-05 19:09:48 +0000
@@ -19,8 +19,14 @@
 #---import modules

 #standard library
-import codecs, cPickle, os, pprint, time, traceback
+import codecs
+import cPickle
+import os
+import pprint
+import time
+import traceback
 from cStringIO import StringIO
+from datetime import timedelta

 #gui-independent
 from core import ct, pil
@@ -30,6 +36,9 @@
 from unicoding import ensure_unicode, exception_to_unicode, ENCODING
 from formField import ensure_path

+#---constants
+SEE_LOG = _('See Tools>Show Log for more details.')
+
 #---classes

 class PathError(Exception):
@@ -348,6 +357,7 @@
     }

     #Execute action list
+ image_amount = len(image_files)
     actions_amount = len(actions) + 1 #open image is extra action
     cache = {}
     is_done = actions[-1].is_done #checking method for resuming
@@ -355,11 +365,11 @@

     #Start progress dialog
     send.frame_show_progress( title = _("Executing action list"),
- parent_max = len(image_files),
+ parent_max = image_amount,
                                 child_max = actions_amount,
                                 message = '',
                             )
-
+ start = time.time()
     for image_index, (folder,image_file) in enumerate(image_files):
         #update image file & progress dialog box
         progress_result = {}
@@ -400,6 +410,25 @@
         flush_log(photo, image_file, action)
         del photo, progress_result, action_index, action
     send.progress_close()
+ #mention amount of photos and duration
+ delta = time.time()-start
+ duration = timedelta(seconds=int(delta)+48)
+ if image_amount == 1:
+ message = _('One photo done in %s')%duration
+ else:
+ message = _('%d photos done in %s')\
+ %(image_amount,duration)
+ #add error status
+ if ERROR_LOG_COUNTER == 1:
+ message += '\n'+_('One issue was logged')
+ elif ERROR_LOG_COUNTER:
+ message += '\n'+_('%d issues were logged')\
+ %ERROR_LOG_COUNTER
+ send.frame_show_notification(message)
+ if ERROR_LOG_COUNTER == 0:
+ send.frame_show_info(message)
+ else:
+ send.frame_show_message('%s\n\n%s'%(message,SEE_LOG))

 #---common
 import glob

=== modified file 'phatch/core/message.py'
--- phatch/core/message.py 2008-04-05 19:23:49 +0000
+++ phatch/core/message.py 2009-06-05 19:08:14 +0000
@@ -33,6 +33,9 @@
         self.subscribe('show_execute_dialog')
         self.subscribe('show_error')
         self.subscribe('show_files_message')
+ self.subscribe('show_info')
+ ...

Read more...

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

Remote bug watches

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