models

Store internally as a string. Provide validation routines.

class core.models.Action(**options)

Bases: lib.formField.Form

Action base class.

class BlenderField(value=None, visible=True, choices=None)

Bases: lib.formField.ImageDictionaryField

get_path()
init_dictionary()
class Action.BlenderObjectField(value=None, visible=True, choices=None)
Bases: core.models.BlenderField
class Action.BlenderRotationField(value=None, visible=True, choices=None)

Bases: core.models.BlenderField

get_path()
title_parser(field, filename)
class Action.HighlightFileField(value=None, visible=True, choices=None)

Bases: lib.formField.ImageDictionaryReadFileField

init_dictionary()
class Action.MaskFileField(value=None, visible=True, choices=None)

Bases: lib.formField.ImageDictionaryReadFileField

init_dictionary()
class Action.PerspectiveField(value=None, visible=True, choices=None)

Bases: lib.formField.ImageDictionaryField

init_dictionary()
class Action.WatermarkFileField(value=None, visible=True, choices=None)

Bases: lib.formField.ImageDictionaryReadFileField

init_dictionary()
Action.apply(photo, setting, cache)

Can be overwritten always returns the photo.

If this method is not overwritten a pil method should be required.

Action.ensure_path_or_desktop(folder, photo, filename, desktop=False)

Ensures that folder exists. If it can’t create the path, it will log an error in the photo and propose to save it in the desktop folder instead.

Parameters:
  • folder – folder path
  • folder (core.pil.Photo) – photo to log to
  • filename (str) – targeted filename
  • desktop (bool) – force saving on desktop
Returns:

same filename, or on desktop in case of errors

Return type:

str

static Action.init()
Action.is_done(photo)
Method used for resuming when a batch was interrupted. Check if this image has been done already.
Action.values(info, pixel_fields=None, exclude=None)
class core.models.CropMixin

Bases: object

get_relevant_field_labels(action=None)

If this method is present, Phatch will only show relevant fields.

Returns:list of the field labels which are relevant
Return type:list of strings

Note

It is very important that the list of labels has EXACTLY the same order as defined in the interface method.

interface(fields, action=None)
values(info, pixel_fields=None, exclude=None, action=None)
class core.models.LosslessSaveMixin

Bases: object

get_lossless_filename(photo, info)
interface(fields)
is_done(photo)
Method used for resuming when a batch was interrupted. For metadata there is no way to know if this image has been done already, so return False by default.
is_overwrite_existing_images_forced()
Always force overwrite as we want to store the tags in existing images.
class core.models.OffsetMixin

Bases: object

get_relevant_field_labels()
interface(fields)
values(info, pixel_fields=None, exclude=None)
class core.models.StampMixin

Bases: core.models.OffsetMixin

get_relevant_field_labels()
interface(fields)
core.models.init()
core.models.negative(value)

Returns the negative value of a string expression.

Parameter:value (str) – int or float expression
Returns:negative value of expression
Return type:str
>>> negative('5')
'-5'
>>> negative('-5')
'5'

Previous topic

message

Next topic

pil