def __init__(self, worksheet, model, projectedContents=None):
		super( TextSpanEditor, self ).__init__( worksheet, model )
		spanAttrs = RichTextAttributes()
		for a in model['styleAttrs']:
			spanAttrs.putOverride(a['name'], a['value'])
		if projectedContents is None:
			projectedContents = self._computeText()
		self._editorModel = WSEditor.RichTextController.WorksheetRichTextController.instance.editorModelSpan( projectedContents, spanAttrs )
	def __init__(self, worksheet, blockEditor):
		super( BlankParagraphEditor, self ).__init__( worksheet, None )
		self._style = 'normal'
		paraAttrs = RichTextAttributes.fromValues({ 'style' : self._style }, None)
		self._editorModel = WSEditor.RichTextController.WorksheetRichTextController.instance.editorModelParagraph( None, [ '' ], paraAttrs )
		self._incr = IncrementalValueMonitor()
		self._blockEditor = blockEditor
예제 #3
0
    def __init__(self, projection_table, block):
        super(_TempBlankPara, self).__init__(projection_table, None)

        self._block = block
        self._style = 'normal'
        self._incr = IncrementalValueMonitor()
        para_attrs = RichTextAttributes.fromValues({'style': self._style},
                                                   None)
        self._editorModel = controller.MallardRichTextController.instance.editorModelParagraph(
            [], para_attrs)
예제 #4
0
    def __init__(self, projection_table, elem, contents=None, span_attrs=None):
        super(Style, self).__init__(projection_table, elem, contents)
        if span_attrs is None:
            span_attrs = RichTextAttributes()
            sa = StyleAttribute.tag_name_to_attr.get(elem.tag)
            if sa is not None:
                sa.store_value_from_element(span_attrs, elem)

        self._editorModel = controller.MallardRichTextController.instance.editorModelSpan(
            [], span_attrs)
        self.setStyleAttrs(span_attrs)
예제 #5
0
    def __init__(self, projection_table, elem, contents=None, attrs=None):
        super(Para, self).__init__(projection_table, elem, contents)
        style = None
        if attrs is not None:
            style = attrs.getValue('style', 0)
        style = style if style is not None else 'normal'
        self._style = style

        para_attrs = RichTextAttributes.fromValues({'style': self._style},
                                                   None)

        self._editorModel = controller.MallardRichTextController.instance.editorModelParagraph(
            self, [], para_attrs)
	def _styleAttrsChanged(self, field, oldValue, newValue):
		self._styleSheet = self._mapStyles(newValue)
		if self._editorModel is not None:
			self._editorModel.setSpanAttrs(RichTextAttributes.fromValues(newValue, None))
	def __init__(self, block):
		super(_TempBlankPara, self).__init__()
		
		self._block = block
		paraAttrs = RichTextAttributes.fromValues({'style':'normal'}, None)
		self._editorModel = GUIRichTextController.instance.editorModelParagraph(None, [], paraAttrs)
	def __init__(self, contents, style=None):
		super(Para, self).__init__(contents)
		style = style   if style is not None   else 'normal'
		paraAttrs = RichTextAttributes.fromValues({'style':style}, None)
		self._editorModel = GUIRichTextController.instance.editorModelParagraph(self, contents, paraAttrs)
		self._style.value = style
	def _style_changed(self, field, oldValue, newValue):
		paraAttrs = RichTextAttributes.fromValues({'style':newValue}, None)
		self._editorModel.setParaAttrs(paraAttrs)
	def __init__(self, worksheet, model, projectedContents=None):
		super( ParagraphEditor, self ).__init__( worksheet, model )
		if projectedContents is None:
			projectedContents = self._computeText()
		paraAttrs = RichTextAttributes.fromValues({'style': model['style']}, None)
		self._editorModel = WSEditor.RichTextController.WorksheetRichTextController.instance.editorModelParagraph( self, projectedContents, paraAttrs )
예제 #11
0
		def computeStyleValues(listOfSpanAttrs):
			value = listOfSpanAttrs[0].getValue(attrName, 0)
			value = not value
			attrs = RichTextAttributes()
			attrs.putOverride(attrName, value)
			return attrs
예제 #12
0
 def _span_attrs(elem_tag_and_attrs):
     return RichTextAttributes.fromValues(None,
                                          {XML_ELEM: [elem_tag_and_attrs]})
	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 setStyle(self, style):
		self._model['style'] = style
		paraAttrs = RichTextAttributes.fromValues({'style': style}, None)
		self._editorModel.setParaAttrs(paraAttrs)
	def __init__(self, contents, styleAttrs):
		super(Style, self).__init__(contents)
		self._styleSheet = None
		self._styleAttrs.value = {}
		self._editorModel = GUIRichTextController.instance.editorModelSpan(contents, RichTextAttributes.fromValues(styleAttrs, None))
		self.styleAttrs = styleAttrs
		def computeStyleValues(listOfSpanAttrs):
			value = bool(listOfSpanAttrs[0].getValue(attrName, 0))
			value = not value
			attrs = RichTextAttributes()
			attrs.putOverride(attrName, '1'   if value   else None)
			return attrs
예제 #17
0
 def setStyle(self, style):
     self._style = style
     para_attrs = RichTextAttributes.fromValues({'style': self._style},
                                                None)
     self._editorModel.setParaAttrs(para_attrs)
     self._incr.onChanged()