Skip to content

visualdynamics.names

names

How an object is named in a project.

An importer's keys are for code — time_data, Modal_frf, ChannelTable — and the tree is for reading. So the tree shows the object, spelled the way it would be written down: words separated by spaces, each capitalised, and the acronyms this field actually uses left as acronyms.

The name is the key: renaming an item renames the object, so these are what MainWindow.objects is keyed by. Nothing here parses them back.

Functions:

Name Description
display_name

'Modal_frf' -> 'Modal FRF'. 'ShapeSet' -> 'Shape Set'.

Functions:

display_name

display_name(key: str) -> str

'Modal_frf' -> 'Modal FRF'. 'ShapeSet' -> 'Shape Set'.

Anything already spelled as a name comes back unchanged, so a user's own rename is never reformatted underneath them.

Source code in src/visualdynamics/names.py
def display_name(key: str) -> str:
    """'Modal_frf' -> 'Modal FRF'. 'ShapeSet' -> 'Shape Set'.

    Anything already spelled as a name comes back unchanged, so a user's own
    rename is never reformatted underneath them.
    """
    words = _WORDS.findall(key)
    if not words:
        return key
    return ' '.join(ACRONYMS.get(word.lower(), word[:1].upper() + word[1:])
                    for word in words)