Exemple #1
0
def test_dependencies(qtbot):
    """Run dependency widget test."""
    # Test sample
    dependencies.add("IPython", "Enhanced Python interpreter", ">=0.13")
    dependencies.add("foo", "Non-existent module", ">=1.0")

    dlg = setup_dependencies(qtbot)
    dlg.set_data(dependencies.DEPENDENCIES)
    dlg.show()
    assert dlg
Exemple #2
0
def test():
    """Run dependency widget test"""
    from trex import dependencies

    # Test sample
    dependencies.add("IPython", "Enhanced Python interpreter", ">=0.13")
    dependencies.add("matplotlib", "Interactive data plotting", ">=1.0")
    dependencies.add("sympy", "Symbolic Mathematics", ">=10.0")
    dependencies.add("foo", "Non-existent module", ">=1.0")

    from trex.utils.qthelpers import qapplication
    app = qapplication()
    dlg = DependenciesDialog(None)
    dlg.set_data(dependencies.DEPENDENCIES)
    dlg.show()
    sys.exit(dlg.exec_())
Exemple #3
0
from trex.config.base import _, DEBUG, debug_print, get_conf_path
from trex.utils import sourcecode
from trex.utils.introspection.plugin_client import PluginClient
from trex.utils.introspection.utils import CodeInfo


PLUGINS = ['rope', 'jedi', 'fallback']

LOG_FILENAME = get_conf_path('introspection.log')
DEBUG_EDITOR = DEBUG >= 3
LEAD_TIME_SEC = 0.25


ROPE_REQVER = '>=0.9.4'
dependencies.add('rope',
                 _("Editor's code completion, go-to-definition and help"),
                 required_version=ROPE_REQVER)

JEDI_REQVER = '>=0.9.0'
dependencies.add('jedi',
                 _("Editor's code completion, go-to-definition and help"),
                 required_version=JEDI_REQVER)


class PluginManager(QObject):

    introspection_complete = Signal(object)

    def __init__(self, executable, extra_path=None):

        super(PluginManager, self).__init__()
Exemple #4
0
from trex.plugins.configdialog import PluginConfigPage
from trex.py3compat import get_meth_class_inst, to_text_string
from trex.utils import icon_manager as ima
from trex.utils import programs
from trex.utils.help.sphinxify import (CSS_PATH, generate_context, sphinxify,
                                       usage, warning)
from trex.utils.qthelpers import (add_actions, create_action,
                                  create_toolbutton)
from trex.widgets.browser import FrameWebView
from trex.widgets.comboboxes import EditableComboBox
from trex.widgets.findreplace import FindReplace
from trex.widgets.sourcecode import codeeditor

# Sphinx dependency
dependencies.add("sphinx",
                 _("Show help for objects in the Editor and "
                   "Consoles in a dedicated pane"),
                 required_version='>=0.6.6')


class ObjectComboBox(EditableComboBox):
    """
    QComboBox handling object names
    """
    # Signals
    valid = Signal(bool, bool)

    def __init__(self, parent):
        EditableComboBox.__init__(self, parent)
        self.help = parent
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.tips = {True: '', False: ''}
Exemple #5
0
"""
IPython configuration variables needed by TRex
"""

from trex.utils import programs
from trex import dependencies
from trex.config.base import _

# Constants
QTCONSOLE_REQVER = ">=4.2.0"
ZMQ_REQVER = ">=13.0.0"
NBCONVERT_REQVER = ">=4.0"

# Dependencies
dependencies.add("qtconsole",
                 _("Integrate the IPython console"),
                 required_version=QTCONSOLE_REQVER)
dependencies.add("nbconvert",
                 _("Manipulate Jupyter notebooks on the Editor"),
                 required_version=NBCONVERT_REQVER)


# Auxiliary functions
def is_qtconsole_installed():
    pyzmq_installed = programs.is_module_installed('zmq', version=ZMQ_REQVER)
    pygments_installed = programs.is_module_installed('pygments')
    qtconsole_installed = programs.is_module_installed(
        'qtconsole', version=QTCONSOLE_REQVER)

    if pyzmq_installed and pygments_installed and qtconsole_installed:
        return True
Exemple #6
0
from trex.utils import icon_manager as ima
from trex.utils.misc import (get_error_match, get_python_executable,
                             is_python_script, remove_backslashes)
from trex.utils.qthelpers import create_action, mimedata2url
from trex.plugins import TRexPluginWidget
from trex.plugins.configdialog import PluginConfigPage
from trex.plugins.runconfig import get_run_configuration
from trex.py3compat import to_text_string, is_text_string, getcwd
from trex.widgets.externalshell.pythonshell import ExternalPythonShell
from trex.widgets.externalshell.systemshell import ExternalSystemShell
from trex.widgets.findreplace import FindReplace
from trex.widgets.tabs import Tabs

MPL_REQVER = '>=1.0'
dependencies.add("matplotlib",
                 _("Interactive data plotting in the consoles"),
                 required_version=MPL_REQVER,
                 optional=True)


class ExternalConsoleConfigPage(PluginConfigPage):
    def __init__(self, plugin, parent):
        PluginConfigPage.__init__(self, plugin, parent)
        self.get_name = lambda: _("Python console")

    def setup_page(self):
        interface_group = QGroupBox(_("Interface"))
        newcb = self.create_checkbox
        singletab_box = newcb(_("One tab per script"), 'single_tab')
        showtime_box = newcb(_("Show elapsed time"), 'show_elapsed_time')
        icontext_box = newcb(_("Show icons and text"), 'show_icontext')
Exemple #7
0
import os

# Third party imports
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QHBoxLayout, QLabel, QWidget

# Local imports
from trex import dependencies
from trex.config.base import _
from trex.config.gui import get_font
from trex.py3compat import to_text_string

if not os.name == 'nt':
    PSUTIL_REQVER = '>=0.3'
    dependencies.add("psutil",
                     _("CPU and memory usage info in the status bar"),
                     required_version=PSUTIL_REQVER)


class StatusBarWidget(QWidget):
    def __init__(self, parent, statusbar):
        QWidget.__init__(self, parent)

        self.label_font = font = get_font(option='rich_font')
        font.setPointSize(self.font().pointSize())
        font.setBold(True)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
Exemple #8
0
# Local imports
from trex.config.base import get_supported_types
from trex.py3compat import (NUMERIC_TYPES, TEXT_TYPES, to_text_string,
                            is_text_string, is_binary_string, reprlib,
                            to_binary_string)
from trex.utils import programs
from trex import dependencies
from trex.config.base import _

#==============================================================================
# Dependencies
#==============================================================================
PANDAS_REQVER = '>=0.13.1'
dependencies.add('pandas',
                 _("View and edit DataFrames and Series in the "
                   "Variable Explorer"),
                 required_version=PANDAS_REQVER,
                 optional=True)

NUMPY_REQVER = '>=1.7'
dependencies.add("numpy",
                 _("View and edit two and three dimensional arrays "
                   "in the Variable Explorer"),
                 required_version=NUMPY_REQVER,
                 optional=True)


#==============================================================================
# FakeObject
#==============================================================================
class FakeObject(object):
Exemple #9
0
                    results.append((warning.message % warning.message_args,
                                    warning.lineno))
    except Exception:
        # Never return None to avoid lock in trex/widgets/editor.py
        # See Issue 1547
        results = []
        if DEBUG_EDITOR:
            traceback.print_exc()  # Print exception in internal console
    return results


# Required version:
# Why 0.5 (Python2)? Because it's based on _ast (thread-safe)
PYFLAKES_REQVER = '>=0.6.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