[spyder] 05/07: New upstream version 3.0.1+dfsg1
Frédéric-Emmanuel Picca
picca at moszumanska.debian.org
Mon Oct 31 09:47:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
picca pushed a commit to branch master
in repository spyder.
commit eee70ddc1b3cb293a98af97695d5d2f544068fb4
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date: Sun Oct 30 19:16:31 2016 +0100
New upstream version 3.0.1+dfsg1
---
PKG-INFO | 4 +-
README.md | 13 ++--
doc/conf.py | 4 +-
doc/console.rst | 27 +-------
doc/editor.rst | 14 ++++-
doc/explorer.rst | 20 ------
doc/fileexplorer.rst | 33 ++++++++++
doc/images/internalconsole.png | Bin 17424 -> 23505 bytes
doc/images/ipythonkernelconnect.png | Bin 11458 -> 35932 bytes
doc/images/new_project.png | Bin 0 -> 14339 bytes
doc/images/projectexplorer.png | Bin 19407 -> 50505 bytes
doc/images/projectexplorer2.png | Bin 18164 -> 33511 bytes
doc/images/variableexplorer2.png | Bin 20838 -> 0 bytes
doc/index.rst | 12 ++--
doc/installation.rst | 6 +-
doc/internalconsole.rst | 38 ++----------
doc/ipythonconsole.rst | 42 ++++++++++++-
doc/overview.rst | 6 +-
doc/projectexplorer.rst | 39 ------------
doc/projects.rst | 69 +++++++++++++++++++++
doc/pylint.rst | 17 +++--
doc/variableexplorer.rst | 44 ++++++++-----
spyder/__init__.py | 2 +-
spyder/plugins/ipythonconsole.py | 5 +-
spyder/plugins/variableexplorer.py | 2 +-
spyder/utils/ipython/spyder_kernel.py | 10 ++-
spyder/utils/qthelpers.py | 56 +++++++++++++++--
spyder/utils/site/sitecustomize.py | 2 +-
spyder/widgets/browser.py | 17 ++++-
spyder/widgets/ipythonconsole/client.py | 4 +-
spyder/widgets/ipythonconsole/control.py | 2 +-
spyder/widgets/ipythonconsole/debugging.py | 2 +-
spyder/widgets/ipythonconsole/namespacebrowser.py | 5 +-
spyder/widgets/ipythonconsole/shell.py | 11 +++-
.../widgets/variableexplorer/collectionseditor.py | 53 +++++-----------
.../widgets/variableexplorer/namespacebrowser.py | 11 ++--
spyder/widgets/variableexplorer/utils.py | 28 +++++----
37 files changed, 354 insertions(+), 244 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 46ad7d1..b64b8df 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: spyder
-Version: 3.0.0
+Version: 3.0.1
Summary: Scientific PYthon Development EnviRonment
Home-page: https://github.com/spyder-ide/spyder
Author: The Spyder Project Contributors
Author-email: UNKNOWN
License: MIT
-Download-URL: https://github.com/spyder-ide/spyder/files/spyder-3.0.0.zip
+Download-URL: https://github.com/spyder-ide/spyder/files/spyder-3.0.1.zip
Description: Spyder is an interactive Python development environment providing
MATLAB-like features in a simple and light-weighted software.
It also provides ready-to-use pure-Python widgets to your PyQt5 or
diff --git a/README.md b/README.md
index c460b43..6135c31 100644
--- a/README.md
+++ b/README.md
@@ -71,12 +71,11 @@ The easiest way to install Spyder is:
### On Windows:
-- Or using one of these scientific Python distributions:
- 1. [Anaconda](http://continuum.io/downloads)
- 2. [WinPython](https://winpython.github.io/)
- 3. [Python(x,y)](http://python-xy.github.io)
-- Using one of our executable installers, which can be found
- [here](https://github.com/spyder-ide/spyder/releases).
+Using one (and only one) of these scientific Python distributions:
+
+1. [Anaconda](http://continuum.io/downloads)
+2. [WinPython](https://winpython.github.io/)
+3. [Python(x,y)](http://python-xy.github.io)
### On Mac OSX:
@@ -109,7 +108,7 @@ For more details on supported platforms, please refer to our
[installation instructions](http://pythonhosted.org/spyder/installation.html).
**Important note**: This does not install the graphical Python libraries (i.e.
-PyQt5 or PyQt4) that Spyder depend on. Those have to be installed separately
+PyQt5 or PyQt4) that Spyder depends on. Those have to be installed separately
after installing Python.
diff --git a/doc/conf.py b/doc/conf.py
index 38399c2..64f1ed0 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -45,9 +45,9 @@ copyright = 'The Spyder Project Contributors'
# built documents.
#
# The short X.Y version.
-version = '2.3'
+version = '3'
# The full version, including alpha/beta/rc tags.
-release = '2.3'
+release = '3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/doc/console.rst b/doc/console.rst
index 97411a1..da35808 100644
--- a/doc/console.rst
+++ b/doc/console.rst
@@ -33,29 +33,4 @@ Related plugins:
* :doc:`help`
* :doc:`historylog`
* :doc:`editor`
-* :doc:`explorer`
-
-
-Reloading modules: the User Module Deleter (UMD)
-------------------------------------------------
-
-When working with Python scripts interactively, one must keep in mind that
-Python import a module from its source code (on disk) only when parsing the
-first corresponding import statement. During this first import, the byte code
-is generated (.pyc file) if necessary and the imported module code object is
-cached in `sys.modules`. Then, when re-importing the same module, this cached
-code object will be directly used even if the source code file (.py[w] file)
-has changed meanwhile.
-
-This behavior is sometimes unexpected when working with the Python interpreter
-in interactive mode, because one must either always restart the interpreter
-or remove manually the .pyc files to be sure that changes made in imported
-modules were taken into account.
-
-The User Module Deleter (UMD) is a Spyder console's exclusive feature that
-forces the Python interpreter to reload modules completely when executing
-a Python script.
-
-For example, when UMD is turned on, one may test complex applications
-within the same Python interpreter without having to restart it every time
-(restart time may be relatively long when testing GUI-based applications).
\ No newline at end of file
+* :doc:`fileexplorer`
diff --git a/doc/editor.rst b/doc/editor.rst
index c2e677a..a903a23 100644
--- a/doc/editor.rst
+++ b/doc/editor.rst
@@ -9,15 +9,27 @@ function/class browser, horizontal/vertical splitting features, etc.
Function/class/method browser:
+|
+
.. image:: images/editor1.png
+ :align: center
+|
Code analysis with `pyflakes`:
+|
+
.. image:: images/editor2.png
+ :align: center
+|
Horizontal/vertical splitting feature:
+|
+
.. image:: images/editor3.png
+ :align: center
+|
How to define a code cell
--------------------------
@@ -37,5 +49,5 @@ Cells are separated by lines starting with:
Related plugins:
* :doc:`console`
-* :doc:`explorer`
+* :doc:`fileexplorer`
* :doc:`findinfiles`
diff --git a/doc/explorer.rst b/doc/explorer.rst
deleted file mode 100644
index 73881e9..0000000
--- a/doc/explorer.rst
+++ /dev/null
@@ -1,20 +0,0 @@
-Explorer
-========
-
-The explorer plugin is a file/directory browser allowing the user to open files
-with the internal editor or with the appropriate application (Windows only).
-
-.. image:: images/explorer.png
-
-Context menus may be used to run a script, open a terminal window or run a
-Windows explorer window (Windows only):
-
-.. image:: images/explorer_menu1.png
-
-.. image:: images/explorer_menu2.png
-
-
-Related plugins:
-
-* :doc:`console`
-* :doc:`editor`
diff --git a/doc/fileexplorer.rst b/doc/fileexplorer.rst
new file mode 100644
index 0000000..f20d585
--- /dev/null
+++ b/doc/fileexplorer.rst
@@ -0,0 +1,33 @@
+File Explorer
+=============
+
+The file explorer pane is a file/directory browser allowing the user to open
+files with the internal editor or with the appropriate application (Windows
+only).
+
+|
+
+.. image:: images/explorer.png
+ :align: center
+
+|
+
+Context menus may be used to run a script, open a terminal window or run a
+Windows explorer window (Windows only):
+
+|
+
+.. image:: images/explorer_menu1.png
+ :align: center
+
+|
+
+.. image:: images/explorer_menu2.png
+ :align: center
+
+|
+
+Related plugins:
+
+* :doc:`ipythonconsole`
+* :doc:`editor`
diff --git a/doc/images/internalconsole.png b/doc/images/internalconsole.png
index cf81ad8..60e8ecc 100644
Binary files a/doc/images/internalconsole.png and b/doc/images/internalconsole.png differ
diff --git a/doc/images/ipythonkernelconnect.png b/doc/images/ipythonkernelconnect.png
index 48179fb..7f43226 100644
Binary files a/doc/images/ipythonkernelconnect.png and b/doc/images/ipythonkernelconnect.png differ
diff --git a/doc/images/new_project.png b/doc/images/new_project.png
new file mode 100644
index 0000000..2e99b67
Binary files /dev/null and b/doc/images/new_project.png differ
diff --git a/doc/images/projectexplorer.png b/doc/images/projectexplorer.png
index 1d7d540..0caf45c 100644
Binary files a/doc/images/projectexplorer.png and b/doc/images/projectexplorer.png differ
diff --git a/doc/images/projectexplorer2.png b/doc/images/projectexplorer2.png
index 69fabde..4a4f73e 100644
Binary files a/doc/images/projectexplorer2.png and b/doc/images/projectexplorer2.png differ
diff --git a/doc/images/variableexplorer2.png b/doc/images/variableexplorer2.png
deleted file mode 100644
index 4e63b77..0000000
Binary files a/doc/images/variableexplorer2.png and /dev/null differ
diff --git a/doc/index.rst b/doc/index.rst
index 0928e7c..d2a120b 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -30,18 +30,18 @@ Contents:
overview
installation
options
- console
+ editor
ipythonconsole
debugging
+ console
variableexplorer
help
- onlinehelp
+ projects
+ pylint
+ fileexplorer
historylog
- explorer
- projectexplorer
- editor
findinfiles
- pylint
+ onlinehelp
internalconsole
Indices and tables:
diff --git a/doc/installation.rst b/doc/installation.rst
index dec8ebe..e9fac33 100644
--- a/doc/installation.rst
+++ b/doc/installation.rst
@@ -41,12 +41,12 @@ Updating Spyder
You can update Spyder by:
-* Updating Anaconda, WinPython, Python(x,y).
+* Updating Anaconda, WinPython or Python(x,y).
* Or using this command (in case you *don't* use any of those scientific
distributions)::
- pip install --update spyder
+ pip install --upgrade spyder
.. note::
@@ -223,7 +223,7 @@ Installation procedure
2. If you don't use Anaconda, you need to run:
- ``pip install --update spyder``
+ ``pip install --upgrade spyder``
Run without installing
diff --git a/doc/internalconsole.rst b/doc/internalconsole.rst
index fa34760..c12881f 100644
--- a/doc/internalconsole.rst
+++ b/doc/internalconsole.rst
@@ -7,41 +7,13 @@ All the commands entered in the internal console are executed in the same
process as Spyder's, but the Internal Console may be executed in a separate
thread (this is optional and for example this is not the case in Spyder itself).
+|
+
.. image:: images/internalconsole.png
+ :align: center
+
+|
The internal console support the following features:
* Code completion and calltips
-* User Module Deleter (as in :doc:`console`)
-
-Special commands
-----------------
-
-The following special commands are supported by the interactive console.
-
-- Edit script
-
- ``edit foobar.py`` will open ``foobar.py`` with Spyder's editor.
- ``xedit foobar.py`` will open ``foobar.py`` with the external editor.
-
-- Execute script
-
- ``run foobar.py`` will execute ``foobar.py`` in interactive console.
-
-- Remove references
-
- ``clear x, y`` will remove references named ``x`` and ``y``.
-
-- Shell commands
-
- ``!cmd`` will execute system command ``cmd`` (example ``!ls`` on Linux or
- ``!dir`` on Windows).
-
-- Python help
-
- ``object?`` will show ``object``'s help in documentation viewer.
-
-- GUI-based editor
-
- ``oedit(object)`` will open an appropriate GUI-based editor to modify object
- ``object`` and will return the result.
diff --git a/doc/ipythonconsole.rst b/doc/ipythonconsole.rst
index 77015b8..f530dae 100644
--- a/doc/ipythonconsole.rst
+++ b/doc/ipythonconsole.rst
@@ -7,19 +7,32 @@ a lightweight front-end interface connects to a full IPython kernel on the
back end. Visit the IPython project website for full documentation of
IPython's many features.
+|
+
.. image:: images/ipythonconsole.png
+ :align: center
+|
From the Consoles menu, Spyder can launch **IPython Console**
instances that attach to kernels that are managed
by Spyder itself or it can connect to external kernels that are managed
by IPython Qt Console sessions or the IPython Notebook.
+|
+
.. image:: images/ipythonconsolemenu.png
+ :align: center
+
+|
When "Connect to an existing kernel" is selected, Spyder prompts for the
kernel connection file details:
+|
+
.. image:: images/ipythonkernelconnect.png
+ :align: center
+|
**IPython Consoles** that are attached to kernels that were created by
Spyder support the following features:
@@ -40,9 +53,34 @@ set:
debugging step commands to the kernel. Breakpoints must be set manually
from the console command line.
+
+Reloading modules: the User Module Reloader (UMR)
+-------------------------------------------------
+
+When working with Python scripts interactively, one must keep in mind that
+Python import a module from its source code (on disk) only when parsing the
+first corresponding import statement. During this first import, the byte code
+is generated (.pyc file) if necessary and the imported module code object is
+cached in `sys.modules`. Then, when re-importing the same module, this cached
+code object will be directly used even if the source code file (.py[w] file)
+has changed meanwhile.
+
+This behavior is sometimes unexpected when working with the Python interpreter
+in interactive mode, because one must either always restart the interpreter
+or remove manually the .pyc files to be sure that changes made in imported
+modules were taken into account.
+
+The User Module Reloader (UMR) is a Spyder console's exclusive feature that
+forces the Python interpreter to reload modules completely when executing
+a Python script.
+
+For example, when UMR is turned on, one may test complex applications
+within the same Python interpreter without having to restart it every time
+(restart time may be relatively long when testing GUI-based applications).
+
+
Related plugins:
* :doc:`help`
* :doc:`editor`
-* :doc:`explorer`
-
+* :doc:`fileexplorer`
diff --git a/doc/overview.rst b/doc/overview.rst
index 028fa25..b4d258c 100644
--- a/doc/overview.rst
+++ b/doc/overview.rst
@@ -47,7 +47,7 @@ Key features:
* *to-do* lists (TODO, FIXME, XXX)
* errors/warnings (real-time *code analysis* provided by `pyflakes`)
- * integrated *`pylint` code analysis*
+ * integrated static code analysis (using `pylint`)
* direct link to `winpdb` external debugger
* :doc:`console`:
@@ -71,8 +71,8 @@ Key features:
* :doc:`onlinehelp`: automatically generated html documentation on installed Python modules
* :doc:`findinfiles`: find string occurrences in a directory, a mercurial repository or directly in PYTHONPATH (support for regular expressions and included/excluded string lists)
-* :doc:`explorer`
-* :doc:`projectexplorer` (support Pydev project import)
+* :doc:`fileexplorer`
+* :doc:`projects`
Spyder may also be used as a PyQt5 or PyQt4 extension library
diff --git a/doc/projectexplorer.rst b/doc/projectexplorer.rst
deleted file mode 100644
index 4544fc1..0000000
--- a/doc/projectexplorer.rst
+++ /dev/null
@@ -1,39 +0,0 @@
-Project Explorer
-================
-
-The project explorer plugin handles project management in Spyder with the
-following main features:
-
-* import from existing Pydev (Eclipse) or Spyder projects
-* add/remove project folders to/from Spyder's PYTHONPATH directly from
- the context menu or manage these folders in a dedicated dialog box
-* multiple file selection (for all available actions: open, rename, delete,
- and so on)
-* file type filters
-
-.. image:: images/projectexplorer.png
-
-.. image:: images/projectexplorer2.png
-
-Version Control Integration
----------------------------
-
-Spyder has limited integration with Mercurial_ and Git_. Commit and browse
-commands are available by right-clicking on relevant files that reside within
-an already initialized repository. These menu picks
-assume that certain commands are available on the system path.
-
-* For Mercurial repositories, TortoiseHG_ must be installed, and either ``thg``
- or ``hgtk`` must be on the system path.
-* For git repositories, the commands ``git`` and ``gitk`` must be on the
- system path. For Windows systems, the msysgit_ package provides a convenient
- installer and the option to place common git commands on the system path without
- creating conflicts with Windows system tools.
- The second option in the dialog below is generally a safe approach.
-
-.. image:: images/git_install_dialog.png
-
-.. _Git: http://git-scm.com/
-.. _Mercurial: http://mercurial.selenic.com/
-.. _TortoiseHg: http://tortoisehg.bitbucket.org/
-.. _msysgit: https://code.google.com/p/msysgit/
diff --git a/doc/projects.rst b/doc/projects.rst
new file mode 100644
index 0000000..98840bf
--- /dev/null
+++ b/doc/projects.rst
@@ -0,0 +1,69 @@
+Projects
+========
+
+Spyder allows users to associate a given directory with a project. This has two
+main advantages:
+
+1. Projects remember the list of open files in Editor. This permits to easily
+ work on several coding efforts at the same time.
+2. The project's path is added to the list of paths Python looks modules for, so
+ that modules developed as part of a project can be easily imported in any
+ console.
+
+To create a project, it is necessary to select the *New Project* entry from the
+*Projects* menu:
+
+|
+
+.. image:: images/new_project.png
+ :align: center
+
+|
+
+When a project is activated, the *Project explorer* pane is shown, which
+presents a tree view structure of the current project
+
+|
+
+.. image:: images/projectexplorer.png
+ :align: center
+
+|
+
+Through this pane it is possible to make several operations on the files that
+belong to project
+
+|
+
+.. image:: images/projectexplorer2.png
+ :align: center
+
+|
+
+.. note:: Projects are completely optional and not imposed on users, i.e. users
+ can work without creating any project.
+
+
+Version Control Integration
+---------------------------
+
+Spyder has limited integration with Git_ and Mercurial_. Commit and browse
+commands are available by right-clicking on relevant files that reside within
+an already initialized repository. This menu assume that certain commands are
+available on the system path.
+
+* For Mercurial repositories, TortoiseHG_ must be installed, and either ``thg``
+ or ``hgtk`` must be on the system path.
+* For git repositories, the commands ``git`` and ``gitk`` must be on the
+ system path. For Windows systems, the `Git for Windows`_ package provides a
+ convenient installer and the option to place common git commands on the
+ system path without creating conflicts with Windows system tools.
+ The second option in the dialog below is generally a safe approach.
+
+.. image:: images/git_install_dialog.png
+ :align: center
+
+.. _Git: http://git-scm.com/
+.. _Mercurial: http://mercurial.selenic.com/
+.. _TortoiseHg: http://tortoisehg.bitbucket.org/
+.. _Git for Windows: https://git-for-windows.github.io/
diff --git a/doc/pylint.rst b/doc/pylint.rst
index f5e1533..309cd5b 100644
--- a/doc/pylint.rst
+++ b/doc/pylint.rst
@@ -1,12 +1,17 @@
-Pylint extension
-================
+Static code analysis
+====================
-Pylint extension may be used directly from the :doc:`editor`, or by entering
-manually the Python module or package path - i.e. it works either with `.py`
-(or `.pyw`) Python scripts or with whole Python packages (directories containing
-an `__init__.py` script).
+The static code analysis tool may be used directly from the :doc:`editor`, or
+by entering manually the Python module or package path - i.e. it works either
+with `.py` (or `.pyw`) Python scripts or with whole Python packages
+(directories containing an `__init__.py` script).
+
+|
.. image:: images/pylint.png
+ :align: center
+
+|
Related plugins:
diff --git a/doc/variableexplorer.rst b/doc/variableexplorer.rst
index 3fcb263..8dccf3f 100644
--- a/doc/variableexplorer.rst
+++ b/doc/variableexplorer.rst
@@ -1,40 +1,51 @@
Variable Explorer
=================
-The variable explorer shows the `globals()` namespace contents (i.e. all global
-object references) of the current console: it supports both the :doc:`console`
-(Python interpreter running in a remote process)
-and the :doc:`internalconsole`.
+The variable explorer shows the namespace contents (i.e. all global object
+references) of the current console
+
+|
.. image:: images/variableexplorer1.png
+ :align: center
+
+|
The following screenshots show some interesting features such as editing
lists, strings, dictionaries, NumPy arrays, or plotting/showing NumPy arrays
data.
+|
+
.. image:: images/listeditor.png
+ :align: center
+
+|
.. image:: images/texteditor.png
+ :align: center
+
+|
.. image:: images/dicteditor.png
+ :align: center
+
+|
.. image:: images/arrayeditor.png
+ :align: center
-.. image:: images/variableexplorer-plot.png
+|
-.. image:: images/variableexplorer-imshow.png
+.. image:: images/variableexplorer-plot.png
+ :align: center
-The default variable explorer configuration allows to browse global variables
-without slowing the console even with very large NumPy arrays, lists or
-dictionaries. The trick is to truncate values, to hide collection contents
-(i.e. showing '<list @ address>' instead of list contents) and to *not* show
-mininum and maximum values for NumPy arrays (see context menu options on the
-screenshot at the top of this page).
+|
-However, most of the time, choosing the opposite options won't have too much
-effect on console's performance:
+.. image:: images/variableexplorer-imshow.png
+ :align: center
-.. image:: images/variableexplorer2.png
+|
Supported types
@@ -57,5 +68,4 @@ supported are:
Related plugins:
-* :doc:`console`
-* :doc:`internalconsole`
+* :doc:`ipythonconsole`
diff --git a/spyder/__init__.py b/spyder/__init__.py
index 5b50d32..0470462 100644
--- a/spyder/__init__.py
+++ b/spyder/__init__.py
@@ -27,7 +27,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
"""
-version_info = (3, 0, 0)
+version_info = (3, 0, 1)
__version__ = '.'.join(map(str, version_info))
__license__ = __doc__
diff --git a/spyder/plugins/ipythonconsole.py b/spyder/plugins/ipythonconsole.py
index 0eeefde..03d6e00 100644
--- a/spyder/plugins/ipythonconsole.py
+++ b/spyder/plugins/ipythonconsole.py
@@ -1359,7 +1359,7 @@ class IPythonConsole(SpyderPluginWidget):
password):
# Verifying if the connection file exists
try:
- find_connection_file(osp.basename(connection_file))
+ connection_file = find_connection_file(osp.basename(connection_file))
except (IOError, UnboundLocalError):
QMessageBox.critical(self, _('IPython'),
_("Unable to connect to "
@@ -1369,6 +1369,7 @@ class IPythonConsole(SpyderPluginWidget):
# Getting the master name that corresponds to the client
# (i.e. the i in i/A)
master_name = None
+ external_kernel = False
slave_ord = ord('A') - 1
kernel_manager = None
for cl in self.get_clients():
@@ -1387,6 +1388,7 @@ class IPythonConsole(SpyderPluginWidget):
if master_name is None:
self.master_clients += 1
master_name = to_text_string(self.master_clients)
+ external_kernel = True
# Set full client name
name = master_name + '/' + chr(slave_ord + 1)
@@ -1400,6 +1402,7 @@ class IPythonConsole(SpyderPluginWidget):
connection_file=connection_file,
menu_actions=self.menu_actions,
hostname=hostname,
+ external_kernel=external_kernel,
slave=True)
# Create kernel client
diff --git a/spyder/plugins/variableexplorer.py b/spyder/plugins/variableexplorer.py
index cc84fea..3c9b3fb 100644
--- a/spyder/plugins/variableexplorer.py
+++ b/spyder/plugins/variableexplorer.py
@@ -41,7 +41,7 @@ class VariableExplorerConfigPage(PluginConfigPage):
for option, text in filter_data]
display_group = QGroupBox(_("Display"))
- display_data = [('truncate', _("Truncate values"), '')]
+ display_data = []
if programs.is_module_installed('numpy'):
display_data.append(('minmax', _("Show arrays min/max"), ''))
display_data.append(
diff --git a/spyder/utils/ipython/spyder_kernel.py b/spyder/utils/ipython/spyder_kernel.py
index 324afc9..b56434f 100644
--- a/spyder/utils/ipython/spyder_kernel.py
+++ b/spyder/utils/ipython/spyder_kernel.py
@@ -299,14 +299,20 @@ class SpyderKernel(IPythonKernel):
def _get_array_shape(self, var):
"""Return array's shape"""
try:
- return var.shape
+ if self._is_array(var):
+ return var.shape
+ else:
+ return None
except AttributeError:
return None
def _get_array_ndim(self, var):
"""Return array's ndim"""
try:
- return var.ndim
+ if self._is_array(var):
+ return var.ndim
+ else:
+ return None
except AttributeError:
return None
diff --git a/spyder/utils/qthelpers.py b/spyder/utils/qthelpers.py
index dbca83f..dbe5b41 100644
--- a/spyder/utils/qthelpers.py
+++ b/spyder/utils/qthelpers.py
@@ -16,10 +16,10 @@ import sys
from qtpy.compat import to_qvariant, from_qvariant
from qtpy.QtCore import (QEvent, QLibraryInfo, QLocale, QObject, Qt, QTimer,
QTranslator, Signal, Slot)
-from qtpy.QtGui import QKeyEvent, QKeySequence, QPixmap
+from qtpy.QtGui import QIcon, QKeyEvent, QKeySequence, QPixmap
from qtpy.QtWidgets import (QAction, QApplication, QHBoxLayout, QLabel,
- QLineEdit, QMenu, QStyle, QToolButton, QVBoxLayout,
- QWidget)
+ QLineEdit, QMenu, QStyle, QToolBar, QToolButton,
+ QVBoxLayout, QWidget)
# Local imports
from spyder.config.base import get_image_path, running_in_mac_app
@@ -237,7 +237,7 @@ def create_action(parent, text, shortcut=None, icon=None, tip=None,
toggled=None, triggered=None, data=None, menurole=None,
context=Qt.WindowShortcut):
"""Create a QAction"""
- action = QAction(text, parent)
+ action = SpyderAction(text, parent)
if triggered is not None:
action.triggered.connect(triggered)
if toggled is not None:
@@ -285,7 +285,7 @@ def add_shortcut_to_tooltip(action, context, name):
def add_actions(target, actions, insert_before=None):
- """Add actions to a menu"""
+ """Add actions to a QMenu or a QToolBar."""
previous_action = None
target_actions = list(target.actions())
if target_actions:
@@ -303,7 +303,9 @@ def add_actions(target, actions, insert_before=None):
target.addMenu(action)
else:
target.insertMenu(insert_before, action)
- elif isinstance(action, QAction):
+ elif isinstance(action, SpyderAction):
+ if isinstance(target, QMenu) or not isinstance(target, QToolBar):
+ action = action.no_icon_action
if insert_before is None:
target.addAction(action)
else:
@@ -416,6 +418,48 @@ def get_filetype_icon(fname):
ext = ext[1:]
return get_icon( "%s.png" % ext, ima.icon('FileIcon') )
+
+class SpyderAction(QAction):
+ """Spyder QAction class wrapper to handle cross platform patches."""
+
+ def __init__(self, *args, **kwargs):
+ """Spyder QAction class wrapper to handle cross platform patches."""
+ super(SpyderAction, self).__init__(*args, **kwargs)
+ self._action_no_icon = None
+
+ if sys.platform == 'darwin':
+ self._action_no_icon = QAction(*args, **kwargs)
+ self._action_no_icon.setIcon(QIcon())
+ self._action_no_icon.triggered.connect(self.triggered)
+ self._action_no_icon.toggled.connect(self.toggled)
+ self._action_no_icon.changed.connect(self.changed)
+ self._action_no_icon.hovered.connect(self.hovered)
+ else:
+ self._action_no_icon = self
+
+ def __getattribute__(self, name):
+ """Intercept method calls and apply to both actions, except signals."""
+ attr = super(SpyderAction, self).__getattribute__(name)
+
+ if hasattr(attr, '__call__') and name not in ['triggered', 'toggled',
+ 'changed', 'hovered']:
+ def newfunc(*args, **kwargs):
+ result = attr(*args, **kwargs)
+ if name not in ['setIcon']:
+ action_no_icon = self.__dict__['_action_no_icon']
+ attr_no_icon = super(QAction,
+ action_no_icon).__getattribute__(name)
+ attr_no_icon(*args, **kwargs)
+ return result
+ return newfunc
+ else:
+ return attr
+
+ @property
+ def no_icon_action(self):
+ """Return the action without an Icon."""
+ return self._action_no_icon
+
class ShowStdIcons(QWidget):
"""
diff --git a/spyder/utils/site/sitecustomize.py b/spyder/utils/site/sitecustomize.py
index 0f9653b..64b4fb8 100644
--- a/spyder/utils/site/sitecustomize.py
+++ b/spyder/utils/site/sitecustomize.py
@@ -178,7 +178,7 @@ if os.name == 'nt' and PY2:
if sys.platform == 'darwin':
from spyder.config.base import MAC_APP_NAME
if MAC_APP_NAME in __file__:
- if IS_EXT_INTERPRETER.lower() == "true":
+ if IS_EXT_INTERPRETER:
# Add a minimal library (with spyder) at the end of sys.path to
# be able to connect our monitor to the external console
py_ver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
diff --git a/spyder/widgets/browser.py b/spyder/widgets/browser.py
index d4a171f..319c6c0 100644
--- a/spyder/widgets/browser.py
+++ b/spyder/widgets/browser.py
@@ -142,7 +142,22 @@ class WebView(QWebEngineView):
add_actions(menu, actions)
menu.popup(event.globalPos())
event.accept()
-
+
+ def setHtml(self, html, baseUrl=QUrl()):
+ """
+ Reimplement Qt method to prevent WebEngine to steal focus
+ when setting html on the page
+
+ Solution taken from
+ https://bugreports.qt.io/browse/QTBUG-52999
+ """
+ if WEBENGINE:
+ self.setEnabled(False)
+ super(WebView, self).setHtml(html, baseUrl)
+ self.setEnabled(True)
+ else:
+ super(WebView, self).setHtml(html, baseUrl)
+
class WebBrowser(QWidget):
"""
diff --git a/spyder/widgets/ipythonconsole/client.py b/spyder/widgets/ipythonconsole/client.py
index 229f428..fbedfcb 100644
--- a/spyder/widgets/ipythonconsole/client.py
+++ b/spyder/widgets/ipythonconsole/client.py
@@ -82,7 +82,8 @@ class ClientWidget(QWidget, SaveHistoryMixin):
def __init__(self, plugin, name, history_filename, config_options,
additional_options, interpreter_versions,
connection_file=None, hostname=None,
- menu_actions=None, slave=False):
+ menu_actions=None, slave=False,
+ external_kernel=False):
super(ClientWidget, self).__init__(plugin)
SaveHistoryMixin.__init__(self)
@@ -104,6 +105,7 @@ class ClientWidget(QWidget, SaveHistoryMixin):
self.shellwidget = ShellWidget(config=config_options,
additional_options=additional_options,
interpreter_versions=interpreter_versions,
+ external_kernel=external_kernel,
local_kernel=True)
self.shellwidget.hide()
self.infowidget = WebView(self)
diff --git a/spyder/widgets/ipythonconsole/control.py b/spyder/widgets/ipythonconsole/control.py
index 64fbcb1..77f4e19 100644
--- a/spyder/widgets/ipythonconsole/control.py
+++ b/spyder/widgets/ipythonconsole/control.py
@@ -55,7 +55,7 @@ class ControlWidget(TracebackLinksMixin, GetHelpMixin, QTextEdit,
"""Reimplement Qt Method - Basic keypress event handler"""
event, text, key, ctrl, shift = restore_keyevent(event)
if key == Qt.Key_ParenLeft and not self.has_selected_text() \
- and self.help_enabled:
+ and self.help_enabled and not self.parent()._reading:
self._key_paren_left(text)
else:
# Let the parent widget handle the key press event
diff --git a/spyder/widgets/ipythonconsole/debugging.py b/spyder/widgets/ipythonconsole/debugging.py
index 36745aa..93e4417 100644
--- a/spyder/widgets/ipythonconsole/debugging.py
+++ b/spyder/widgets/ipythonconsole/debugging.py
@@ -133,7 +133,7 @@ class DebuggingWidget(RichJupyterWidget):
self._input_reply = reply
self.sig_input_reply.emit()
else:
- self._input_reply = reply
+ self._input_reply = None
self.sig_input_reply.emit()
else:
self._input_reply = None
diff --git a/spyder/widgets/ipythonconsole/namespacebrowser.py b/spyder/widgets/ipythonconsole/namespacebrowser.py
index d8e3607..b155585 100644
--- a/spyder/widgets/ipythonconsole/namespacebrowser.py
+++ b/spyder/widgets/ipythonconsole/namespacebrowser.py
@@ -203,7 +203,8 @@ class NamepaceBrowserWidget(RichJupyterWidget):
self._kernel_is_starting = True
elif state == 'idle' and msg_type == 'shutdown_request':
# This handles restarts asked by the user
- self.set_namespace_view_settings()
- self.refresh_namespacebrowser()
+ if self.namespacebrowser is not None:
+ self.set_namespace_view_settings()
+ self.refresh_namespacebrowser()
else:
super(NamepaceBrowserWidget, self)._handle_status(msg)
diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py
index 44d7eda..f7271cc 100644
--- a/spyder/widgets/ipythonconsole/shell.py
+++ b/spyder/widgets/ipythonconsole/shell.py
@@ -47,7 +47,8 @@ class ShellWidget(NamepaceBrowserWidget, HelpWidget, DebuggingWidget):
new_client = Signal()
sig_got_reply = Signal()
- def __init__(self, additional_options, interpreter_versions, *args, **kw):
+ def __init__(self, additional_options, interpreter_versions,
+ external_kernel, *args, **kw):
# To override the Qt widget used by RichJupyterWidget
self.custom_control = ControlWidget
self.custom_page_control = PageControlWidget
@@ -57,10 +58,11 @@ class ShellWidget(NamepaceBrowserWidget, HelpWidget, DebuggingWidget):
self.set_background_color()
- # --- Spyder variables ---
+ # Additional variables
self.ipyclient = None
+ self.external_kernel = external_kernel
- # --- Keyboard shortcuts ---
+ # Keyboard shortcuts
self.shortcuts = self.create_shortcuts()
# To save kernel replies in silent execution
@@ -245,6 +247,9 @@ These commands were executed:
Reimplement banner creation to let the user decide if he wants a
banner or not
"""
+ # Don't change banner for external kernels
+ if self.external_kernel:
+ return ''
show_banner_o = self.additional_options['show_banner']
if show_banner_o:
return self.long_banner()
diff --git a/spyder/widgets/variableexplorer/collectionseditor.py b/spyder/widgets/variableexplorer/collectionseditor.py
index 0921257..913ad2e 100644
--- a/spyder/widgets/variableexplorer/collectionseditor.py
+++ b/spyder/widgets/variableexplorer/collectionseditor.py
@@ -79,13 +79,12 @@ class ReadOnlyCollectionsModel(QAbstractTableModel):
"""CollectionsEditor Read-Only Table Model"""
ROWS_TO_LOAD = 50
- def __init__(self, parent, data, title="", names=False, truncate=True,
+ def __init__(self, parent, data, title="", names=False,
minmax=False, remote=False):
QAbstractTableModel.__init__(self, parent)
if data is None:
data = {}
self.names = names
- self.truncate = truncate
self.minmax = minmax
self.remote = remote
self.header0 = None
@@ -281,9 +280,7 @@ class ReadOnlyCollectionsModel(QAbstractTableModel):
if index.column() == 3 and self.remote:
value = value['view']
if index.column() == 3:
- display = value_to_display(value,
- truncate=index.column() == 3 and self.truncate,
- minmax=self.minmax)
+ display = value_to_display(value, minmax=self.minmax)
else:
display = to_text_string(value)
if role == Qt.DisplayRole:
@@ -617,7 +614,6 @@ class BaseTableView(QTableView):
self.save_array_action = None
self.insert_action = None
self.remove_action = None
- self.truncate_action = None
self.minmax_action = None
self.rename_action = None
self.duplicate_action = None
@@ -632,10 +628,9 @@ class BaseTableView(QTableView):
self.setSortingEnabled(True)
self.sortByColumn(0, Qt.AscendingOrder)
- def setup_menu(self, truncate, minmax):
+ def setup_menu(self, minmax):
"""Setup context menu"""
- if self.truncate_action is not None:
- self.truncate_action.setChecked(truncate)
+ if self.minmax_action is not None:
self.minmax_action.setChecked(minmax)
return
@@ -672,10 +667,6 @@ class BaseTableView(QTableView):
self.remove_action = create_action(self, _("Remove"),
icon=ima.icon('editdelete'),
triggered=self.remove_item)
- self.truncate_action = create_action(self, _("Truncate values"),
- toggled=self.toggle_truncate)
- self.truncate_action.setChecked(truncate)
- self.toggle_truncate(truncate)
self.minmax_action = create_action(self, _("Show arrays min/max"),
toggled=self.toggle_minmax)
self.minmax_action.setChecked(minmax)
@@ -692,7 +683,7 @@ class BaseTableView(QTableView):
self.insert_action, self.remove_action,
self.copy_action, self.paste_action,
None, self.rename_action, self.duplicate_action,
- None, resize_action, None, self.truncate_action]
+ None, resize_action]
if ndarray is not FakeObject:
menu_actions.append(self.minmax_action)
add_actions(menu, menu_actions)
@@ -872,12 +863,6 @@ class BaseTableView(QTableView):
event.ignore()
@Slot(bool)
- def toggle_truncate(self, state):
- """Toggle display truncating option"""
- self.sig_option_changed.emit('truncate', state)
- self.model.truncate = state
-
- @Slot(bool)
def toggle_minmax(self, state):
"""Toggle min/max display for numpy arrays"""
self.sig_option_changed.emit('minmax', state)
@@ -1110,20 +1095,20 @@ class BaseTableView(QTableView):
class CollectionsEditorTableView(BaseTableView):
"""CollectionsEditor table view"""
def __init__(self, parent, data, readonly=False, title="",
- names=False, truncate=True, minmax=False):
+ names=False, minmax=False):
BaseTableView.__init__(self, parent)
self.dictfilter = None
self.readonly = readonly or isinstance(data, tuple)
CollectionsModelClass = ReadOnlyCollectionsModel if self.readonly \
else CollectionsModel
self.model = CollectionsModelClass(self, data, title, names=names,
- truncate=truncate, minmax=minmax)
+ minmax=minmax)
self.setModel(self.model)
self.delegate = CollectionsDelegate(self)
self.setItemDelegate(self.delegate)
self.setup_table()
- self.menu = self.setup_menu(truncate, minmax)
+ self.menu = self.setup_menu(minmax)
#------ Remote/local API ---------------------------------------------------
def remove_values(self, keys):
@@ -1340,7 +1325,7 @@ class RemoteCollectionsDelegate(CollectionsDelegate):
class RemoteCollectionsEditorTableView(BaseTableView):
"""DictEditor table view"""
- def __init__(self, parent, data, truncate=True, minmax=False,
+ def __init__(self, parent, data, minmax=False,
get_value_func=None, set_value_func=None,
new_value_func=None, remove_values_func=None,
copy_value_func=None, is_list_func=None, get_len_func=None,
@@ -1376,7 +1361,7 @@ class RemoteCollectionsEditorTableView(BaseTableView):
self.delegate = None
self.readonly = False
self.model = CollectionsModel(self, data, names=True,
- truncate=truncate, minmax=minmax,
+ minmax=minmax,
remote=True)
self.setModel(self.model)
self.delegate = RemoteCollectionsDelegate(self, get_value_func,
@@ -1384,11 +1369,11 @@ class RemoteCollectionsEditorTableView(BaseTableView):
self.setItemDelegate(self.delegate)
self.setup_table()
- self.menu = self.setup_menu(truncate, minmax)
+ self.menu = self.setup_menu(minmax)
- def setup_menu(self, truncate, minmax):
+ def setup_menu(self, minmax):
"""Setup context menu"""
- menu = BaseTableView.setup_menu(self, truncate, minmax)
+ menu = BaseTableView.setup_menu(self, minmax)
return menu
def oedit_possible(self, key):
@@ -1464,7 +1449,9 @@ def get_test_data():
'bool_scalar': np.bool(8),
'unsupported1': np.arccos,
'unsupported2': np.cast,
- #1: (1, 2, 3), -5: ("a", "b", "c"), 2.5: np.array((4.0, 6.0, 8.0)),
+ # Test for Issue #3518
+ 'big_struct_array': np.zeros(1000, dtype=[('ID', 'f8'),
+ ('param1', 'f8', 5000)]),
}
@@ -1477,13 +1464,10 @@ def editor_test():
dialog.setup(get_test_data())
dialog.show()
app.exec_()
- print("out:", dialog.get_value())
def remote_editor_test():
"""Remote collections editor test"""
- from pprint import pprint
-
from spyder.utils.qthelpers import qapplication
app = qapplication()
@@ -1491,14 +1475,9 @@ def remote_editor_test():
from spyder.widgets.variableexplorer.utils import make_remote_view
remote = make_remote_view(get_test_data(), VariableExplorer.get_settings())
- pprint(remote)
dialog = CollectionsEditor()
dialog.setup(remote, remote=True)
dialog.show()
-
- if dialog.result():
- print(dialog.get_value())
-
app.exec_()
diff --git a/spyder/widgets/variableexplorer/namespacebrowser.py b/spyder/widgets/variableexplorer/namespacebrowser.py
index 3f86fb6..157a823 100644
--- a/spyder/widgets/variableexplorer/namespacebrowser.py
+++ b/spyder/widgets/variableexplorer/namespacebrowser.py
@@ -79,7 +79,6 @@ class NamespaceBrowser(QWidget):
self.exclude_capitalized = None
self.exclude_unsupported = None
self.excluded_names = None
- self.truncate = None
self.minmax = None
self.remote_editing = None
self.autorefresh = None
@@ -99,7 +98,7 @@ class NamespaceBrowser(QWidget):
def setup(self, check_all=None, exclude_private=None,
exclude_uppercase=None, exclude_capitalized=None,
exclude_unsupported=None, excluded_names=None,
- truncate=None, minmax=None, remote_editing=None,
+ minmax=None, remote_editing=None,
autorefresh=None):
"""Setup the namespace browser"""
assert self.shellwidget is not None
@@ -110,13 +109,12 @@ class NamespaceBrowser(QWidget):
self.exclude_capitalized = exclude_capitalized
self.exclude_unsupported = exclude_unsupported
self.excluded_names = excluded_names
- self.truncate = truncate
self.minmax = minmax
self.remote_editing = remote_editing
self.autorefresh = autorefresh
if self.editor is not None:
- self.editor.setup_menu(truncate, minmax)
+ self.editor.setup_menu(minmax)
self.exclude_private_action.setChecked(exclude_private)
self.exclude_uppercase_action.setChecked(exclude_uppercase)
self.exclude_capitalized_action.setChecked(exclude_capitalized)
@@ -127,7 +125,7 @@ class NamespaceBrowser(QWidget):
return
self.editor = RemoteCollectionsEditorTableView(self, None,
- truncate=truncate, minmax=minmax,
+ minmax=minmax,
remote_editing=remote_editing,
get_value_func=self.get_value,
set_value_func=self.set_value,
@@ -166,8 +164,7 @@ class NamespaceBrowser(QWidget):
editor = self.editor
actions = [self.exclude_private_action, self.exclude_uppercase_action,
self.exclude_capitalized_action,
- self.exclude_unsupported_action, None,
- editor.truncate_action]
+ self.exclude_unsupported_action, None]
if is_module_installed('numpy'):
actions.append(editor.minmax_action)
add_actions(menu, actions)
diff --git a/spyder/widgets/variableexplorer/utils.py b/spyder/widgets/variableexplorer/utils.py
index 88682e7..5be8c65 100644
--- a/spyder/widgets/variableexplorer/utils.py
+++ b/spyder/widgets/variableexplorer/utils.py
@@ -50,9 +50,10 @@ try:
from numpy import ndarray, array, matrix, recarray
from numpy.ma import MaskedArray
from numpy import savetxt as np_savetxt
+ from numpy import set_printoptions as np_set_printoptions
except ImportError:
- ndarray = array = matrix = recarray = MaskedArray = np_savetxt = FakeObject # analysis:ignore
-
+ ndarray = array = matrix = recarray = MaskedArray = np_savetxt = \
+ np_set_printoptions = FakeObject
def get_numpy_dtype(obj):
"""Return NumPy data type associated to obj
@@ -136,7 +137,7 @@ def get_size(item):
#==============================================================================
# Set limits for the amount of elements in the repr of collections (lists,
-# dicts, tuples and sets)
+# dicts, tuples and sets) and Numpy arrays
#==============================================================================
CollectionsRepr = reprlib.Repr()
CollectionsRepr.maxlist = 10
@@ -144,6 +145,9 @@ CollectionsRepr.maxdict = 10
CollectionsRepr.maxtuple = 10
CollectionsRepr.maxset = 10
+if np_set_printoptions is not FakeObject:
+ np_set_printoptions(threshold=10)
+
#==============================================================================
# Date and datetime objects support
@@ -237,7 +241,7 @@ def unsorted_unique(lista):
#==============================================================================
# Display <--> Value
#==============================================================================
-def value_to_display(value, truncate=False, trunc_len=80, minmax=False):
+def value_to_display(value, minmax=False):
"""Convert value for display purpose"""
try:
if isinstance(value, recarray):
@@ -253,8 +257,6 @@ def value_to_display(value, truncate=False, trunc_len=80, minmax=False):
display = repr(value)
else:
display = repr(value)
- elif isinstance(value, ndarray):
- display = repr(value)
elif isinstance(value, (list, tuple, dict, set)):
display = CollectionsRepr.repr(value)
elif isinstance(value, Image):
@@ -294,12 +296,15 @@ def value_to_display(value, truncate=False, trunc_len=80, minmax=False):
# display = repr(value)
type_str = to_text_string(type(value))
display = type_str[1:-1]
- if truncate and len(display) > trunc_len:
- display = display[:trunc_len].rstrip() + ' ...'
except:
type_str = to_text_string(type(value))
display = type_str[1:-1]
+ # Truncate display at 80 chars to avoid freezing Spyder
+ # because of large displays
+ if len(display) > 80:
+ display = display[:80].rstrip() + ' ...'
+
return display
@@ -439,8 +444,8 @@ def globalsfilter(input_dict, check_all=False, filters=None,
#==============================================================================
REMOTE_SETTINGS = ('check_all', 'exclude_private', 'exclude_uppercase',
'exclude_capitalized', 'exclude_unsupported',
- 'excluded_names', 'truncate', 'minmax',
- 'remote_editing', 'autorefresh')
+ 'excluded_names', 'minmax', 'remote_editing',
+ 'autorefresh')
def get_remote_data(data, settings, mode, more_excluded_names=None):
@@ -475,8 +480,7 @@ def make_remote_view(data, settings, more_excluded_names=None):
more_excluded_names=more_excluded_names)
remote = {}
for key, value in list(data.items()):
- view = value_to_display(value, truncate=settings['truncate'],
- minmax=settings['minmax'])
+ view = value_to_display(value, minmax=settings['minmax'])
remote[key] = {'type': get_human_readable_type(value),
'size': get_size(value),
'color': get_color_name(value),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/spyder.git
More information about the debian-science-commits
mailing list