Exemple #1
0
        w = Checker(tree, filename)
        w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
        results = []
        lines = source_code.splitlines()
        for warning in w.messages:
            if 'analysis:ignore' not in lines[warning.lineno - 1]:
                results.append(
                    (warning.message % warning.message_args, warning.lineno))
        return results


# Required versions
# Why >=0.5.0? Because it's based on _ast (thread-safe)
PYFLAKES_REQVER = '>=0.5.0'
dependencies.add("pyflakes",
                 _("Real-time code analysis on the Editor"),
                 required_version=PYFLAKES_REQVER)

PEP8_REQVER = '>=0.6'
dependencies.add("pep8",
                 _("Real-time code style analysis on the Editor"),
                 required_version=PEP8_REQVER)


def is_pyflakes_installed():
    """Return True if pyflakes required version is installed"""
    return programs.is_module_installed('pyflakes', PYFLAKES_REQVER)


def get_checker_executable(name):
    """Return checker executable in the form of a list of arguments
Exemple #2
0
if programs.is_module_installed(IPYTHON_QT_MODULE, SUPPORTED_IPYTHON):
    from SMlib.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 SMlib.utils.inspector.sphinxify import (CSS_PATH, sphinxify,
                                                     warning, generate_context)
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):
    """
    QComboBox handling object names
    """
    def __init__(self, parent):
        EditableComboBox.__init__(self, parent)
        self.object_inspector = parent
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.tips = {True: '', False: ''}
        
    def is_valid(self, qstr=None):
        """Return True if string is valid"""
        if qstr is None:
Exemple #3
0
    else:
        # Okay, it's syntactically valid.  Now check it.
        w = Checker(tree, filename)
        w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
        results = []
        lines = source_code.splitlines()
        for warning in w.messages:
            if 'analysis:ignore' not in lines[warning.lineno-1]:
                results.append((warning.message % warning.message_args,
                                warning.lineno))
        return results

# Required versions
# Why >=0.5.0? Because it's based on _ast (thread-safe)
PYFLAKES_REQVER = '>=0.5.0'
dependencies.add("pyflakes", _("Real-time code analysis on the Editor"),
                 required_version=PYFLAKES_REQVER)

PEP8_REQVER = '>=0.6'
dependencies.add("pep8", _("Real-time code style analysis on the Editor"),
                 required_version=PEP8_REQVER)


def is_pyflakes_installed():
    """Return True if pyflakes required version is installed"""
    return programs.is_module_installed('pyflakes', PYFLAKES_REQVER)


def get_checker_executable(name):
    """Return checker executable in the form of a list of arguments
    for subprocess.Popen"""
    if programs.is_program_installed(name):
Exemple #4
0
#     that requires the hack to make this work without IPython
if programs.is_module_installed(IPYTHON_QT_MODULE, SUPPORTED_IPYTHON):
    from SMlib.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 SMlib.utils.inspector.sphinxify import CSS_PATH, sphinxify, warning, generate_context
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):
    """
    QComboBox handling object names
    """

    def __init__(self, parent):
        EditableComboBox.__init__(self, parent)
        self.object_inspector = parent
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.tips = {True: "", False: ""}

    def is_valid(self, qstr=None):
        """Return True if string is valid"""