BuildingElementStringTable¶
To get access to the string resources, the BuildingElementStringTable class must be used.
-
class BuildingElementStringTable.BuildingElementStringTable(path: str,
                                                             numeric: bool,
                                                             lang: str)¶ Bases:
BuildingElementStringTableBase
Definition of class StringTable
-
__init__(path: str,
         numeric: bool,
         lang: str)¶ Initialization of class StringTable
- Parameters
path – path of according .py file. The file name will be set internally to _xyz.xml
numeric – the string table will be created only from numeric (123..) text ids or not numeric text ids (e_THE_VALUE)
lang – language shortcut
-
add_entry(val_number: str,
          val_str: str)¶ Creates an string table entry
- Parameters
val_number – index number in the list
val_str – string value
- Returns
True for success False if number already exists
- get_entry(str_val_number: str) Tuple[str, bool] ¶
Returns a string table entry
- Parameters
str_val_number – value or number of the string
- Returns
(string entry, True/False for success)
- get_key(entry: str) Optional[str] ¶
Returns the key for a string table entry
- Parameters
entry – entry to search corresponding key
- Returns
Key, None if not found
-
get_string(string_id: str,
           default_string: str)¶ Get a string from the table
- Parameters
string_id – String ID (if empty, take it from {…} part of the string
default_string – Default string in case of no existing ID
- Returns
String from the ID if exist, default string otherwise
- __module__ = 'BuildingElementStringTable'¶
-
__init__(path: str,