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
../_images/gridEditor.png

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 the applyAssem() 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
growToFullCore()[source]
drawGrid()[source]

Wipe out anything in the drawing and re-draw everything.

drawArrows()[source]

Draw fuel path arrows.

setNumRings(n: int)[source]

Change the number of rings that should be drawn.

onPaint(event, dc=None)[source]
onMouse(event)[source]
onContextMenu(event)[source]
onSelectAssembly(event)[source]
onFillRing(event)[source]
onClearRing(event)[source]
applyAssem(pdcId, value: AssemblyBlueprint | Tuple[int, int] | None)[source]

Apply the passed assembly design or equilibrium path indices for the desired object and redraw it.

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
setNumRings(n: int)[source]
setActiveAssem(aDesign)[source]
setMode(mode: Mode)[source]
expandToFullCore(event)[source]
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.

open(_event)[source]
new(_event)[source]

Create a Dialog with options to make a new grid blueprint, then make it and rejigger everything to use it.

loadFile(fName, cs=None)[source]

Load a new blueprints file, refreshing pretty much everything.

getAssemDesignBySpecifier(specifier)[source]
getAssemToSet()[source]
getSelectedPath()[source]

Return the fuel path index that is currently selected.

This is used to route the state of the _AssemblyPalette controls to things that need to know about such things (arrow drawing, whether objects should be bold, etc.)

class armi.utils.gridEditor.HelpDialog(*args: Any, **kwargs: Any)[source]

Bases: Dialog

class armi.utils.gridEditor.NewGridBlueprintDialog(*args: Any, **kwargs: Any)[source]

Bases: Dialog

Dialog box for configuring a new grid blueprint.

selectGeomType(geom)[source]

Enable/disable relevant controls for the selected geom type.

onSelectGeomType(_event)[source]
onDomainChange(event)[source]
getGridBlueprint()[source]

Using the state of the dialog controls, return a corresponding GridBlueprint.