40. pyformex
— pyFormex core module initialization.¶
This module initializes the pyFormex global variables and defines a few essential functions. It is the very first thing that is loaded when starting pyFormex.
40.1. Classes defined in module pyformex¶
- class pyformex.DEBUG(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
A class with debug items.
This class holds the defined debug items as attributes. Each debug topic is a binary value with a single bit set (a power of 2). Debug items can be combined with & (AND), | (OR) and ^ (XOR). Two extra values are defined: NONE switches off all debugging, ALL activates all debug items.
Examples
List all existing debug items:
>>> for v in DEBUG: ... if v not in (DEBUG.NONE, DEBUG.ALL): ... print(v) DEBUG.INFO DEBUG.WARNING DEBUG.CONFIG DEBUG.DETECT DEBUG.HELP DEBUG.MEM DEBUG.SCRIPT DEBUG.GUI DEBUG.MENU DEBUG.DRAW DEBUG.CANVAS DEBUG.OPENGL DEBUG.LIB DEBUG.MOUSE DEBUG.APPS DEBUG.IMAGE DEBUG.PICK DEBUG.MISC DEBUG.ABQ DEBUG.WIDGET DEBUG.PROJECT DEBUG.WEBGL DEBUG.MULTI DEBUG.LEGACY DEBUG.PLUGIN DEBUG.UNICODE DEBUG.FONT DEBUG.PGF DEBUG.VTK DEBUG.DOCTEST
- classmethod item(name)[source]¶
Convert a string to a DEBUG item
The string is case insensitive.
- Raises:
ValueError – If the name is not a DEBUG item.
- classmethod level(names)[source]¶
Return the combined debug level for a list of debug items
- Raises:
ValueError – If any of the names is not a DEBUG item.
40.2. Functions defined in module pyformex¶
- pyformex.debugon(topics)[source]¶
Return True if any of specified debug topics is in options.debuglevel.
- Parameters:
topics (
DEBUG
) – A DEBUG topic or any combination of them.- Returns:
bool – True if any of the flags in topics is in options.debuglevel. This is effectively the bool value of the binary AND of topics and options.debuglevel.
Note
If you need to test that multiple flags are in options.debuglevel, use
debugon(flag1) & debugon(flag2)
Examples
>>> options.debuglevel = DEBUG.INFO | DEBUG.OPENGL | DEBUG.GUI | DEBUG.MENU >>> debugon(DEBUG.WARNING | DEBUG.OPENGL) True >>> debugon(DEBUG.WARNING & DEBUG.OPENGL) False >>> debugon(DEBUG.WARNING & DEBUG.OPENGL | DEBUG.GUI) True >>> debugon(DEBUG.OPENGL) & debugon(DEBUG.GUI) True >>> debugon(DEBUG.ALL) True >>> options.debuglevel = DEBUG.NONE >>> debugon(DEBUG.ALL) False