Пример #1
0
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""External System Shell widget: execute terminal in a separate process"""

import os
import sys

from spyderlib.qt.QtGui import QMessageBox
from spyderlib.qt.QtCore import (QProcess, Signal, QTextCodec,
                                 QProcessEnvironment)
LOCALE_CODEC = QTextCodec.codecForLocale()
CP850_CODEC = QTextCodec.codecForName('cp850')

# Local imports
from spyderlib.utils.programs import shell_split
from spyderlib.config.base import _
from spyderlib.widgets.externalshell.baseshell import (
    ExternalShellBase, add_pathlist_to_PYTHONPATH)
from spyderlib.widgets.shell import TerminalWidget
from spyderlib.py3compat import to_text_string, is_text_string
import spyderlib.utils.icon_manager as ima


class ExternalSystemShell(ExternalShellBase):
    """External Shell widget: execute Python script in a separate process"""
    SHELL_CLASS = TerminalWidget
    started = Signal()
Пример #2
0
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201

import sys
import os
import os.path as osp
from time import time, strftime, gmtime

from spyderlib.qt.QtGui import (QApplication, QWidget, QVBoxLayout,
                                QHBoxLayout, QMenu, QLabel, QInputDialog,
                                QLineEdit, QToolButton)
from spyderlib.qt.QtCore import (QProcess, Signal, QByteArray, QTimer, Qt,
                                 QTextCodec, Slot)
LOCALE_CODEC = QTextCodec.codecForLocale()

# Local imports
from spyderlib.utils.qthelpers import (get_icon, create_toolbutton,
                                       create_action, add_actions)
from spyderlib.baseconfig import get_conf_path, _
from spyderlib.py3compat import is_text_string, to_text_string


def add_pathlist_to_PYTHONPATH(env, pathlist):
    # PyQt API 1/2 compatibility-related tests:
    assert isinstance(env, list)
    assert all([is_text_string(path) for path in env])

    pypath = "PYTHONPATH"
    pathstr = os.pathsep.join(pathlist)
Пример #3
0
# (see spyderlib/__init__.py for details)

# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201

import os
import os.path as osp
from time import time, strftime, gmtime

from spyderlib.qt.QtGui import QWidget, QVBoxLayout, QHBoxLayout, QMenu, QLabel, QInputDialog, QLineEdit, QToolButton
from spyderlib.qt.QtCore import QProcess, Signal, QByteArray, QTimer, Qt, QTextCodec, Slot
import spyderlib.utils.icon_manager as ima

LOCALE_CODEC = QTextCodec.codecForLocale()

# Local imports
from spyderlib.utils.qthelpers import create_toolbutton, create_action, add_actions
from spyderlib.config.base import get_conf_path, _
from spyderlib.py3compat import is_text_string, to_text_string


def add_pathlist_to_PYTHONPATH(env, pathlist, drop_env=False):
    # PyQt API 1/2 compatibility-related tests:
    assert isinstance(env, list)
    assert all([is_text_string(path) for path in env])

    pypath = "PYTHONPATH"
    pathstr = os.pathsep.join(pathlist)
    if os.environ.get(pypath) is not None and not drop_env:
Пример #4
0
Profiler widget

See the official documentation on python profiling:
http://docs.python.org/library/profile.html

Questions for Pierre and others:
    - Where in the menu should profiler go?  Run > Profile code ?
"""

from __future__ import with_statement

from spyderlib.qt.QtGui import (QHBoxLayout, QWidget, QMessageBox, QVBoxLayout,
                                QLabel, QTreeWidget, QTreeWidgetItem,
                                QApplication)
from spyderlib.qt.QtCore import SIGNAL, QProcess, QByteArray, Qt, QTextCodec
locale_codec = QTextCodec.codecForLocale()
from spyderlib.qt.compat import getopenfilename

import sys
import os
import os.path as osp
import time

# Local imports
from spyderlib.utils.qthelpers import (create_toolbutton, get_item_user_text,
                                       set_item_user_text, get_icon)
from spyderlib.utils.programs import shell_split
from spyderlib.baseconfig import get_conf_path, get_translation
from spyderlib.widgets.texteditor import TextEditor
from spyderlib.widgets.comboboxes import PythonModulesComboBox
from spyderlib.widgets.externalshell import baseshell
Пример #5
0
See the official documentation on python profiling:
http://docs.python.org/library/profile.html

Questions for Pierre and others:
    - Where in the menu should profiler go?  Run > Profile code ?
"""

from __future__ import with_statement

from spyderlib.qt.QtGui import (QHBoxLayout, QWidget, QMessageBox, QVBoxLayout,
                                QLabel, QTreeWidget, QTreeWidgetItem,
                                QApplication, QColor)
from spyderlib.qt.QtCore import (Signal, QProcess, QByteArray, Qt, QTextCodec,
                                 QProcessEnvironment)
locale_codec = QTextCodec.codecForLocale()
from spyderlib.qt.compat import getopenfilename, getsavefilename

import sys
import os
import os.path as osp
import time

# Local imports
from spyderlib.utils.qthelpers import (create_toolbutton, get_item_user_text,
                                       set_item_user_text, get_icon)
from spyderlib.utils.programs import shell_split
from spyderlib.baseconfig import get_conf_path, get_translation
from spyderlib.widgets.texteditor import TextEditor
from spyderlib.widgets.comboboxes import PythonModulesComboBox
from spyderlib.widgets.externalshell import baseshell
Пример #6
0
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)

"""External System Shell widget: execute terminal in a separate process"""

import os

from spyderlib.qt.QtGui import QMessageBox
from spyderlib.qt.QtCore import QProcess, Signal, QTextCodec, QProcessEnvironment

LOCALE_CODEC = QTextCodec.codecForLocale()
CP850_CODEC = QTextCodec.codecForName("cp850")

# Local imports
from spyderlib.utils.programs import shell_split
from spyderlib.baseconfig import _
from spyderlib.widgets.externalshell.baseshell import ExternalShellBase, add_pathlist_to_PYTHONPATH
from spyderlib.widgets.shell import TerminalWidget
from spyderlib.py3compat import to_text_string, is_text_string
import spyderlib.utils.icon_manager as ima


class ExternalSystemShell(ExternalShellBase):
    """External Shell widget: execute Python script in a separate process"""

    SHELL_CLASS = TerminalWidget
    started = Signal()