def getProperties(self,recur=1): """Returns a list of all properties which can be edited and which are not marked as private. This may include 'child widgets' or 'primitive shapes'. You are free to override this and provide alternative implementations; the default one simply returns everything without a leading underscore. """ from reportlab.lib.validators import isValidChild # TODO when we need it, but not before - # expose sequence contents? props = {} for name in self.__dict__.keys(): if name[0:1] <> '_': component = getattr(self, name) if recur and isValidChild(component): # child object, get its properties too childProps = component.getProperties(recur=recur) for (childKey, childValue) in childProps.items(): #key might be something indexed like '[2].fillColor' #or simple like 'fillColor'; in the former case we #don't need a '.' between me and my child. if childKey[0] == '[': props['%s%s' % (name, childKey)] = childValue else: props['%s.%s' % (name, childKey)] = childValue else: props[name] = component return props
def getProperties(self,recur=1): """Returns a list of all properties which can be edited and which are not marked as private. This may include 'child widgets' or 'primitive shapes'. You are free to override this and provide alternative implementations; the default one simply returns everything without a leading underscore. """ from reportlab.lib.validators import isValidChild # TODO when we need it, but not before - # expose sequence contents? props = {} for name in self.__dict__.keys(): if name[0:1] != '_': component = getattr(self, name) if recur and isValidChild(component): # child object, get its properties too childProps = component.getProperties(recur=recur) for (childKey, childValue) in childProps.items(): #key might be something indexed like '[2].fillColor' #or simple like 'fillColor'; in the former case we #don't need a '.' between me and my child. if childKey[0] == '[': props['%s%s' % (name, childKey)] = childValue else: props['%s.%s' % (name, childKey)] = childValue else: props[name] = component return props
def add(self, node, name=None): """Appends non-None child node to the 'contents' attribute. In addition, if a name is provided, it is subsequently accessible by name """ # propagates properties down if node is not None: assert isValidChild(node), "Can only add Shape or UserNode objects to a Group" self.contents.append(node) self._addNamedNode(name,node)