Ejemplo n.º 1
0
 def __present__(self, fragment, inheritedState):
     self._incr.onAccess()
     p = RichSpan(list(self.contents_query))
     for f in self._style_functions:
         p = f(p)
     p = controller.MallardRichTextController.instance.editableSpan(self, p)
     return p
Ejemplo n.º 2
0
 def __present__(self, fragment, inheritedState):
     self._incr.onAccess()
     open_tag = self._tag_border.surround(
         self._open_tag_style(Label(self._elem_tag_and_attrs.tag)))
     close_tag = self._tag_border.surround(
         self._close_tag_style(Label('/' + self._elem_tag_and_attrs.tag)))
     x = RichSpan([open_tag] + list(self.contents_query) + [close_tag])
     x = controller.MallardRichTextController.instance.editableSpan(self, x)
     return x
Ejemplo n.º 3
0
	def __present__(self , fragment, inherited_state):
		title = TitleBarWithSubtitle('Mallard editor', 'development prototype - SAVE FUNCTIONALITY NOT IMPLEMENTED')
		path_heading = SectionHeading2(['Displaying contents of: ', _dir_style(RichSpan(self.__path))])

		links = [Hyperlink(p.filename, editor_page.EditorPageSubject(p, fragment.subject))   for p in self._pages]

		if self._example_pages is not None:
			examples_heading = SectionHeading2('Example mallard documents:')
			example_links = [Hyperlink(p.filename, editor_page.EditorPageSubject(p, fragment.subject))   for p in self._example_pages]
			examples_section = [Spacer(0.0, 20.0), examples_heading, Column(example_links)]
		else:
			examples_section = []

		return _page_style(Page([title, path_heading, Column(links)] + examples_section))
Ejemplo n.º 4
0
    def __present__(self, fragment, inh):
        space = Label(' ')
        open_angle = self._punc_style.applyTo(Label('<'))
        close_angle = self._punc_style.applyTo(Label('>'))
        slash = self._punc_style.applyTo(Label('/'))
        tag = self._tag_style.applyTo(Label(self.__tag))
        br = LineBreak()

        complex = False
        for x in self.__contents:
            if isinstance(x, XmlElem):
                complex = True
                break

        if complex:
            end = Row([open_angle, slash, tag, close_angle])
            content = Column(
                [NormalText([x]) for x in self.__contents if x != ''])
            if len(self.__attrs) == 0:
                start = Row([open_angle, tag, close_angle])
            else:
                start = Paragraph(
                    [open_angle, tag, space, br, self.__attrs, close_angle])
            return Column([start, content.padX(20.0, 0.0), end])
        else:
            if len(self.__contents) == 0:
                if len(self.__attrs) == 0:
                    return Row([open_angle, tag, slash, close_angle])
                else:
                    return Paragraph([
                        open_angle, tag, space, br, self.__attrs, slash,
                        close_angle
                    ])
            else:
                end = Row([open_angle, slash, tag, close_angle])
                content = [RichSpan([x]) for x in self.__contents]
                if len(self.__attrs) == 0:
                    start = Row([open_angle, tag, close_angle])
                else:
                    start = Span([
                        open_angle, tag, space, br, self.__attrs, close_angle
                    ])
                return Paragraph([start] + content + [end])
	def __present__(self, fragment, inheritedState):
		x = self._styleSheet.applyTo(RichSpan(self._contents.value[:]))
		x = GUIRichTextController.instance.editableSpan(self, x)
		return x
Ejemplo n.º 6
0
 def TextSpan(self, fragment, inheritedState, node):
     text = node.getText()
     styleSheet = node.getStyleSheet()
     return styleSheet.applyTo(RichSpan(text))
Ejemplo n.º 7
0
def apply_cmd_style(p):
    prompt = _cmd_prompt_style.applyTo(Label('$ '))
    return _cmd_style.applyTo(RichSpan([prompt, p]))