FEM: base Python VP, extend to get the icon without hard coded name

This commit is contained in:
Bernd Hahnebach
2020-03-06 17:50:41 +01:00
parent f4f5d7b085
commit 5829fc4f4a

View File

@@ -45,6 +45,12 @@ class ViewProxy(object):
def __init__(self, vobj):
vobj.Proxy = self
# needs to be overwritten, if no standard icon name is used
def getIcon(self):
"""after load from FCStd file, self.icon does not exist, return constant path instead"""
file_name = self.Object.Proxy.Type.replace("Fem::", "FEM_")
return ":/icons/{}.svg".format(file_name)
def attach(self, vobj):
default = coin.SoGroup()
vobj.addDisplayMode(default, "Default")