8.4. Helper Modules

Ansys has included a number of helper modules that wrapper common functions. These are included in a couple of different modules. Python developers are encouraged to familiarize themselves with these modules and their functions as they can save a great deal of development time and provide a more consistent user experience.

'ensight.core' module

This module include a number of image saving and printing functions that implement standard GUI menus.

CeiEnSightPrintWindow() class for rasterizing and printing (in qtimageutils.py)

CeiEnSightCopyWindow() copy to clipboard (in qtimageutils.py)

CeiEnSightSaveImage() save image to disk (in qtimageutils.py)

CeiEnSightImportImageAnnot() import image file/movie as an annotation (in qtimageutils.py)

In the core, there are some useful items (created by __init__.py). ensight.core.ENS_stdout_instance/ENS_stderr_instance are the wrappers for the Python interpreter output. EnSight has 'resume()' and 'suspend()' methods which allows output to be redirected to the console instead of the command dialog Python tab. There is also a dictionary 'ensight.core.extensions'. The keys of the dict include menu, tool, core, gui and each points to a list of instances of object of the class xxxx_extension's that were created on startup.

cei module

This module includes a number of common functions that are not generally EnSight specific. They are used in tools like EnVe, but can be used by any EnSight Python application.

CeiPrintDlg() class for PyQt based rendering and printing of the main window (in printdlg.py)

CeiQtImageFormatOptions() class for prompting the user for UDIL selection/options (in qtimgformats.py)

CeiQtSaveImage() class to prompt the user for a complete set of image size/saving options, including the render and save) (in qtimgformats.py)

CeiPlot() classes to wrapper matplotlib. Create a graph and save it to disk (in plots.py)

CeiQtPlotWindow() class providing a dockable Qt4 widget that contains a CeiPlot object, including copy and print operations (in qtplots.py)

CEItranslate() class that acts as a repository for .gm translation files and allows for dynamic changing of the language for all objects as well as a method to get a language menu (in qtlanguage.py)

ceisplash() class to manage a splash screen from a .svg file (in ceisplash.py)

CeiLogging() and logging shortcuts (in ceilogging.py)

CeiQtGenericDialog() class that generates dynamic dialogs from simple lists and prompts the user for values. It can handle things like text, checkboxes, ints, floats, variables, parts, option menus, strings, filenames, etc (in qtgenericdlg.py).