def prop_layer(self, prop):
		# return property layer containing PROP
		for item in self.stack:
			if hasattr(item, prop):
				return item
		# we should never reach this...
		raise SketchInternalError('unknown graphics property "%s"' % prop)
Example #2
0
 def RemoveObjects(self, infolist):
     if not infolist:
         return NullUndo
     sliced = selinfo.list_to_tree_sliced(infolist)
     sliced.reverse()
     undo = [self.begin_change_children()]
     try:
         for start, end in sliced:
             if type(end) == IntType:
                 # > 1 adjacent children of self. XXX implement this
                 raise SketchInternalError('Deletion of multiple objects'
                                           ' of BlendGroups not yet'
                                           ' implemented')
             elif type(end) == ListType:
                 # remove grandchildren (children of child of self)
                 if start % 2 == 0:
                     # control object changes. This should result in
                     # a recompute() automatically.
                     undo.append(self.objects[start].RemoveObjects(end))
                 else:
                     pass
             else:
                 # a single child. If it's one of our control
                 # objects, remove self
                 undo.append(self.do_remove_child(start))
         undo.append(self.end_change_children())
         return CreateListUndo(undo)
     except:
         Undo(CreateListUndo(undo))
         raise
Example #3
0
def read_outlines(ps_name):
	filename = font_file_name(ps_name)
	if filename:
		if __debug__:
			pdebug('font', 'read_outlines: %s', filename)

		import app.Lib.type1
		return app.Lib.type1.read_outlines(filename)
	else:
		raise SketchInternalError('Cannot find file for font %s' % ps_name)
Example #4
0
	def end_transaction(self):
		self.transaction = self.transaction - 1
		if self.transaction == 0:
			if self.doc_changed:
				self.issue(DOCUMENT, self.document)
			self.sb_update_pending = 0
			self.doc_changed = 0
			self.flush_message_queue()
		elif self.transaction < 0:
			raise SketchInternalError('transaction count < 0')
Example #5
0
 def RemoveSlice(self, min, max):
     raise SketchInternalError('RemoveSlice not allowed for BlendGroup')