Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmudge authored and looooo committed Nov 24, 2021
1 parent 15f3f24 commit 89e99be
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion freecad/gears/features.py
Expand Up @@ -56,20 +56,29 @@ class ViewProviderGear(object):
def __init__(self, obj, icon_fn=None):
''' Set this object to the proxy object of the actual view provider '''
obj.Proxy = self
self._check_attr()
dirname = os.path.dirname(__file__)
self.icon_fn = icon_fn or os.path.join(dirname, "icons", "involutegear.svg")

def _check_attr(self):
''' Check for missing attributes. '''
if not hasattr(self, "icon_fn"):
setattr(self, "icon_fn", os.path.join(os.path.dirname(__file__), "icons", "involutegear.svg"))

def attach(self, vobj):
self.vobj = vobj

def getIcon(self):
self._check_attr()
return self.icon_fn

def __getstate__(self):
self._check_attr()
return {"icon_fn": self.icon_fn}

def __setstate__(self, state):
self.icon_fn = state["icon_fn"]
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]

class BaseGear(object):
def __init__(self, obj):
Expand Down

0 comments on commit 89e99be

Please sign in to comment.