Add string representation for debugging

My IDE shows the str(inst) representation of an object when indicating what value is in there. This makes it easier to find stuff. It'll also make debug prints more clear than the default <XmlMaterialProfile.XmlMaterialProfile.XmlMaterialProfile object at 0x12345678> stuff of Python.

Contributes to issue CURA-4243.
This commit is contained in:
Ghostkeeper 2017-11-27 14:19:30 +01:00
parent 99780c3b44
commit 54a12d14c4
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -834,6 +834,10 @@ class XmlMaterialProfile(InstanceContainer):
def _parseCompatibleValue(cls, value: str):
return value in {"yes", "unknown"}
## Small string representation for debugging.
def __str__(self):
return "<XmlMaterialProfile '{my_id}' ('{name}') from base file '{base_file}'>".format(my_id = self.getId(), name = self.getName(), base_file = self.getMetaDataEntry("base_file"))
# Map XML file setting names to internal names
__material_settings_setting_map = {
"print temperature": "default_material_print_temperature",