本文整理匯總了Python中plot.Plot.set_graphic方法的典型用法代碼示例。如果您正苦於以下問題:Python Plot.set_graphic方法的具體用法?Python Plot.set_graphic怎麽用?Python Plot.set_graphic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plot.Plot
的用法示例。
在下文中一共展示了Plot.set_graphic方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: set_source
# 需要導入模塊: from plot import Plot [as 別名]
# 或者: from plot.Plot import set_graphic [as 別名]
def set_source(self,source,nodes=None):
"""
Handles opening a new file. Creates a plot with the given source
file. Uses input plugins to convert file to SVG. This disregards
all previous settings, thus ui_updates should be called.
"""
height = self.material.length and self.material.length*UNITS[self.units] or None
p = Plot(width=self.material.width*UNITS[self.units],height=height,color=self.material.color)
m = self.material.margin
p.set_padding(top=m[0],right=m[1],bottom=m[2],left=m[3])
if type(source) == etree._ElementTree:
try:
# If certain nodes are selected, only plot them.
if nodes:
xml = etree.tostring(get_selected_nodes(source,nodes))
else:
xml = etree.tostring(source)
# Set a job name if none exists
if self.name is None:
self.name = "*inkscape.svg"
# Try to make a plot
p.set_graphic(xml)
self.plot = p
except (IOError,etree.XMLSyntaxError),trace:
log.debug(trace)
raise Exception("Failed to create plot. Reason: Failed to import the Inkscape file.")
示例2: process
# 需要導入模塊: from plot import Plot [as 別名]
# 或者: from plot.Plot import set_graphic [as 別名]
def process(self):
"""
Converts the source svg to data svg using job requirements.
"""
req = self.requirements
plot = Plot(material)
plot.set_graphic(self.source)
plot.set_selected_nodes(req.plot_selected_nodes)
plot.set_margin(req.plot_margin_top,req.plot_margin_right,req.plot_margin_bottom,req.plot_margin_left)
plot.set_scale(req.scale_x*(invert_axis_x and 1 or -1),req.scale_y*(invert_axis_y and 1 or -1))
plot.set_copy_spacing(req.copy_spacing_x,req.copy_spacing_y)
plot.set_copies(req.copies)
plot.create()
self.data = self.source