armi.utils.gridEditor module
GUI elements for manipulating grid layout and contents.
This provides a handful of classes which provide wxPython Controls for manipulating grids and grid Blueprints.
The grid editor may be invoked with the armi.cli.gridGui
entry point:
$ python -m armi grids
If you have an existing set of input files, pass in the blueprints input file as the first argument and the system will load up the associated grid, e.g.:
$ python -m armi grids FFTF-blueprints.yaml

An example of the Grid Editor being used on a FFTF input file
Known Issues
There is no action stack or undo functionality. Save frequently if you want to recover previous states
Cartesian grids are supported, but not rendered as nicely as their Hex counterparts. The “through center assembly” case is not rendered properly with the half-assemblies that lie along the edges.
The controls are optimized for manipulating a Core layout, displaying an “Assembly palette” that contains the Assembly designs found in the top-level blueprints. A little extra work and this could also be made to manipulate block grids or other things.
Assembly colors are derived from the set of flags applied to them, but the mapping of colors to flags is not particularly rich, and there isn’t anything to disambiguate between assemblies of different design, but the same flags.
No proper zoom support, and object sizes are fixed and don’t accommodate long specifiers.
- class armi.utils.gridEditor.GridGui(*args: Any, **kwargs: Any)[source]
Bases:
ScrolledWindow
Visual editor for grid blueprints.
This is the actual viewer that displays the grid and grid blueprints contents, and responds to mouse events. Under the hood, it uses a wx.PseudoDC to handle the drawing, which provides the following benefits over a regular DC:
Drawn objects can be associated with an ID, allowing parts of the drawing to be modified or cleared without having to re-draw everything.
The IDs associated with the objects can be used to distinguish what was clicked on in a mouse event (though the support for this isn’t super great, so we do have to do some of our own object disambiguation).
The
drawGrid()
method is used to re-draw the entire geometry, whereas theapplyAssem()
method may be used to update a single assembly.Create a new GridGui.
- Parameters:
parent (wx.Window) – The parent control
bp (set of grid blueprints, optional) – This should be the
gridDesigns
section of a root Blueprints object. If not provided, a dictionary will be created with an empty “core” grid blueprint.
- class Mode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
Enumeration for what type of objects are currently being manipulated.
This can either be SPECIFIER, for laying out the initial core layout, or PATH for manipulating fuel shuffling paths.
- SPECIFIER = 0
- POSITION_IJ = 1
- POSITION_RINGPOS = 2
- PATH = 3
- property label
- property isPosition
- property grid
- property mode
- property activeBlueprints
- class armi.utils.gridEditor.GridBlueprintControl(*args: Any, **kwargs: Any)[source]
Bases:
Panel
A GUI for manipulating core layouts.
The original intent of this is to serve as a stand-in replacement for the current “HexDragger”. With further work, this could be made to function as a more general tool for manipulating grids of any sort.
- property bp
- property grid
- objectClicked(_idx)[source]
Notify relevant controls that the object at the passed indices has been activated.
This is needed to make the auto-increment stuff work in the fuel path editor. Without some sort of event that provides a positive assertion that the user is trying to interact with the layout, we can’t know when to increment.
- saveImage()[source]
Save the core layout to an image.
Currently this only supports PNG images for simplicity. wxpython does not attempt to infer the file type based on extension, so we would need to make a file extension-to-format mapping.
- save(stream=None, full=False)[source]
Save the blueprints to the passed stream, if provided. Otherwise prompt for a file to save to.
This can save either the entire blueprints, or just the grids: section of the blueprints, based on the passed
full
argument. Saving just the grid blueprints can be useful when cobbling blueprints together with !include flags.