Apply a single action to a photo. It uses log_error() for non fatal errors or process_error() for serious errors. The settings are read only as the actions don’t have permission to change them.
Parameters: |
|
---|
Apply all the actions to the photos in path.
Parameters: |
|
---|
Verifies action list before executing. It checks whether:
Parameters: |
|
---|
>>> settings = {'no_save':False}
>>> check_actionlist([], settings) is None
True
>>> from actions import canvas, save
>>> canvas_action = canvas.Action()
>>> save_action = save.Action()
>>> check_actionlist([canvas_action,save_action],
... {'no_save':False}) is None
False
>>> check_actionlist([canvas_action], settings) is None
True
>>> settings = {'no_save':True}
>>> check_actionlist([canvas_action], settings) is None
False
>>> settings['overwrite_existing_images_forced']
False
Check whether the action list only exist of file operations (such as copy, rename, ...)
Parameter: | actions – actions of the action list |
---|---|
Type: | list of core.models.Action |
Returns: | True if only file operations, False otherwise |
Return type: | bool |
>>> from actions import canvas, rename
>>> check_actionlist_file_only([canvas.Action()])
False
>>> check_actionlist_file_only([rename.Action()])
True
Filter image files by extension and verify if they are files. It returns a list of info dictionaries which are generated by :method:`InfoPil.dump`:
{'day': 14,
'filename': 'beach',
'filesize': 9682,
'folder': u'/home/stani',
'foldername': u'stani',
'hour': 23,
'minute': 43,
'month': 3,
'monthname': 'March',
'path': '/home/stani/beach.jpg',
'root': '/home',
'second': 26,
'subfolder': u'',
'type': 'jpg',
'weekday': 4,
'weekdayname': 'Friday',
'year': 2008,
'$': 0}
$ is the index of the file within a folder.
Helper function for get_image_infos_from_folder()
Parameters: |
|
---|---|
Returns: | list of image file info |
Return type: | list of dictionaries |
Flushes non fatal errors/warnings with log_error() and warnings that have been logged from the photo to the error log file.
Parameters: |
|
---|
Get all image info dictionaries from a mix of folder and file paths.
Parameters: |
|
---|---|
Returns: | list of image file info |
Return type: | list of dictionaries |
Get all image info dictionaries from a specific folder.
Parameters: |
|
---|---|
Returns: | list of image file info |
Return type: | list of dictionaries |
Helper function for get_image_infos()
Ask the user for paths and settings. In the GUI this shows the execute dialog box.
Parameters: |
|
---|
Get a core.pil.Photo instance from a file. If there is an error opening the file, func:process_error will be called.
Parameters: |
|
---|---|
Returns: | photo, result |
Return type: | tuple |
Extract all used variables from actions.
Parameter: | actions (list of dict) – list of actions |
---|
Import a module, mostly used for actions.
Parameters: |
|
---|
Initializes all actions. Shows an error to the user if an action fails to initialize.
Parameter: | actions (list of core.models.Action) – actions |
---|---|
Returns: | False, if one action fails, True otherwise |
Return type: | bool |
Writer error message to log file.
Helper function for flush_log(), process_error().
Parameters: |
|
---|---|
Returns: | error log details |
Return type: | string |
Open the action list from a file.
Parameter: | filename (string) – the filename of the action list |
---|---|
Returns: | action list |
Return type: | dictionary |
Logs error to file with log_error() and show dialog box allowing the user to skip, abort or ignore.
Helper function for get_photo() and apply_action.
Parameters: |
|
---|---|
Returns: | photo, result |
Return type: | tuple |
Save actionlist data to filename.
Parameters: |
|
---|
Actionlists are stored as dictionaries:
data = {'actions':[...], 'description':'...'}
Filter invalid images out.
Verify if images are not corrupt. Show the invalid images to the user. If no valid images are found, show an error to the user. Otherwise show the valid images to the user.
Parameter: | image_infos (list of dictionaries) – list of image info dictionaries |
---|---|
Returns: | None for error, valid image info dictionaries otherwise |