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

Method drawFrame

Lib/pagebot/elements/views/mapview.py:225–249  ·  view source on GitHub ↗

Draws the page frame if the the flag is on and if there is enough padding to show other meta info. Otherwise the padding is truncated to 0: no use to draw the frame. >>> from pagebot import getContext >>> context = getContext() >>> from pagebot.elements.eleme

(self, e, origin)

Source from the content-addressed store, hash-verified

223 self.drawFlowConnections(page, origin)
224
225 def drawFrame(self, e, origin):
226 """Draws the page frame if the the flag is on and if there is enough
227 padding to show other meta info. Otherwise the padding is truncated to
228 0: no use to draw the frame.
229
230 >>> from pagebot import getContext
231 >>> context = getContext()
232 >>> from pagebot.elements.element import Element
233 >>> from pagebot.style import getRootStyle
234 >>> from pagebot.elements.views.pageview import PageView
235 >>> # Get default values.
236 >>> style = getRootStyle()
237 >>> # Works on generic elements as well as pages.
238 >>> e = Element(style=style)
239 >>> view = PageView(context=context, style=style)
240 >>> view.showFrame = True
241 >>> view.drawFrame(e, (0, 0))
242
243 """
244 if ((self.showFrame and e.isPage) or e.showFrame) and \
245 self.pl >= self.viewMinInfoPadding and self.pr >= self.viewMinInfoPadding and \
246 self.pt >= self.viewMinInfoPadding and self.pb >= self.viewMinInfoPadding:
247 self.context.fill(noColor)
248 self.context.stroke(color(0, 0, 1), pt(0.5))
249 self.context.rect(origin[0], origin[1], e.w, e.h)
250
251 def drawPadding(self, e, origin):
252 """Draw the page frame of its current padding.

Callers 2

drawPageMetaInfoMethod · 0.95
buildMethod · 0.45

Calls 5

colorFunction · 0.90
ptFunction · 0.90
fillMethod · 0.45
strokeMethod · 0.45
rectMethod · 0.45

Tested by

no test coverage detected