Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Make the internal console use the same theme as the other widgets #8251

Merged
merged 12 commits into from
Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
<<: *main
environment:
- PYTHON_VERSION: "3.5"
- USE_CONDA: "yes"
- USE_CONDA: "no"
- CI_PYTEST: "true"

python2.7-modules:
Expand Down
32 changes: 0 additions & 32 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,6 @@ spyder/images/genprefs.png
spyder/images/help.png
spyder/images/italic.png
spyder/images/pythonpath_mgr.png
spyder/images/upper_lower.png
spyder/images/vcs_browse.png
spyder/images/vcs_commit.png
spyder/images/actions/1downarrow.png
Expand Down Expand Up @@ -1606,37 +1605,6 @@ spyder/images/winpython.svg
-------------------------------------------------------------------------------



OOjs UI MediaWiki lib
---------------------


Copyright (c) 2011-2018 OOUI Team and other contributors.


Authors: OOUI Team and other contributors
https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/AUTHORS.txt
Source: https://phabricator.wikimedia.org/diffusion/GVED/browse/master/lib/oojs-ui/themes/mediawiki/images/icons/
Download: https://commons.wikimedia.org/wiki/File:OOjs_UI_icon_regular-expression.svg
License: MIT (Expat) License | https://opensource.org/licenses/MIT

Modifications made: Removed parentheses, make it bigger.


Licensed under the terms of the MIT License.


See below for the full text of the MIT (Expat) License.

The current OOjs UI MediaWiki lib repo license can be viewed at:
https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/LICENSE-MIT


Files covered:

spyder/images/regexp.svg


===============================================================================


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ a Python version greater than 2.7 or 3.4 (Python <=3.3 is no longer supported).
* **Pylint**: Static code analysis.
* **Psutil**: CPU and memory usage on the status bar.
* **Nbconvert**: Manipulation of notebooks in the Editor.
* **Qtawesome** 0.4.1+: To have an icon theme based on FontAwesome.
* **Qtawesome** 0.5.0+: To have an icon theme based on FontAwesome.
* **Pickleshare**: Show import completions on the Python consoles.
* **PyZMQ**: Client for the language server protocol (LSP).
* **QtPy** 1.5.0+: Abstraction layer for Python Qt bindings so that Spyder
Expand All @@ -244,7 +244,7 @@ a Python version greater than 2.7 or 3.4 (Python <=3.3 is no longer supported).
* **Cloudpickle**: Serialize variables in the IPython kernel to send to Spyder.
* **spyder-kernels** 1.0+: Jupyter kernels for the Spyder console.
* **keyring**: Save Github credentials to report errors securely.
* **QDarkStyle**: A dark stylesheet for Qt applications, used for Spyder's dark theme.
* **QDarkStyle** 2.6.0+: A dark stylesheet for Qt applications, used for Spyder's dark theme.
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
* **pexpect**/**paramiko**: Connect to remote kernels through SSH.

### Optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nbconvert
sphinx
pylint
psutil
qtawesome>=0.4.1
qtawesome>=0.5.0
qtpy>=1.2.0
pickleshare
pyzmq
Expand All @@ -15,4 +15,4 @@ pyqt5
keyring
spyder-kernels>=1.0
python-language-server
qdarkstyle
qdarkstyle>=2.6.0
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 10 additions & 1 deletion spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2568,8 +2568,17 @@ def render_issue(self, description='', traceback=''):
def report_issue(self, body=None, title=None, open_webpage=False):
"""Report a Spyder issue to github, generating body text if needed."""
if body is None:
from spyder.plugins.console import (
MAIN_BG_COLOR, MAIN_DEFAULT_FG_COLOR, MAIN_ERROR_FG_COLOR,
MAIN_TB_FG_COLOR, MAIN_PROMPT_FG_COLOR)
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
from spyder.widgets.reporterror import SpyderErrorDialog
report_dlg = SpyderErrorDialog(self, is_report=True)
report_dlg = SpyderErrorDialog(
self, is_report=True,
default_foreground_color=MAIN_DEFAULT_FG_COLOR,
error_foreground_color=MAIN_ERROR_FG_COLOR,
traceback_foreground_color=MAIN_TB_FG_COLOR,
prompt_foreground_color=MAIN_PROMPT_FG_COLOR,
background_color=MAIN_BG_COLOR)
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
report_dlg.show()
else:
if open_webpage:
Expand Down
61 changes: 0 additions & 61 deletions spyder/images/regexp.svg

This file was deleted.

Binary file removed spyder/images/upper_lower.png
Binary file not shown.
40 changes: 33 additions & 7 deletions spyder/plugins/console/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
from qtpy.compat import getopenfilename
from qtpy.QtCore import Qt, Signal, Slot
from qtpy.QtWidgets import QInputDialog, QLineEdit, QMenu, QHBoxLayout
from qtpy.QtGui import QColor

# Local imports
from spyder.config.base import _, DEV, get_debug_level
from spyder.config.gui import is_dark_interface
from spyder.config.main import CONF
from spyder.utils import icon_manager as ima
from spyder.utils.environ import EnvDialog
Expand All @@ -43,6 +45,20 @@
logger = logging.getLogger(__name__)


if is_dark_interface():
MAIN_BG_COLOR = '#232629'
MAIN_DEFAULT_FG_COLOR = '#ffffff'
MAIN_ERROR_FG_COLOR = '#FF0000'
MAIN_TB_FG_COLOR = '#0000FF'
MAIN_PROMPT_FG_COLOR = '#00AA00'
else:
MAIN_BG_COLOR = 'white'
MAIN_DEFAULT_FG_COLOR = '#000000'
MAIN_ERROR_FG_COLOR = '#FF0000'
MAIN_TB_FG_COLOR = '#0000FF'
MAIN_PROMPT_FG_COLOR = '#00AA00'


class Console(SpyderPluginWidget):
"""
Console widget
Expand All @@ -60,12 +76,16 @@ def __init__(self, parent=None, namespace=None, commands=[], message=None,
self.dialog_manager = DialogManager()

# Shell
light_background = self.get_option('light_background')
self.shell = InternalShell(parent, namespace, commands, message,
self.get_option('max_line_count'),
self.get_plugin_font(), exitfunc, profile,
multithreaded,
light_background=light_background)
self.shell = InternalShell(
parent, namespace, commands, message,
self.get_option('max_line_count'),
self.get_plugin_font(), exitfunc, profile,
multithreaded,
default_foreground_color=MAIN_DEFAULT_FG_COLOR,
error_foreground_color=MAIN_ERROR_FG_COLOR,
traceback_foreground_color=MAIN_TB_FG_COLOR,
prompt_foreground_color=MAIN_PROMPT_FG_COLOR,
background_color=MAIN_BG_COLOR)
self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0))
self.shell.go_to_error.connect(self.go_to_error)
self.shell.focus_changed.connect(lambda: self.focus_changed.emit())
Expand Down Expand Up @@ -219,7 +239,13 @@ def exception_occurred(self, text, is_traceback):

if CONF.get('main', 'show_internal_errors'):
if self.error_dlg is None:
self.error_dlg = SpyderErrorDialog(self)
self.error_dlg = SpyderErrorDialog(
self,
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
default_foreground_color=MAIN_DEFAULT_FG_COLOR,
error_foreground_color=MAIN_ERROR_FG_COLOR,
traceback_foreground_color=MAIN_TB_FG_COLOR,
prompt_foreground_color=MAIN_PROMPT_FG_COLOR,
background_color=MAIN_BG_COLOR)
self.error_dlg.close_btn.clicked.connect(self.close_error_dlg)
self.error_dlg.rejected.connect(self.remove_error_dlg)
self.error_dlg.details.go_to_error.connect(self.go_to_error)
Expand Down
18 changes: 13 additions & 5 deletions spyder/plugins/console/widgets/internalshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,20 @@ class InternalShell(PythonShellWidget):

def __init__(self, parent=None, namespace=None, commands=[], message=None,
max_line_count=300, font=None, exitfunc=None, profile=False,
multithreaded=True, light_background=True):
PythonShellWidget.__init__(self, parent,
get_conf_path('history_internal.py'),
profile)
multithreaded=True, default_foreground_color=None,
error_foreground_color=None, traceback_foreground_color=None,
prompt_foreground_color=None, background_color=None):
PythonShellWidget.__init__(
self, parent,
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
get_conf_path('history_internal.py'),
profile=profile,
default_foreground_color=default_foreground_color,
error_foreground_color=error_foreground_color,
traceback_foreground_color=traceback_foreground_color,
prompt_foreground_color=prompt_foreground_color,
background_color=background_color)

self.set_light_background(light_background)
self.set_color_scheme(default_foreground_color, background_color)
self.multithreaded = multithreaded
self.setMaximumBlockCount(max_line_count)

Expand Down
27 changes: 22 additions & 5 deletions spyder/plugins/console/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,19 @@ class ShellBaseWidget(ConsoleBaseWidget, SaveHistoryMixin,
append_to_history = Signal(str, str)

def __init__(self, parent, history_filename, profile=False,
initial_message=None):
initial_message=None, default_foreground_color=None,
error_foreground_color=None, traceback_foreground_color=None,
prompt_foreground_color=None, background_color=None):
"""
parent : specifies the parent widget
"""
ConsoleBaseWidget.__init__(self, parent)
ConsoleBaseWidget.__init__(
self, parent,
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
default_foreground_color=default_foreground_color,
error_foreground_color=error_foreground_color,
traceback_foreground_color=traceback_foreground_color,
prompt_foreground_color=prompt_foreground_color,
background_color=background_color)
SaveHistoryMixin.__init__(self, history_filename)
BrowseHistoryMixin.__init__(self)

Expand Down Expand Up @@ -631,9 +639,18 @@ class PythonShellWidget(TracebackLinksMixin, ShellBaseWidget,
SEPARATOR = '%s##---(%s)---' % (os.linesep*2, time.ctime())
go_to_error = Signal(str)

def __init__(self, parent, history_filename, profile=False, initial_message=None):
ShellBaseWidget.__init__(self, parent, history_filename, profile,
initial_message)
def __init__(self, parent, history_filename, profile=False,
initial_message=None, default_foreground_color=None,
error_foreground_color=None, traceback_foreground_color=None,
prompt_foreground_color=None, background_color=None):
ShellBaseWidget.__init__(
self, parent, history_filename, profile=profile,
ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
initial_message=initial_message,
default_foreground_color=default_foreground_color,
error_foreground_color=error_foreground_color,
traceback_foreground_color=traceback_foreground_color,
prompt_foreground_color=prompt_foreground_color,
background_color=background_color)
TracebackLinksMixin.__init__(self)
GetHelpMixin.__init__(self)

Expand Down
Loading