本文整理汇总了Python中reportlab.graphics.shapes.Drawing.shift方法的典型用法代码示例。如果您正苦于以下问题:Python Drawing.shift方法的具体用法?Python Drawing.shift怎么用?Python Drawing.shift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.shapes.Drawing
的用法示例。
在下文中一共展示了Drawing.shift方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _draw_label
# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import shift [as 别名]
def _draw_label(self, drawing_callable, obj=None):
"""Helper method to draw on the current label. Not intended for external use.
"""
# Create a drawing object for this label and add the border.
label = Drawing(float(self._lw), float(self._lh))
label.add(self._border)
if self._border_visible:
label.add(self._border_visible)
# Call the drawing function.
drawing_callable(label, float(self._lw), float(self._lh), obj)
# Calculate the bottom edge of the label.
bottom = self.specs.sheet_height - self.specs.top_margin
bottom -= (self.specs.label_height * self._position[0])
bottom -= (self.specs.row_gap * (self._position[0] - 1))
bottom *= mm
# And the left edge.
left = self.specs.left_margin
left += (self.specs.label_width * (self._position[1] - 1))
left += (self.specs.column_gap * (self._position[1] - 1))
left *= mm
# Render the label on the sheet.
label.shift(float(left), float(bottom))
self._current_page.add(label)
示例2: _shade_missing_label
# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import shift [as 别名]
def _shade_missing_label(self):
"""Helper method to shade a missing label. Not intended for external use.
"""
# Start a drawing for the whole label.
label = Drawing(float(self._lw), float(self._lh))
label.add(self._clip_label)
# Fill with a rectangle; the clipping path will take care of the borders.
r = shapes.Rect(0, 0, float(self._lw), float(self._lh))
r.fillColor = self.shade_missing
r.strokeColor = None
label.add(r)
# Add the label to the page.
label.shift(*self._calculate_edges())
self._current_page.add(label)
示例3: _draw_label
# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import shift [as 别名]
def _draw_label(self, obj, count):
"""Helper method to draw on the current label. Not intended for external use.
"""
# Start a drawing for the whole label.
label = Drawing(float(self._lw), float(self._lh))
label.add(self._clip_label)
# And one for the available area (i.e., after padding).
available = Drawing(float(self._dw), float(self._dh))
available.add(self._clip_drawing)
# Call the drawing function.
self.drawing_callable(available, float(self._dw), float(self._dh), obj)
# Render the contents on the label.
available.shift(float(self._lp), float(self._bp))
label.add(available)
# Draw the border if requested.
if self.border:
label.add(self._border)
# Add however many copies we need to.
for i in range(count):
# Find the next available label.
self._next_unused_label()
# Have we been told to skip this page?
if self.pages_to_draw and self.page_count not in self.pages_to_draw:
continue
# Add the label to the page. ReportLab stores the added drawing by
# reference so we have to copy it N times.
thislabel = copy(label)
thislabel.shift(*self._calculate_edges())
self._current_page.add(thislabel)