Beispiel #1
0
 def _on_sphinx_thread_error_msg(self, error_msg):
     """ Display error message on Sphinx rich text failure"""
     self._sphinx_thread.wait()
     self.plain_text_action.setChecked(True)
     sphinx_ver = programs.get_module_version('sphinx')
     QMessageBox.critical(
         self, _('Help'),
         _("The following error occured when calling "
           "<b>Sphinx %s</b>. <br>Incompatible Sphinx "
           "version or doc string decoding failed."
           "<br><br>Error message:<br>%s") % (sphinx_ver, error_msg))
 def __init__(self, modname, features, required_version, installed_version=None):
     self.modname = modname
     self.features = features
     self.required_version = required_version
     if installed_version is None:
         try:
             self.installed_version = programs.get_module_version(modname)
         except ImportError:
             # Module is not installed
             self.installed_version = None
     else:
         self.installed_version = installed_version
Beispiel #3
0
 def _on_sphinx_thread_error_msg(self, error_msg):
     """ Display error message on Sphinx rich text failure"""
     self._sphinx_thread.wait()
     self.plain_text_action.setChecked(True)
     sphinx_ver = programs.get_module_version('sphinx')
     QMessageBox.critical(self,
                 _('Help'),
                 _("The following error occured when calling "
                   "<b>Sphinx %s</b>. <br>Incompatible Sphinx "
                   "version or doc string decoding failed."
                   "<br><br>Error message:<br>%s"
                   ) % (sphinx_ver, error_msg))
Beispiel #4
0
 def __init__(self, modname, features, required_version,
              installed_version=None):
     self.modname = modname
     self.features = features
     self.required_version = required_version
     if installed_version is None:
         try:
             self.installed_version = programs.get_module_version(modname)
         except ImportError:
             # Module is not installed
             self.installed_version = None
     else:
         self.installed_version = installed_version
Beispiel #5
0
 def __init__(self, modname, features, required_version,
              installed_version=None):
     self.modname = modname
     self.features = features
     self.required_version = required_version
     if installed_version is None:
         try:
             self.installed_version = programs.get_module_version(modname)
         except:
             # NOTE: Don't add any exception type here!
             # Modules can fail to import in several ways besides
             # ImportError
             self.installed_version = None
     else:
         self.installed_version = installed_version
Beispiel #6
0
from spyderlib.widgets.externalshell.pythonshell import ExtPythonShellWidget
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
from spyderlib.py3compat import to_text_string, get_meth_class_inst

#XXX: Hardcoded dependency on optional IPython plugin component
#     that requires the hack to make this work without IPython
if QTCONSOLE_INSTALLED:
    from spyderlib.widgets.ipython import IPythonControlWidget
else:
    IPythonControlWidget = None  # analysis:ignore

# Check if we can import Sphinx to activate rich text mode
try:
    from spyderlib.utils.help.sphinxify import (CSS_PATH, sphinxify, warning,
                                                generate_context, usage)
    sphinx_version = programs.get_module_version('sphinx')
except (ImportError, TypeError):
    sphinxify = sphinx_version = None  # analysis:ignore

# To add sphinx dependency to the Dependencies dialog
SPHINX_REQVER = '>=0.6.6'
dependencies.add("sphinx", _("Rich text help"),
                 required_version=SPHINX_REQVER)


class ObjectComboBox(EditableComboBox):
    """
    QComboBox handling object names
    """
    # Signals
    valid = Signal(bool, bool)
Beispiel #7
0
    def setup_page(self):
        # Connections group
        connections_group = QGroupBox(_("Automatic connections"))
        connections_label = QLabel(
            _("This pane can automatically "
              "show an object's help information after "
              "a left parenthesis is written next to it. "
              "Below you can decide to which plugin "
              "you want to connect it to turn on this "
              "feature."))
        connections_label.setWordWrap(True)
        editor_box = self.create_checkbox(_("Editor"), 'connect/editor')
        rope_installed = programs.is_module_installed('rope')
        jedi_installed = programs.is_module_installed('jedi', '>=0.8.1')
        editor_box.setEnabled(rope_installed or jedi_installed)
        if not rope_installed and not jedi_installed:
            editor_tip = _(
                "This feature requires the Rope or Jedi libraries.\n"
                "It seems you don't have either installed.")
            editor_box.setToolTip(editor_tip)
        python_box = self.create_checkbox(_("Python Console"),
                                          'connect/python_console')
        ipython_box = self.create_checkbox(_("IPython Console"),
                                           'connect/ipython_console')
        ipython_box.setEnabled(QTCONSOLE_INSTALLED)

        connections_layout = QVBoxLayout()
        connections_layout.addWidget(connections_label)
        connections_layout.addWidget(editor_box)
        connections_layout.addWidget(python_box)
        connections_layout.addWidget(ipython_box)
        connections_group.setLayout(connections_layout)

        # Features group
        features_group = QGroupBox(_("Additional features"))
        math_box = self.create_checkbox(_("Render mathematical equations"),
                                        'math')
        req_sphinx = programs.is_module_installed('sphinx', '>=1.1')
        math_box.setEnabled(req_sphinx)
        if not req_sphinx:
            sphinx_ver = programs.get_module_version('sphinx')
            sphinx_tip = _("This feature requires Sphinx 1.1 or superior.")
            sphinx_tip += "\n" + _(
                "Sphinx %s is currently installed.") % sphinx_ver
            math_box.setToolTip(sphinx_tip)

        features_layout = QVBoxLayout()
        features_layout.addWidget(math_box)
        features_group.setLayout(features_layout)

        # Source code group
        sourcecode_group = QGroupBox(_("Source code"))
        wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap')

        sourcecode_layout = QVBoxLayout()
        sourcecode_layout.addWidget(wrap_mode_box)
        sourcecode_group.setLayout(sourcecode_layout)

        # Final layout
        vlayout = QVBoxLayout()
        vlayout.addWidget(connections_group)
        vlayout.addWidget(features_group)
        vlayout.addWidget(sourcecode_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
Beispiel #8
0
from spyderlib.widgets.findreplace import FindReplace
from spyderlib.widgets.browser import WebView
from spyderlib.widgets.externalshell.pythonshell import ExtPythonShellWidget
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
from spyderlib.py3compat import to_text_string, get_meth_class_inst

#XXX: Hardcoded dependency on optional IPython plugin component
#     that requires the hack to make this work without IPython
if IPYTHON_QT_INSTALLED:
    from spyderlib.widgets.ipython import IPythonControlWidget
else:
    IPythonControlWidget = None  # analysis:ignore

# Check for Sphinx presence to activate rich text mode
if programs.is_module_installed('sphinx', '>=0.6.6'):
    sphinx_version = programs.get_module_version('sphinx')
    from spyderlib.utils.inspector.sphinxify import (CSS_PATH, sphinxify,
                                                     warning, generate_context,
                                                     usage)
else:
    sphinxify = sphinx_version = None  # analysis:ignore

# To add sphinx dependency to the Dependencies dialog
SPHINX_REQVER = '>=0.6.6'
dependencies.add("sphinx",
                 _("Rich text help on the Object Inspector"),
                 required_version=SPHINX_REQVER)


class ObjectComboBox(EditableComboBox):
    """
Beispiel #9
0
from spyderlib.widgets.externalshell.pythonshell import ExtPythonShellWidget
from spyderlib.plugins import SpyderPluginWidget, PluginConfigPage
from spyderlib.py3compat import to_text_string, get_meth_class_inst

# XXX: Hardcoded dependency on optional IPython plugin component
#     that requires the hack to make this work without IPython
if IPYTHON_QT_INSTALLED:
    from spyderlib.widgets.ipython import IPythonControlWidget
else:
    IPythonControlWidget = None  # analysis:ignore

# Check if we can import Sphinx to activate rich text mode
try:
    from spyderlib.utils.inspector.sphinxify import CSS_PATH, sphinxify, warning, generate_context, usage

    sphinx_version = programs.get_module_version("sphinx")
except (ImportError, TypeError):
    sphinxify = sphinx_version = None  # analysis:ignore

# To add sphinx dependency to the Dependencies dialog
SPHINX_REQVER = ">=0.6.6"
dependencies.add("sphinx", _("Rich text help on the Object Inspector"), required_version=SPHINX_REQVER)


class ObjectComboBox(EditableComboBox):
    """
    QComboBox handling object names
    """

    # Signals
    valid = Signal(bool)
Beispiel #10
0
    def setup_page(self):
        # Connections group
        connections_group = QGroupBox(_("Automatic connections"))
        connections_label = QLabel(_("This pane can automatically "
                                     "show an object's help information after "
                                     "a left parenthesis is written next to it. "
                                     "Below you can decide to which plugin "
                                     "you want to connect it to turn on this "
                                     "feature."))
        connections_label.setWordWrap(True)
        editor_box = self.create_checkbox(_("Editor"), 'connect/editor')
        rope_installed = programs.is_module_installed('rope')
        jedi_installed = programs.is_module_installed('jedi', '>=0.8.1')
        editor_box.setEnabled(rope_installed or jedi_installed)
        if not rope_installed and not jedi_installed:
            editor_tip = _("This feature requires the Rope or Jedi libraries.\n"
                           "It seems you don't have either installed.")
            editor_box.setToolTip(editor_tip)
        python_box = self.create_checkbox(_("Python Console"),
                                          'connect/python_console')
        ipython_box = self.create_checkbox(_("IPython Console"),
                                           'connect/ipython_console')
        ipython_box.setEnabled(QTCONSOLE_INSTALLED)

        connections_layout = QVBoxLayout()
        connections_layout.addWidget(connections_label)
        connections_layout.addWidget(editor_box)
        connections_layout.addWidget(python_box)
        connections_layout.addWidget(ipython_box)
        connections_group.setLayout(connections_layout)

        # Features group
        features_group = QGroupBox(_("Additional features"))
        math_box = self.create_checkbox(_("Render mathematical equations"),
                                        'math')
        req_sphinx = programs.is_module_installed('sphinx', '>=1.1')
        math_box.setEnabled(req_sphinx)
        if not req_sphinx:
            sphinx_ver = programs.get_module_version('sphinx')
            sphinx_tip = _("This feature requires Sphinx 1.1 or superior.")
            sphinx_tip += "\n" + _("Sphinx %s is currently installed.") % sphinx_ver
            math_box.setToolTip(sphinx_tip)

        features_layout = QVBoxLayout()
        features_layout.addWidget(math_box)
        features_group.setLayout(features_layout)

        # Source code group
        sourcecode_group = QGroupBox(_("Source code"))
        wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap')
        names = CONF.get('color_schemes', 'names')
        choices = list(zip(names, names))
        cs_combo = self.create_combobox(_("Syntax color scheme: "),
                                        choices, 'color_scheme_name')

        sourcecode_layout = QVBoxLayout()
        sourcecode_layout.addWidget(wrap_mode_box)
        sourcecode_layout.addWidget(cs_combo)
        sourcecode_group.setLayout(sourcecode_layout)

        # Final layout
        vlayout = QVBoxLayout()
        vlayout.addWidget(connections_group)
        vlayout.addWidget(features_group)
        vlayout.addWidget(sourcecode_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)