Ejemplo n.º 1
0
 def show_rich_text(self, text, collapse=False, img_path=''):
     """Show text in rich mode"""
     self.switch_to_plugin()
     self.switch_to_rich_text()
     context = generate_context(collapse=collapse, img_path=img_path,
                                css_path=self.css_path)
     self.render_sphinx_doc(text, context)
Ejemplo n.º 2
0
 def run(self):
     html_text = self.html_text_no_doc
     doc = self.doc
     if doc is not None:
         if type(doc) is dict and 'docstring' in doc.keys():
             try:
                 context = generate_context(name=doc['name'],
                                            argspec=doc['argspec'],
                                            note=doc['note'],
                                            math=self.math_option,
                                            img_path=self.img_path)
                 html_text = sphinxify(doc['docstring'], context)
                 if doc['docstring'] == '':
                     if any([doc['name'], doc['argspec'], doc['note']]):
                         msg = _("No further documentation available")
                         html_text += '<div class="hr"></div>'
                     else:
                         msg = _("No documentation available")
                     html_text += '<div id="doc-warning">%s</div>' % msg
             except Exception as error:
                 self.error_msg.emit(to_text_string(error))
                 return
         elif self.context is not None:
             try:
                 html_text = sphinxify(doc, self.context)
             except Exception as error:
                 self.error_msg.emit(to_text_string(error))
                 return
     self.html_ready.emit(html_text)
Ejemplo n.º 3
0
 def run(self):
     html_text = self.html_text_no_doc
     doc = self.doc
     if doc is not None:
         if type(doc) is dict and 'docstring' in doc.keys():
             try:
                 context = generate_context(name=doc['name'],
                                            argspec=doc['argspec'],
                                            note=doc['note'],
                                            math=self.math_option,
                                            img_path=self.img_path,
                                            css_path=self.css_path)
                 html_text = sphinxify(doc['docstring'], context)
                 if doc['docstring'] == '':
                     if any([doc['name'], doc['argspec'], doc['note']]):
                         msg = _("No further documentation available")
                         html_text += '<div class="hr"></div>'
                     else:
                         msg = _("No documentation available")
                     html_text += '<div id="doc-warning">%s</div>' % msg
             except Exception as error:
                 self.error_msg.emit(to_text_string(error))
                 return
         elif self.context is not None:
             try:
                 html_text = sphinxify(doc, self.context)
             except Exception as error:
                 self.error_msg.emit(to_text_string(error))
                 return
     self.html_ready.emit(html_text)
Ejemplo n.º 4
0
 def show_rich_text(self, text, collapse=False, img_path=''):
     """Show text in rich mode"""
     self.visibility_changed(True)
     self.raise_()
     self.switch_to_rich_text()
     context = generate_context(collapse=collapse, img_path=img_path)
     self.render_sphinx_doc(text, context)
Ejemplo n.º 5
0
 def show_rich_text(self, text, collapse=False, img_path=''):
     """Show text in rich mode"""
     self.switch_to_plugin()
     self.switch_to_rich_text()
     context = generate_context(collapse=collapse, img_path=img_path,
                                css_path=self.css_path)
     self.render_sphinx_doc(text, context)
Ejemplo n.º 6
0
    def show_rich_text(self, text, collapse=False, img_path=''):
        """
        Show text in rich mode.

        Parameters
        ----------
        text: str
            Plain text to display.
        collapse: bool, optional
            Show collapsable sections as collapsed/expanded. Default is False.
        img_path: str, optional
            Path to folder with additional images needed to correctly
            display the rich text help. Default is ''.
        """
        self.switch_to_rich_text()
        context = generate_context(collapse=collapse, img_path=img_path,
                                   css_path=self.css_path)
        self.render_sphinx_doc(text, context)