pyface.image.image module

Defines the ImageLibrary object used to manage Pyface image libraries.

pyface.image.image.read_file(file_name)[source]

Returns the contents of the specified file_name.

pyface.image.image.write_file(file_name, data)[source]

Writes the specified data to the specified file.

pyface.image.image.get_python_value(source, name)[source]

Returns the value of a Python symbol loaded from a specified source code string.

pyface.image.image.time_stamp_for(time)[source]

Returns a specified time as a text string.

pyface.image.image.add_object_prefix(dict, object, prefix)[source]

Adds all traits from a specified object to a dictionary with a specified name prefix.

pyface.image.image.split_image_name(image_name)[source]

Splits a specified image_name into its constituent volume and file names and returns a tuple of the form: ( volume_name, file_name ).

pyface.image.image.join_image_name(volume_name, file_name)[source]

Joins a specified volume_name and file_name into an image name, and return the resulting image name.

class pyface.image.image.FastZipFile[source]

Bases: HasPrivateTraits

Provides fast access to zip files by keeping the underlying zip file open across multiple uses.

path = File()

The path to the zip file:

zf = Property

The open zip file object (if None, the file is closed):

time_stamp = Float()

The time stamp of when the zip file was most recently accessed:

access = Any()

The lock used to manage access to the ‘zf’ trait between the two threads:

namelist()[source]

Returns the names of all files in the top-level zip file directory.

read(file_name)[source]

Returns the contents of the specified file_name from the zip file.

close()[source]

Temporarily closes the zip file (usually while the zip file is being replaced by a different version).

class pyface.image.image.ImageInfo[source]

Bases: HasPrivateTraits

Defines a class that contains information about a specific Traits UI image.

volume = Instance("ImageVolume")

The volume this image belongs to:

name = Str()

The user friendly name of the image:

image_name = Str()

The full image name (e.g. @standard:floppy’):

description = Str()

A description of the image:

category = Str("General")

The category that the image belongs to:

keywords = List(Str)

A list of keywords used to describe/categorize the image:

width = Int()

The image width (in pixels):

height = Int()

The image height (in pixels):

border = HasBorder

The border inset:

content = HasMargin

The margin to use around the content:

label = HasMargin

The margin to use around the label:

alignment = Alignment

The alignment to use for the label:

copyright = Property

The copyright that applies to this image:

license = Property

The license that applies to this image:

image_info_code = Property

A read-only string containing the Python code needed to construct this ImageInfo object:

class pyface.image.image.ImageVolumeInfo[source]

Bases: HasPrivateTraits

description = Str("No volume description specified.")

A general description of the images:

copyright = Str("No copyright information specified.")

The copyright that applies to the images:

license = Str("No license information specified.")

The license that applies to the images:

image_names = List(Str)

The list of image names within the volume the information applies to. Note that an empty list means that the information applies to all images in the volume:

image_volume_info_code = Property

A read-only string containing the Python code needed to construct this ImageVolumeInfo object:

image_volume_info_text = Property

A read-only string containing the text describing the volume info:

clone()[source]

Returns a copy of the ImageVolumeInfo object.

class pyface.image.image.ImageVolume[source]

Bases: HasPrivateTraits

name = Str()

The canonical name of this volume:

info = List(ImageVolumeInfo)

The list of volume descriptors that apply to this volume:

category = Str("General")

The category that the volume belongs to:

keywords = List(Str)

A list of keywords used to describe the volume:

aliases = List(Str)

The list of aliases for this volume:

path = File()

The path of the file that defined this volume:

is_zip_file = Bool(True)

Is the path a zip file?

zip_file = Instance(FastZipFile)

The FastZipFile object used to access the underlying zip file:

images = List(ImageInfo)

The list of images available in the volume:

catalog = Property(observe="images")

A dictionary mapping image names to ImageInfo objects:

time_stamp = Str()

The time stamp of when the image library was last modified:

image_volume_code = Property

A read-only string containing the Python code needed to construct this ImageVolume object:

images_code = Property

A read-only string containing the Python code needed to construct the ‘images’ list for this ImageVolume object:

license_text = Property

A read-only string containing the text describing the contents of the volume (description, copyright, license information, and the images they apply to):

update()[source]

Updates the contents of the image volume from the underlying image store, and saves the results.

save()[source]

Saves the contents of the image volume using the current contents of the ImageVolume.

image_resource(image_name)[source]

Returns the ImageResource object for the specified image_name.

image_data(image_name)[source]

Returns the image data (i.e. file contents) for the specified image name.

volume_info(image_name)[source]

Returns the ImageVolumeInfo object that corresponds to the image specified by image_name.

class pyface.image.image.ZipFileReference[source]

Bases: ResourceReference

zip_file = Instance(FastZipFile)

The zip file to read;

volume_name = Str()

The volume name:

file_name = Str()

The file within the zip file:

cache_file = File()

The name of the cached image file:

filename = Property

The file name of the image (in this case, the cache file name):

load()[source]

Loads the resource.