formField¶
Store internally as a string. Provide validation routines.
-
class
lib.formField.
AlignHorizontalField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
lib.formField.
AlignVerticalField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
lib.formField.
BooleanField
(value, visible=True)¶ Bases:
lib.formField.Field
-
description
= 'boolean'¶
-
to_python
(x, label)¶
-
to_string
(x)¶
-
-
class
lib.formField.
CharField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.Field
-
allow_empty
= True¶
-
description
= 'string'¶
-
-
class
lib.formField.
ChoiceField
(value, choices, **keyw)¶ Bases:
lib.formField.NotEmptyCharField
-
description
= 'choice'¶
-
set_choices
(choices)¶
-
-
class
lib.formField.
ColorField
(value, visible=True)¶ Bases:
lib.formField.Field
-
class
lib.formField.
CommandLineField
(*args, **keyw)¶ Bases:
lib.formField.NotEmptyCharField
-
raise_error_file
(label, what)¶
-
raise_error_not_found
(label, what)¶
-
raise_error_out_max
(label)¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
CsvFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.FileField
-
allow_empty
= True¶
-
extensions
= ['csv']¶
-
-
class
lib.formField.
DictionaryReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ReadFileField
-
dictionary
= None¶
-
init_dictionary
()¶
-
to_python
(x, label, test=False)¶
-
-
class
lib.formField.
DpiField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.PositiveNonZeroIntegerField
PIL defines the resolution in two dimensions as a tuple (x, y). Phatch ignores this possibility and simplifies by using only one resolution
-
description
= 'resolution'¶
-
-
class
lib.formField.
EmptyFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.FileField
-
allow_empty
= True¶
-
-
class
lib.formField.
ExifItpcField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
fix_string
(x)¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
Field
(value, visible=True)¶ Bases:
object
Base class for fields. This needs to be subclassed but, never used directly.
Required to overwrite: description - describes the expected value
Optional to overwrite to_python - raise here exceptions in case of validation errors (defaults
to string).to_string - (defaults to string)
Never overwrite: validate - will work right out of the box as exceptions are raised by
the to_python methodget - gets the current value as a string set - sets the current value as a string
You can access the value by self.value_as_string
This field interpolates <variables> within a info. << or >> will be interpolated as < or >
Parameters: - value (str) – initial value
- visible (str) – if the field will be visible as a field
Invisible fields request a different kind of user interaction to change their values than a normal field. In Phatch this is used eg for enabling/disabling actions.
A get_relevant_* method of a Form will show/hide fields which depend on other conditions.
-
allow_empty
= False¶
-
assert_safe
(label, info)¶
-
description
= '<?>'¶
-
eval
(x, label)¶
-
fix_string
(x)¶ For the ui (see ‘write tag’ action)
-
get
(info=None, label='?', value_as_string=None, test=False)¶ For code: Interpolated, but not translated - value_as_string can be optionally provided to test the expression
Ignore test parameter (only for compatiblity with TestField)
-
get_as_string
()¶ For GUI: Translation, but no interpolation here
-
interpolate
(x, info, label)¶
-
safe
= True¶
-
set
(x)¶ For code: Interpolated, but not translated
-
set_as_string
(x)¶ For GUI: Translation, but no interpolation here
-
set_as_string_dirty
(x)¶ For GUI: Translation, but no interpolation here
-
static
set_globals
(_globals)¶
-
to_python
(x, label)¶
-
to_string
(x)¶
-
validate
(names, _globals, _locals)¶ Helper method for
safe.compile_expr()
.
-
class
lib.formField.
FileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
extensions
= []¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
FileNameField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
Without extension
-
class
lib.formField.
FileSizeField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
Can be in bytes (
bt
), kilo bytes (kb
), mega bytes (mb
), or giga bytes (gb
).>>> FileSizeField('5kb').get() 5120 >>> FileSizeField('5mb').get() 5242880
-
to_python
(x, label)¶
-
-
class
lib.formField.
FloatField
(value, visible=True)¶ Bases:
lib.formField.Field
-
description
= 'float'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
FloatSliderField
(value, minValue, maxValue, **keyw)¶ Bases:
lib.formField.FloatField
,lib.formField.SliderField
A value with boundaries set by a slider.
-
class
lib.formField.
FolderField
(value=None, visible=True, choices=None)¶
-
class
lib.formField.
FontFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.DictionaryReadFileField
-
allow_empty
= True¶
-
extensions
= ['ttf', 'otf', 'ttc']¶
-
init_dictionary
()¶
-
-
class
lib.formField.
Form
(**options)¶ Bases:
object
-
ALIGN_HORIZONTAL
= [u'left', u'center', u'right']¶
-
ALIGN_VERTICAL
= [u'top', u'middle', u'bottom']¶
-
class
AlignHorizontalField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
Form.
AlignVerticalField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
Form.
BYSIZE
= u'<width>x<height>'¶
-
class
Form.
BooleanField
(value, visible=True)¶ Bases:
lib.formField.Field
-
description
= 'boolean'¶
-
to_python
(x, label)¶
-
to_string
(x)¶
-
-
Form.
COMPRESSION
= u'<compression>'¶
-
class
Form.
CharField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.Field
-
allow_empty
= True¶
-
description
= 'string'¶
-
-
class
Form.
ChoiceField
(value, choices, **keyw)¶ Bases:
lib.formField.NotEmptyCharField
-
description
= 'choice'¶
-
set_choices
(choices)¶
-
-
class
Form.
ColorField
(value, visible=True)¶ Bases:
lib.formField.Field
-
class
Form.
CommandLineField
(*args, **keyw)¶ Bases:
lib.formField.NotEmptyCharField
-
raise_error_file
(label, what)¶
-
raise_error_not_found
(label, what)¶
-
raise_error_out_max
(label)¶
-
to_python
(x, label)¶
-
-
class
Form.
CsvFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.FileField
-
allow_empty
= True¶
-
extensions
= ['csv']¶
-
-
Form.
DATE
= u'<year>-<##month>-<##day>'¶
-
Form.
DATETIME
= u'<year>-<##month>-<##day>_<##hour>-<##minute>-<##second>'¶
-
Form.
DEFAULT_FOLDER
= u'<desktop>/phatch/<subfolder>'¶
-
Form.
DESKTOP
= u'<desktop>'¶
-
Form.
DPI
= u'<dpi>'¶
-
Form.
DPIS
= [u'<dpi>', '<dpi/2>', '72', '144', '300']¶
-
class
Form.
DictionaryReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ReadFileField
-
dictionary
= None¶
-
init_dictionary
()¶
-
to_python
(x, label, test=False)¶
-
-
class
Form.
DpiField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.PositiveNonZeroIntegerField
PIL defines the resolution in two dimensions as a tuple (x, y). Phatch ignores this possibility and simplifies by using only one resolution
-
description
= 'resolution'¶
-
-
Form.
EXIF_DATE
= '<Exif_Photo_DateTimeOriginal.year>-<##Exif_Photo_DateTimeOriginal.month>-<##Exif_Photo_DateTimeOriginal.day>'¶
-
Form.
EXIF_IPTC
= ['Exif_Image_Artist', 'Exif_Image_Copyright', 'Exif_Image_ImageDescription', 'Exif_Image_DateTime', 'Exif_Image_Make', 'Exif_Image_Model', 'Exif_Image_Orientation', 'Exif_Photo_UserComment', 'Exif_Photo_WhiteBalance', 'Iptc_Application2_Byline', 'Iptc_Application2_BylineTitle', 'Iptc_Application2_Caption', 'Iptc_Application2_CaptionWriter', 'Iptc_Application2_Category', 'Iptc_Application2_City', 'Iptc_Application2_Copyright', 'Iptc_Application2_CountryName', 'Iptc_Application2_DateCreated', 'Iptc_Application2_Keywords', 'Iptc_Application2_ObjectName', 'Iptc_Application2_ProvinceState', 'Iptc_Application2_Writer']¶
-
class
Form.
EmptyFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.FileField
-
allow_empty
= True¶
-
-
class
Form.
ExifItpcField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
fix_string
(x)¶
-
to_python
(x, label)¶
-
-
Form.
FILENAME
= u'<filename>'¶
-
Form.
FILENAMES
= [u'<filename>', u'<filename>_phatch', 'Image<###index>', '<Exif_Photo_DateTimeOriginal.year>-<##Exif_Photo_DateTimeOriginal.month>-<##Exif_Photo_DateTimeOriginal.day>', u'<year>-<##month>-<##day>_<##hour>-<##minute>-<##second>']¶
-
Form.
FOLDER
= u'<folder>'¶
-
Form.
FOLDERS
= [u'<folder>_phatch/<subfolder>', u'<folder>/<subfolder>', u'<desktop>', u'<desktop>/phatch', u'<desktop>/phatch/<subfolder>', u'<desktop>/phatch/<width>x<height>', u'<desktop>/phatch/<year>/<##month>/<##day>', u'<root>/phatch/<subfolder>']¶
-
Form.
FOLDER_PHATCH
= u'<desktop>/phatch'¶
-
Form.
FONT_EXTENSIONS
= ['ttf', 'otf', 'ttc']¶
-
class
Form.
Field
(value, visible=True)¶ Bases:
object
Base class for fields. This needs to be subclassed but, never used directly.
Required to overwrite: description - describes the expected value
Optional to overwrite to_python - raise here exceptions in case of validation errors (defaults
to string).to_string - (defaults to string)
Never overwrite: validate - will work right out of the box as exceptions are raised by
the to_python methodget - gets the current value as a string set - sets the current value as a string
You can access the value by self.value_as_string
This field interpolates <variables> within a info. << or >> will be interpolated as < or >
Parameters: - value (str) – initial value
- visible (str) – if the field will be visible as a field
Invisible fields request a different kind of user interaction to change their values than a normal field. In Phatch this is used eg for enabling/disabling actions.
A get_relevant_* method of a Form will show/hide fields which depend on other conditions.
-
allow_empty
= False¶
-
assert_safe
(label, info)¶
-
description
= '<?>'¶
-
eval
(x, label)¶
-
fix_string
(x)¶ For the ui (see ‘write tag’ action)
-
get
(info=None, label='?', value_as_string=None, test=False)¶ For code: Interpolated, but not translated - value_as_string can be optionally provided to test the expression
Ignore test parameter (only for compatiblity with TestField)
-
get_as_string
()¶ For GUI: Translation, but no interpolation here
-
interpolate
(x, info, label)¶
-
safe
= True¶
-
set
(x)¶ For code: Interpolated, but not translated
-
set_as_string
(x)¶ For GUI: Translation, but no interpolation here
-
set_as_string_dirty
(x)¶ For GUI: Translation, but no interpolation here
-
static
set_globals
(_globals)¶
-
to_python
(x, label)¶
-
to_string
(x)¶
-
validate
(names, _globals, _locals)¶ Helper method for
safe.compile_expr()
.
-
class
Form.
FileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
extensions
= []¶
-
to_python
(x, label)¶
-
-
class
Form.
FileNameField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
Without extension
-
class
Form.
FileSizeField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
Can be in bytes (
bt
), kilo bytes (kb
), mega bytes (mb
), or giga bytes (gb
).>>> FileSizeField('5kb').get() 5120 >>> FileSizeField('5mb').get() 5242880
-
to_python
(x, label)¶
-
-
class
Form.
FloatField
(value, visible=True)¶ Bases:
lib.formField.Field
-
description
= 'float'¶
-
to_python
(x, label)¶
-
-
class
Form.
FloatSliderField
(value, minValue, maxValue, **keyw)¶ Bases:
lib.formField.FloatField
,lib.formField.SliderField
A value with boundaries set by a slider.
-
class
Form.
FolderField
(value=None, visible=True, choices=None)¶
-
class
Form.
FontFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.DictionaryReadFileField
-
allow_empty
= True¶
-
extensions
= ['ttf', 'otf', 'ttc']¶
-
init_dictionary
()¶
-
-
Form.
GEO_EXTENSIONS
= ['gpx']¶
-
class
Form.
GeoReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ReadFileField
-
allow_empty
= False¶
-
extensions
= ['gpx']¶
-
-
Form.
ICON_SIZE
= (64, 64)¶
-
Form.
IMAGE_EFFECTS
= [u'blur', u'contour', u'detail', u'edge enhance', u'edge enhance more', u'emboss', u'find edges', u'smooth', u'smooth more', u'sharpen']¶
-
Form.
IMAGE_EXTENSIONS
= ['bmp', 'gif', 'jpe', 'jpeg', 'jpg', 'im', 'pcx', 'png', 'pbm', 'pgm', 'ppm', 'tif', 'tiff', 'xbm']¶
-
Form.
IMAGE_FILTERS
= [u'nearest', u'bilinear', u'bicubic']¶
-
Form.
IMAGE_MODES
= [u'Monochrome (1-bit pixels, black and white)', u'Grayscale (8-bit pixels)', u'LA (8-bit pixels, grayscale with transparency mask)', u'RGB (3x8-bit pixels, true color)', u'RGBA (4x8-bit pixels, RGB with transparency mask)', u'CMYK (4x8-bit pixels, color separation)', u'P (8-bit pixels, mapped using a color palette)', u'YCbCr (3x8-bit pixels, color video format)']¶
-
Form.
IMAGE_READ_EXTENSIONS
= ['bmp', 'bw', 'cmyk', 'cur', 'dcx', 'flc', 'fli', 'fpx', 'gbr', 'gd', 'gif', 'ico', 'im', 'imt', 'jpe', 'jpeg', 'jpg', 'mcidas', 'mic', 'pbm', 'pcd', 'pcx', 'pgm', 'png', 'ppm', 'psd', 'rgb', 'sun', 'tga', 'tif', 'tiff', 'xbm', 'xpm']¶
-
Form.
IMAGE_READ_MIMETYPES
= ['image/bmp', 'image/bw', 'image/cmyk', 'image/cur', 'image/dcx', 'image/flc', 'image/fli', 'image/fpx', 'image/gbr', 'image/gd', 'image/gif', 'image/ico', 'image/im', 'image/imt', 'image/jpe', 'image/jpeg', 'image/jpg', 'image/mcidas', 'image/mic', 'image/pbm', 'image/pcd', 'image/pcx', 'image/pgm', 'image/png', 'image/ppm', 'image/psd', 'image/rgb', 'image/sun', 'image/tga', 'image/tif', 'image/tiff', 'image/xbm', 'image/xpm']¶
-
Form.
IMAGE_RESAMPLE_FILTERS
= [u'nearest', u'bilinear', u'bicubic', u'antialias']¶
-
Form.
IMAGE_TRANSPOSE
= [u'Rotate 90', u'Rotate 180', u'Rotate 270', u'Flip Left Right', u'Flip Top Bottom']¶
-
Form.
IMAGE_WRITE_EXTENSIONS
= ['<type>', 'bmp', 'eps', 'gif', 'im', 'jpe', 'jpeg', 'jpg', 'pbm', 'pcx', 'pdf', 'pgm', 'png', 'ppm', 'ps', 'tif', 'tiff', 'xbm']¶
-
class
Form.
ImageDictionaryField
(value=None, visible=True, choices=None)¶
-
class
Form.
ImageDictionaryReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ImageReadFileField
-
icon_size
= (64, 64)¶
-
-
class
Form.
ImageEffectField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
ImageFilterField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
ImageModeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
to_python
(x, label)¶
-
-
class
Form.
ImageReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.DictionaryReadFileField
-
extensions
= ['bmp', 'bw', 'cmyk', 'cur', 'dcx', 'flc', 'fli', 'fpx', 'gbr', 'gd', 'gif', 'ico', 'im', 'imt', 'jpe', 'jpeg', 'jpg', 'mcidas', 'mic', 'pbm', 'pcd', 'pcx', 'pgm', 'png', 'ppm', 'psd', 'rgb', 'sun', 'tga', 'tif', 'tiff', 'xbm', 'xpm']¶
-
-
class
Form.
ImageReadTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
Form.
ImageResampleAutoField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
ImageResampleField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
ImageTransposeField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
ImageTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
fix_string
(x)¶
-
-
class
Form.
ImageWriteTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
Form.
IntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
description
= 'integer'¶
-
to_python
(x, label)¶
-
-
class
Form.
NotEmptyCharField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.CharField
-
allow_empty
= False¶
-
-
Form.
OFFSET_PIXELS
= ['-75', '-50', '-25', '-10', '-5', '0', '5', '10', '25', '50', '75', '100']¶
-
Form.
ORIENTATION
= [u'Normal', u'Rotate 90', u'Rotate 180', u'Rotate 270', u'Flip Left Right', u'Flip Top Bottom']¶
-
class
Form.
OptionalTransposeField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
Form.
OrientationField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
to_python
(x, label)¶
-
-
Form.
PIXELS
= ['10', '25', '50', '100', '200']¶
-
Form.
PIXELS_X
= ['16', '32', '64', '128', '256', '640', '800', '1024', '1280', '1280', '1440', '1600', '1680', '1920', '1920']¶
-
Form.
PIXELS_Y
= ['16', '32', '64', '128', '256', '480', '600', '768', '960', '1024', '900', '1200', '1050', '1080', '1200']¶
-
class
Form.
PixelField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
Can be pixels, cm, inch, %.
-
get_size
(info, base, dpi, label, value_as_string=None)¶
-
-
class
Form.
PositiveFloatField
(value, visible=True)¶ Bases:
lib.formField.FloatField
-
description
= 'positive integer'¶
-
to_python
(x, label)¶
-
-
class
Form.
PositiveIntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
-
description
= 'positive integer'¶
-
to_python
(x, label)¶
-
-
class
Form.
PositiveNonZeroFloatField
(value, visible=True)¶ Bases:
lib.formField.PositiveFloatField
-
description
= 'positive, non-zero integer'¶
-
to_python
(x, label)¶
-
-
class
Form.
PositiveNonZeroIntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.PositiveIntegerField
-
description
= 'positive, non-zero integer'¶
-
to_python
(x, label)¶
-
-
Form.
RANK_SIZES
= [3, 5]¶
-
Form.
ROOT
= u'<root>'¶
-
class
Form.
RankSizeField
(value, **keyw)¶ Bases:
lib.formField.IntegerField
,lib.formField.ChoiceField
-
class
Form.
ReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.TestFieldMixin
,lib.formField.FileField
This is a test field to ensure that the file exists. It could also have been called the MustExistFileField.
-
to_python
(x, label, test=False)¶
-
-
Form.
SMALL_PIXELS
= ['1', '2', '5', '10']¶
-
Form.
STAMPS
= ['Phatch', u'Phatch (c)<year> www.stani.be', '<Exif_Photo_DateTimeOriginal.year>-<##Exif_Photo_DateTimeOriginal.month>-<##Exif_Photo_DateTimeOriginal.day>', u'<year>-<##month>-<##day>', u'<year>-<##month>-<##day>_<##hour>-<##minute>-<##second>', u'<filename>', u'<path>']¶
-
Form.
SUBFOLDER
= u'<subfolder>'¶
-
class
Form.
SliderField
(value, minValue, maxValue, **keyw)¶ Bases:
lib.formField.IntegerField
A value with boundaries set by a slider.
-
Form.
TIFF_COMPRESSIONS
= ['<compression>', u'none', 'g3', 'g4', 'jpeg', 'lzw', 'packbits', 'zip']¶
-
Form.
TYPE
= u'<type>'¶
-
class
Form.
TiffCompressionField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
Form.
USE_EXTENSIONS
= 'You can only use files with the following extensions'¶
-
Form.
USE_INSPECTOR
= 'Use the Image Inspector to list all the variables.'¶
-
Form.
dump
()¶ Dump as raw strings
-
Form.
ensure_path
(path)¶
-
Form.
exe
= {}¶
-
Form.
ext
= 'xpm'¶
-
Form.
find_exe
(program, name=None)¶
-
Form.
get_field
(label, info=None)¶
-
Form.
get_field_labels
()¶
-
Form.
get_field_size
(label, info, base, dpi)¶
-
Form.
get_field_string
(label)¶
-
Form.
get_fields
(info, convert=False, pixel_fields=None, exclude=None)¶
-
Form.
icon
= 'ART_TIP'¶
-
Form.
interface
(fields)¶ Describe here the fields. This is called from the __init__ method.
Parameters: fields (odict) – an (usually empty) ordered dictionary
-
Form.
is_enabled
()¶
-
Form.
is_field_true
(label)¶
-
Form.
label
= 'label'¶
-
Form.
load
(fields)¶ Load dumped, raw strings.
-
Form.
set_field
(label, value)¶
-
Form.
set_field_as_string
(label, value_as_string)¶
-
Form.
set_field_as_string_dirty
(label, value_as_string)¶
-
Form.
set_fields
(**options)¶
-
-
class
lib.formField.
GeoReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ReadFileField
-
allow_empty
= False¶
-
extensions
= ['gpx']¶
-
-
class
lib.formField.
ImageDictionaryField
(value=None, visible=True, choices=None)¶
-
class
lib.formField.
ImageDictionaryReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.ImageReadFileField
-
icon_size
= (64, 64)¶
-
-
class
lib.formField.
ImageEffectField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
ImageFilterField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
ImageModeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
to_python
(x, label)¶
-
-
class
lib.formField.
ImageReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.DictionaryReadFileField
-
extensions
= ['bmp', 'bw', 'cmyk', 'cur', 'dcx', 'flc', 'fli', 'fpx', 'gbr', 'gd', 'gif', 'ico', 'im', 'imt', 'jpe', 'jpeg', 'jpg', 'mcidas', 'mic', 'pbm', 'pcd', 'pcx', 'pgm', 'png', 'ppm', 'psd', 'rgb', 'sun', 'tga', 'tif', 'tiff', 'xbm', 'xpm']¶
-
-
class
lib.formField.
ImageReadTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
lib.formField.
ImageResampleAutoField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
ImageResampleField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
ImageTransposeField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
ImageTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
fix_string
(x)¶
-
-
class
lib.formField.
ImageWriteTypeField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
class
lib.formField.
IntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.NotEmptyCharField
-
description
= 'integer'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
NotEmptyCharField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.CharField
-
allow_empty
= False¶
-
-
class
lib.formField.
OptionalTransposeField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
class
lib.formField.
OrientationField
(value, **keyw)¶ Bases:
lib.formField.PilConstantMixin
,lib.formField.ChoiceField
-
to_python
(x, label)¶
-
-
class
lib.formField.
PixelField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
Can be pixels, cm, inch, %.
-
get_size
(info, base, dpi, label, value_as_string=None)¶
-
-
class
lib.formField.
PositiveFloatField
(value, visible=True)¶ Bases:
lib.formField.FloatField
-
description
= 'positive integer'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
PositiveIntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.IntegerField
-
description
= 'positive integer'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
PositiveNonZeroFloatField
(value, visible=True)¶ Bases:
lib.formField.PositiveFloatField
-
description
= 'positive, non-zero integer'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
PositiveNonZeroIntegerField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.PositiveIntegerField
-
description
= 'positive, non-zero integer'¶
-
to_python
(x, label)¶
-
-
class
lib.formField.
RankSizeField
(value, **keyw)¶ Bases:
lib.formField.IntegerField
,lib.formField.ChoiceField
-
class
lib.formField.
ReadFileField
(value=None, visible=True, choices=None)¶ Bases:
lib.formField.TestFieldMixin
,lib.formField.FileField
This is a test field to ensure that the file exists. It could also have been called the MustExistFileField.
-
to_python
(x, label, test=False)¶
-
-
class
lib.formField.
SliderField
(value, minValue, maxValue, **keyw)¶ Bases:
lib.formField.IntegerField
A value with boundaries set by a slider.
-
class
lib.formField.
TestFieldMixin
¶ Mixin class, the to_python method should
- def to_python(self, x, label, test=False):
- “test parameter to signal test-validate” return x
See set_form_field_value in treeEdit.py
-
get
(info=None, label='?', value_as_string=None, test=False)¶ Use this method to test-validate the user input, for example: field.get(IMAGE_TEST_INFO, value_as_string, label, test=True)
-
class
lib.formField.
TiffCompressionField
(value, **keyw)¶ Bases:
lib.formField.ChoiceField
-
exception
lib.formField.
ValidationError
(expected, message, details=None)¶ Bases:
exceptions.Exception
-
lib.formField.
files_dictionary
(paths, extensions, title_parser=None)¶ Collects files with a certain extension in different folders and stores the files in a dictionary of which the keys are titled versions of the filename.
Phatch uses this for fonts, highlights and masks.
>>> files_dictionary(['/etc/apt'], ['.list']) {'Sources': '/etc/apt/sources.list'}
-
lib.formField.
get_safe
()¶
-
lib.formField.
rotation_title_parser
(field, filename)¶
-
lib.formField.
set_safe
(state)¶