grail.images Module

Version: 16.2

Table of Contents

Overview

The images module provides you with the ability to get standard images that can be used in your dialogs. The list of available images for this version of MineSight(r) Grail are defined in the Images section below.

Functions

build_cache_file([path])

Generates a file that contains a dictionary called IMAGE_CACHE where the key is an imageName from the grail\_images and the values are base 64 encoded strings.

The path is optional and currently defaults to the grail\_images_cache.py. This file is used by this module.

get_desc(imageName)
Returns the description of the imageName if a description is defined. If no description is defined, this returns a blank string.
get_path(imageName)

Returns the full fle path to the imageName. For example if the imageName was OPENx16.gif, this would return something like, c:\winexe\grail\_image_files\OPENx16.gif.

Note

That if having a base 64 encoded version of the imageName is your goal, then the get_str function has the potential to be more efficient since we will have already pre-loaded a set of imageName strings.

get_str(imageName)
Returns a base 64 encoded string that represents the imageName. The library will have a pre-load version of the imageName . This means that calls to get_str will be more efficient than loading from the file via get_path.
get_TkPhotoImage(imageName, *args, **kws)

Convience function that returns a Tkinter.PhotoImage class based on the supplied imageName. This can be attached to a Tkinter widget to generate an icon. For example, the following code snippet will create a button with the OPENx16.gif image.

import Tkinter
from grail import images

root = Tkinter.Tk()
graphic = images.get_TkPhotoImage("OPENx16.gif")
button = Tkinter.Button(root, image=graphic)
button.pack()
root.mainloop()

If you have not started Tkinter before calling this function, you will generate a RuntimeError. The Tkinter "root" needs to be defined prior to calling this function.

Note

This function, and Tkinter, should only be used with the GIF images.

list_image_names([include, exclude])

Returns a list of all valid imageNames. You are able to apply a filter by creating a pattern list in the include and exclude lists. The default values for the include and exclude lists are as follows,

List Name Value
include ["*.*"]
exclude ["*.txt"]

you can use the IMAGE_INCLUDE_LIST list to get a default listing of images to include.

Images

The images are accessible by their file names. Each of the available images are defined below.

LOGO_MS3D.gif

Picture of LOGO_MS3D.gif

Logo for MineSight(r) 3-D, size is 480x114 pixels. There are two variants here a GIF and PNG one.

LOGO_MS3D.png

Picture of LOGO_MS3D.png

Logo for MineSight(r) 3-D, size is 480x114 pixels. There are two variants here a GIF and PNG one.

LOGO_MSOPS.gif

Picture of LOGO_MSOPS.gif

Logo for MineSight(r) Operations, size is 300x78 pixels.

OPENx16.gif

Picture of OPENx16.gif

Used for Browse... operations.