Exemplo n.º 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)
Exemplo 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)
                    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.emit(SIGNAL('error_msg(QString)'),
                              to_text_string(error))
                    return
            elif self.context is not None:
                try:
                    html_text = sphinxify(doc, self.context)
                except Exception as error:
                    self.emit(SIGNAL('error_msg(QString)'),
                              to_text_string(error))
                    return
        self.emit(SIGNAL('html_ready(QString)'), html_text)
Exemplo 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() and doc["docstring"] != "":
             try:
                 context = generate_context(
                     name=doc["name"], argspec=doc["argspec"], note=doc["note"], math=self.math_option
                 )
                 html_text = sphinxify(doc["docstring"], context)
             except Exception as error:
                 self.emit(SIGNAL("error_msg(QString)"), to_text_string(error))
                 return
         elif self.context is not None:
             try:
                 html_text = sphinxify(doc, self.context)
             except Exception as error:
                 self.emit(SIGNAL("error_msg(QString)"), to_text_string(error))
                 return
     self.emit(SIGNAL("html_ready(QString)"), html_text)
Exemplo n.º 4
0
 def _show_rich_help(self, text):
     """Use our Object Inspector to show IPython help texts in rich mode"""
     from spyderlib.utils.inspector import sphinxify as spx
     
     context = spx.generate_context(name='', argspec='', note='',
                                    math=False)
     html_text = spx.sphinxify(text, context)
     inspector = self.inspector
     inspector.visibility_changed(True)
     inspector.raise_()
     inspector.switch_to_rich_text()
     inspector.set_rich_text_html(html_text,
                                  QUrl.fromLocalFile(spx.CSS_PATH))
Exemplo n.º 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() \
           and doc['docstring'] != '':
             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)
             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)
Exemplo n.º 6
0
 def run(self):
     html_text = self.html_text_no_doc
     doc = self.doc
     if doc is not None and doc['docstring'] != '':
         try:
             context = generate_context(name=doc['name'],
                                        argspec=doc['argspec'],
                                        note=doc['note'],
                                        math=self.math_option)
             html_text = sphinxify(doc['docstring'], context)
         except Exception as error:
             self.emit(SIGNAL('error_msg(QString)'),
                       to_text_string(error))
             return
     self.emit(SIGNAL('html_ready(QString)'), html_text)