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
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)
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 __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 _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 setStyle(self, style): self._style = style para_attrs = RichTextAttributes.fromValues({'style': self._style}, None) self._editorModel.setParaAttrs(para_attrs) self._incr.onChanged()
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, 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 )