當前位置: 首頁>>代碼示例>>Python>>正文


Python GenericLoader.end_group方法代碼示例

本文整理匯總了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
開發者ID:,項目名稱:,代碼行數:52,代碼來源:

示例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
開發者ID:,項目名稱:,代碼行數:20,代碼來源:


注:本文中的app.io.load.GenericLoader.end_group方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。