コード例 #1
0
ファイル: inspector.py プロジェクト: CVML/spyder
    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)
コード例 #2
0
ファイル: inspector.py プロジェクト: CVML/spyder
 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)
コード例 #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)
コード例 #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)
                    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)
コード例 #5
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))
コード例 #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)
コード例 #7
0
ファイル: inspector.py プロジェクト: Poneyo/spyderlib
 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)
コード例 #8
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)