本文整理汇总了Python中app.io.load.GenericLoader.end_group方法的典型用法代码示例。如果您正苦于以下问题:Python GenericLoader.end_group方法的具体用法?Python GenericLoader.end_group怎么用?Python GenericLoader.end_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.io.load.GenericLoader
的用法示例。
在下文中一共展示了GenericLoader.end_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: end_text
# 需要导入模块: from app.io.load import GenericLoader [as 别名]
# 或者: from app.io.load.GenericLoader import end_group [as 别名]
def end_text(self):
# we don't support area text (text_type 1) at all. Return
# immediately in that case.
if self.text_type == 1:
return
# first, turn the text accumulated in the list text_string into
# a single string and unify line endings to newline characters.
text = string.join(self.text_string, '')
text = string.replace(text, '\r\n', '\n')
text = string.replace(text, '\r', '\n')
# remove a trailing newline. Many Illustrator files contain a
# trailing newline as 'overflow' text, there's probably a better
# way to deal with this...
if text[-1:] == "\n":
text = text[:-1]
# Re-encode to Latin1
text = self.text_font.Reencode(text)
if not string.strip(text):
if self.text_type == 2:
self.end_composite()
del self.composite_items[-1]
if len(self.composite_items) > 0:
self.object = self.composite_items[-1]
return
# first create a simple text object
self.fs()
self.style.font = GetFont(self.text_font.psname)
self.style.font_size = self.text_size
self.simple_text(text, self.text_trafo,
halign = _ai_text_align[self.text_align])
# if we're actually supposed to create a path-text object, turn
# the text object just created into a path-text object
if self.text_type == 2:
GenericLoader.end_group(self)
group = self.pop_last()
objects = group.GetObjects()
if len(objects) == 2:
path, text = objects
self.append_object(PathText(text, path,
start_pos = self.text_start_pos))
#self.composite_items[-1] = self.object
# we've finished the text object
self.in_text = 0
示例2: end_group
# 需要导入模块: from app.io.load import GenericLoader [as 别名]
# 或者: from app.io.load.GenericLoader import end_group [as 别名]
def end_group(self):
if self.compound_path is None:
# a normal group
if self.composite_class == Layer:
self.end_composite()
else:
try:
GenericLoader.end_group(self)
if self.flatten_groups:
if self.object.NumObjects() == 1:
obj = self.object.GetObjects()[0]
del self.composite_items[-1]
self.append_object(obj)
except EmptyCompositeError:
pass
else:
# a `compound group'. Ignored since Sketch doesn't have this.
pass