def newParagraphEmbeddedObjectModel(value):
		embeddedValue = DMNode.embedIsolated( value )
		return Schema.ParagraphEmbeddedObject( embeddedValue=embeddedValue )
Exemplo n.º 2
0
def newWorksheet():
	return Schema.Worksheet( body=Schema.Body( contents=[] ) )
	def newInlinePythonCodeModel():
		return Schema.InlinePythonCode( style='minimal_result', expr=_py25NewExpr() )
	def newInlineEmbeddedObjectModel(value):
		embeddedValue = DMNode.embedIsolated( value )
		return Schema.InlineEmbeddedObject( embeddedValue=embeddedValue )
	def newLinkModel(text, relativePath):
		return Schema.Link( text=text, path=relativePath )
	def newPythonCodeModel():
		return Schema.PythonCode( style='code_result', code=_py25NewModule() )
	def copy(self, worksheet=None):
		model = Schema.Link( text=self._model['text'], path=self._model['path'] )
		return LinkEditor( worksheet, model )
	def newTextSpanModel(text, styleAttrs):
		return Schema.TextSpan( text=text, styleAttrs=styleAttrs )
	def newTextSpan(contents, styleMap):
		styleAttrs = [ Schema.StyleAttr( name=n, value=v )   for n, v in styleMap.items()   if v is not None ]
		m = TextSpanEditor.newTextSpanModel( ParagraphEditor._textToModel( contents ), styleAttrs )
		return TextSpanEditor( None, m, contents )
	def setStyleAttrs(self, styleMap):
		spanAttrs = RichTextAttributes.fromValues({n: v   for n, v in styleMap.items()}, None)
		modelAttrs = [ Schema.StyleAttr( name=n, value=v )   for n, v in styleMap.items() ]

		self._model['styleAttrs'] = modelAttrs
		self._editorModel.setSpanAttrs( spanAttrs )
	def newParagraphModel(text, style):
		return Schema.Paragraph( text=text, style=style )