From 54a12d14c48ffd847b855981d20cee0e5132ce46 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 27 Nov 2017 14:19:30 +0100 Subject: [PATCH] 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 stuff of Python. Contributes to issue CURA-4243. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index ead0864d6f..23d4ed3860 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -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 "".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",