Beispiel #1
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'] == '':
                        html_text += '<div class="hr"></div>'
                        html_text += self.html_text_no_doc

                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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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'] == '' and \
                   any([doc['name'], doc['argspec'], doc['note']]):
                     msg = _("No further documentation available")
                     html_text += '<div class="hr"></div>'
                     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)
Beispiel #5
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'] == '' and \
                   any([doc['name'], doc['argspec'], doc['note']]):
                     msg = _("No further documentation available")
                     html_text += '<div class="hr"></div>'
                     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)
Beispiel #6
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'] == '':
                        html_text += '<div class="hr"></div>'
                        html_text += self.html_text_no_doc

                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)
Beispiel #7
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)
     self.render_sphinx_doc(text, context)