MCPcopy Create free account
hub / github.com/PageBot/PageBot / getMetricsString

Method getMetricsString

Lib/pagebot/elements/element.py:899–919  ·  view source on GitHub ↗

Answers a single string with metrics info about the element. Default is to show the posiiton and size (in points and columns). This method can be redefined by inheriting elements that want to show additional information.

(self, view=None)

Source from the content-addressed store, hash-verified

897 # D R A W I N G S U P P O R T
898
899 def getMetricsString(self, view=None):
900 """Answers a single string with metrics info about the element. Default
901 is to show the posiiton and size (in points and columns). This method
902 can be redefined by inheriting elements that want to show additional
903 information."""
904 s = '%s\nPosition: x=%s, y=%s, z=%s\nSize: w=%s, h=%s' % \
905 (self.__class__.__name__ + ' ' + (self.name or ''), self.x, self.y,
906 self.z, self.w, self.h)
907 if self.xAlign or self.yAlign:
908 s += '\nAlign: %s, %s' % (self.xAlign, self.yAlign)
909 if self.conditions:
910 if view is None and self.doc is not None:
911 view = self.doc.view
912 if view is not None:
913 score = self.evaluate(view)
914 s += '\nConditions: %d | Evaluate %d' % (len(self.conditions), score.result)
915 if score.fails:
916 s += ' Fails: %d' % len(score.fails)
917 for eFail in score.fails:
918 s += '\n%s %s' % eFail
919 return s
920
921 def buildFrame(self, view, p):
922 """Draws optional frame or borders to display element space. self.fill

Callers

nothing calls this directly

Calls 1

evaluateMethod · 0.95

Tested by

no test coverage detected