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

Method overflow2Next

Lib/pagebot/elements/table.py:127–149  ·  view source on GitHub ↗

Try to fix if there is overflow.

(self)

Source from the content-addressed store, hash-verified

125 return self.nextElement is None or not self.getOverflow()
126
127 def overflow2Next(self):
128 """Try to fix if there is overflow."""
129 result = True
130 overflow = self.getOverflow()
131 if overflow and self.nextElement: # If there is text overflow and there is a next element?
132 result = False
133 # Find the page of self
134 page = self.getElementPage()
135 if page is not None:
136 # Try next page
137 nextElement = page.getElementByName(self.nextElement) # Optional search next page too.
138 if nextElement is None or nextElement.fs and self.nextPage:
139 # Not found or not empty, search on next page.
140 page = self.doc.getPage(self.nextPage)
141 nextElement = page.getElementByName(self.nextElement)
142 if nextElement is not None and not nextElement.bs:
143 # Finally found one empty box on this page or next page?
144 nextElement.fs = overflow
145 nextElement.prevPage = page.name
146 nextElement.prevElement = self.name # Remember the back link
147 score = nextElement.solve() # Solve any overflow on the next element.
148 result = not score.fails # Test if total flow placement succeeded.
149 return result
150
151 # D R A W B O T / F L A T S U P P O R T
152

Callers

nothing calls this directly

Calls 5

getOverflowMethod · 0.95
getElementByNameMethod · 0.80
getPageMethod · 0.80
getElementPageMethod · 0.45
solveMethod · 0.45

Tested by

no test coverage detected