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 highlighting colors in the IPython Console match those used in the Spyder Editor #4813

Merged

Conversation

jnsebgosselin
Copy link
Member

@jnsebgosselin jnsebgosselin commented Jul 25, 2017

Fixes #4806


  • Changes in style.py is to let the text highlighting color in the IPython console to be the same as for the Spyder main application instead of using the light gray color that was hard-coded.
  • Changes in shell.py is to set the matched-bracket highlighting color to the color defined in Spyder
    preferences instead of using the hard coded light gray color.

@ccordoba12 ccordoba12 added this to the v3.2.1 milestone Jul 25, 2017
@ccordoba12 ccordoba12 changed the base branch from master to 3.x July 25, 2017 19:29
@ccordoba12 ccordoba12 changed the base branch from 3.x to master July 25, 2017 19:30
@ccordoba12
Copy link
Member

@jnsebgosselin, thanks a lot for your quick PR!

However, this PR needs to be against 3.x since it's a bugfix and doesn't add new features. So, please move it to that branch.

For next time, I'd like to let you know that we decide which branch to use for each issue by using the Milestone tag (located to the right of every issue/PR). So I tagged issue #4806 with the 3.2.1 milestone.

@jnsebgosselin
Copy link
Member Author

@ccordoba12 ahhh I see, the Milestone tag, got it. Will check it up next time.

@ccordoba12
Copy link
Member

ccordoba12 commented Jul 25, 2017 via email

@jnsebgosselin jnsebgosselin changed the base branch from master to 3.x July 25, 2017 19:42
- text highlight now use the same color as Spyder main application
instead of using the light gray color that was hard-coded.
- `matched-bracket` highlight is now set to the color defined in Spyder
preferences instead of using the hard coded light gray color.
@rlaverde
Copy link
Member

@jnsebgosselin
Copy link
Member Author

@rlaverde hehe this is what I'm trying to do but I am not able to push the rebase to the remote. It is rejected with the following error and I'm stuck, trying to find a solution on the world wide web :) Any tips?

untitled

@rlaverde
Copy link
Member

@jnsebgosselin add -f to the push command

git push origin ipython_console_highlight_settings -f

@jnsebgosselin jnsebgosselin force-pushed the ipython_console_highlight_settings branch from 9ce45c2 to 1c59108 Compare July 25, 2017 20:00
@jnsebgosselin
Copy link
Member Author

@rlaverde Oh yeah! Many thanks

@goanpeca
Copy link
Member

@jnsebgosselin just bear in mind, that -f, will force push stuff and overwrite the repo, so use carefully :-) (when rebasing)

@ccordoba12 ccordoba12 requested a review from dalthviz July 26, 2017 01:52
@ccordoba12
Copy link
Member

@dalthviz, please review this one since you were in charge of adding colors to the IPython console.

@@ -70,6 +71,9 @@ def __init__(self, ipyclient, additional_options, interpreter_versions,
# To save kernel replies in silent execution
self._kernel_reply = None

color_scheme = kw['config']['JupyterWidget']['syntax_style']
self.set_bracket_matcher_color_scheme(color_scheme)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this two lines could be replaced by something like

self.set_bracket_matcher_color_scheme(self.syntax_style)

What do you guys think @jnsebgosselin @ccordoba12 ?

Also, please add a comment above, something like # To set the color of the matched parentheses.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right and this works. I didn't see it because it is not obvious where this is inherited.

@@ -49,7 +49,6 @@ def give_font_style(is_italic):
in_prompt_color = 'lime'
out_prompt_color = 'red'
background_color = color_scheme['background']
selection_background_color = '#ccc'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to remove this as part of this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just saw you mentioned the reason in your description :-)

@spyder-ide spyder-ide deleted a comment from dalthviz Jul 26, 2017
@@ -70,6 +71,9 @@ def __init__(self, ipyclient, additional_options, interpreter_versions,
# To save kernel replies in silent execution
self._kernel_reply = None

# To set the color of the matched parentheses
self.set_bracket_matcher_color_scheme(self.syntax_style)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to add this here? I mean, the call to set_bracket_matcher_color_scheme in set_color_scheme should be enough, shouldn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_color_scheme does not seem to be called anywhere on startup. The initial settings are actually passed to the JupytherWidget as argument in the super call and the settings are applied directly within the JupytherWidget. However, these settings do not include the matched parentheses color, since the default hard-coded value is used. That is why we have to set it separately here in the __init__ on our side.

So if we do not add this there, the setting to the matched parentheses color is applied only when there is actually a change to the color scheme after the Spyder is started and a call is made to set_bracket_matcher_color_scheme.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it.

Could you improve your comment above this line with a short summary of what you just said? Else, I'm sure me or someone else will be tempted to remove this line in the future ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is ok. I've tried to keep it as short as possible. What do you guys think?

# Set the color of the matched parentheses here since the qtconsole
# uses a hard-coded value that is not modified when the color scheme is
# set in the qtconsole constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its ok 👍 maybe you could add a reference to the issue, something like See issue 4806. Also, thank you for your help 😄, nice job!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that text is descriptive enough, thanks!

@ccordoba12
Copy link
Member

Thanks @jnsebgosselin, great work!

@ccordoba12 ccordoba12 merged commit 01d3313 into spyder-ide:3.x Jul 28, 2017
ccordoba12 added a commit that referenced this pull request Jul 28, 2017
@jnsebgosselin jnsebgosselin deleted the ipython_console_highlight_settings branch July 28, 2017 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants