Changeset 648 for trunk/Update Dates


Ignore:
Timestamp:
08/26/12 14:29:54 (12 years ago)
Author:
Nicholas Riley
Message:

update_dates.py: Don't time out while waiting for a document to OCR.

Fix a longstanding issue where clicking "Cancel" raised an exception.

Also write plist on every scanned document (this change was made quite
a while ago but not checked in until now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Update Dates/update_dates.py

    r626 r648  
    106106    SA = ScriptingAddition()
    107107    SA.activate()
    108     try:
    109         while True:
    110             result = SA.display_dialog('How many pages do you wish to scan?',
    111                                        buttons=['Cancel', 'Scan'],
    112                                        cancel_button=1, default_button=2,
    113                                        default_answer='1')
    114             try:
    115                 pages = int(result[k.text_returned])
    116             except ValueError:
    117                 continue
    118             if pages > 0:
    119                 break
    120     except CommandError:
    121         return False
     108    while True:
     109        result = SA.display_dialog('How many pages do you wish to scan?',
     110                                   buttons=['Cancel', 'Scan'],
     111                                   cancel_button=1, default_button=2,
     112                                   default_answer='1')
     113        if result is None:
     114            return False
     115        try:
     116            pages = int(result[k.text_returned])
     117        except ValueError:
     118            continue
     119        if pages > 0:
     120            break
    122121
    123122    Acrobat.activate()
     
    150149
    151150    scanned_document = Acrobat.documents['%s.pdf' % filename]
    152     scanned_file = scanned_document.file_alias()
     151    scanned_file = scanned_document.file_alias(timeout=0)
    153152    scanned_document.close()
    154153
     
    177176
    178177while scan_one():
    179     pass
    180 
    181 writePlist({'Sources': sources}, PREFERENCES_PATH)
     178    writePlist({'Sources': sources}, PREFERENCES_PATH)
Note: See TracChangeset for help on using the changeset viewer.