Skip to content

Building Element String Table

Class full path: BuildingElementStringTable.BuildingElementStringTable

Bases: BuildingElementStringTableBase

Definition of class StringTable

Functions

__init__(path, numeric, lang)

Initialization of class StringTable

Parameters:

Name Type Description Default
path str

path of according .py file. The file name will be set internally to _xyz.xml

required
numeric bool

the string table will be created only from numeric (123..) text ids or not numeric text ids (e_THE_VALUE)

required
lang str

language shortcut

required

__is_ascii_underline_numbers(input_str) staticmethod

check if a string contains only ascii signs underlines and numbers

Parameters:

Name Type Description Default
input_str str

input string to check

required

Returns:

Type Description
bool

underline numbers: True/False

add_entry(val_number, val_str)

Creates an string table entry

Parameters:

Name Type Description Default
val_number str

index number in the list

required
val_str str

string value

required

Returns:

Type Description
bool

True for success

bool

False if number already exists

get_entry(str_val_number)

Returns a string table entry

Parameters:

Name Type Description Default
str_val_number Union[str, int]

value or number of the string

required

Returns:

Type Description
Tuple[str, bool]

(string entry, True/False for success)

get_key(entry)

Returns the key for a string table entry

Parameters:

Name Type Description Default
entry str

entry to search corresponding key

required

Returns:

Type Description
Optional[str]

Key, None if not found

get_string(string_id, default_string)

Get a string from the table

Parameters:

Name Type Description Default
string_id str

String ID (if empty, take it from {...} part of the string

required
default_string str

Default string in case of no existing ID

required

Returns:

Type Description
str

String from the ID if exist, default string otherwise