[docs]class Visible:
[docs] def isVisible(self):
"""Check if this instance is visible."""
return True
[docs] def getPath(self):
"""Return the path of this instance."""
return None
[docs] def getVisiblePath(self):
"""Return the visible path of this instance."""
return self.getPath()
[docs] def setDepth(self, depth):
"""Set the depth at which this instance lives."""
self.depth = depth
return self
[docs] def getDepth(self):
"""Return the depth at which this instance lives."""
if "depth" in self.__dict__:
return self.depth
else:
return None
def __cmp__(self, other):
"""Compare with another visible class, just using layers."""
if other is None:
return -1
if config.getOptions().DEBUG:
print(
"Comparing visible classes: ",
self.__class__,
"->",
self.getDepth(),
"vs.",
other.__class__,
"->",
other.getDepth(),
)
else:
return cmp(self.getDepth(), other.getDepth())