-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: Modify color scheme preferences #2861
Conversation
Initial screenshots@Nodd, @SylvainCorlay, @blink1073 comments are welcome |
@@ -162,6 +162,3 @@ def set_default_color_scheme(name, replace=True): | |||
|
|||
for _name in sh.COLOR_SCHEME_NAMES: | |||
set_default_color_scheme(_name, replace=False) | |||
CUSTOM_COLOR_SCHEME_NAME = "Custom" | |||
set_color_scheme(CUSTOM_COLOR_SCHEME_NAME, sh.get_color_scheme("Spyder"), | |||
replace=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no point in having a custom scheme now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, no problem with that :-)
I love the comments on your own PR, very schizophrenic. I am +100 on this change. |
Hehe, I wanted to save some time, and I was almost sure someone had something to say in that respect, Would you mind testing it @blink1073 ? |
A couple of quick suggestions:
|
👍 |
The first thing I thought when viewing the screenshots is that the preview is really a great addition. Just the line numbers are missing. About the edition of the colors, the entries should be grouped differently, ideally with many group widgets. The minimum would be to group the text values together so that the checkboxes are not all over the place. One group for "text" and one for "background" for example. Or "text", "text highlighting" and "background". |
Look update@ccordoba12, and for @Nodd ... numbers Plus now we have instant preview, so any changes on an edited theme will reflect in the preview right away (without the need to apply the changes) |
It is looking pretty good already, but I guess the final touch would be to have the preview in the editor dialog, and have it update in every single change inside the actual dialog. What do you think? |
Here is my habitual flow of nitpicks:
having the preview in the same dialog would be nice too, but you could also put the edition widgets in the main panel next to the current preview. Maybe it's too big to be practical, I'm not sure. There is too much space between the "Preview" label and the preview widget, I'd completely remove the label since it's already quite obvious. |
self.preview_editor.setup_editor(linenumbers=True, | ||
markers=False, | ||
tab_mode=False, | ||
font=QFont("Courier New", 10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font should not be hard coded, the configured fond should be used instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
After a very quick overview of the code, it seems that all the definitions are stored in the main configuration file. Ideally each scheme should be in its own file so that it's easier to share, but I'd leave that for another PR (along with import/export) |
It's fine where it is for me. I think few people will go into the trouble of customizing themes, but most will like to see what a theme looks like instead.
I don't know about this one, but I agree with the other @Nodd suggestions. |
@Nodd, as usual thanks for being a pain in the
I do not agree, cause the idea is to have a highlight group.... independent of what it highlights
I am not sure what general mean? you mean it would be changed more often?
Sure, it make sense, I was waiting for you to give me the full order, I just grouped them together...
Sure
No no no no and no, the idea was to take away so much visual noise from the user when selecting, a theme. The casual user really just selects a default, a power user would either import one, or make one. The edition dialog is already too large to bring it back to the main menu.
👎 To do this I think we need a common use color schemes format, which probably exists and stores stuff as XML or JSON, that is the point of having the Export options, so that you can share them in any format we decide to support, that will come in another PR when those "standards" are pointed out by someone. Any preferences in Spyder is built on the CONF idea, which makes life easy, but restricts us to keep using it, so having separate files would be another layer of possible bugs... |
Look update |
I would leave out the create new button for now, and leave that for another PR, as it is just inviting confusion at the moment. Otherwise, I am 👍 for merging and iterating. |
@blink1073, I will remove the button but leave the code that does the work ok, as it is perfectly functional? |
Yep, makes sense to me. |
@blink1073 by the way did you actually test it :-p ? |
Yes, hence my comment about it being confusing :) |
@blink1073 was having some issues with the dialog being too tall, so now is a two columns layout |
Perfect, thank you, I am no longer confused. :) |
My main concern about the config file full of everything is that when there is a problem in the config we have to reset everything. I'd bet that it's not the color definitions that will cause spyder to fail, but they will be reset anyway along everything else. It's very nice on 2 columns, but actually I'd change the order again (sorry, I was on my phone before):
I agree that technically cells and current line are highlighted by the color, but when working on code it's more of a general visual help rather than an important information about what I'm doing in my code. I don't want to start a big debate, as putting them in highlight works too. |
# Checks that this is indeed a default scheme | ||
scheme = self.current_scheme | ||
names = self.get_option('names') | ||
if scheme not in names: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be if scheme in names:
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I made a mistake :-)
@ccordoba12 made the fixes, thanks for the review |
|
||
def set_scheme(self, scheme_name): | ||
""" | ||
Set the current stack in the dialog to the scheme with 'schema_name'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here: schema_name
-> scheme_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There's one little error I discovered with live testing: even though you can change a custom scheme name in the scheme editor dialog, that name is not reflected in the schemes combo box of the new preferences pages. I think it should be changed there too :-) |
@ccordoba12 fixed the issue and related comments |
@ccordoba12 merged with master.... |
I can't open our Preferences after your update. This is the traceback Traceback (most recent call last):
File "/home/carlos/Projects/spyder/github-repo/spyderlib/spyder.py", line 2614, in edit_preferences
widget.initialize()
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 70, in initialize
self.setup_page()
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 995, in setup_page
self.update_combobox()
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1030, in update_combobox
self.scheme_choices_dict[self.get_option('{0}/name'.format(n))] = n
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 49, in get_option
return CONF.get(self.CONF_SECTION, option, default)
File "/home/carlos/Projects/spyder/github-repo/spyderlib/config/user.py", line 380, in get
raise cp.NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'Custom/name' in section: 'color_schemes' |
@ccordoba12 I dont get that error, can you reset your ini ??? There used to be a Should not it be getting that change in version? Should I bump to 25 the version then? |
def setup_page(self): | ||
tabs = QTabWidget() | ||
names = self.get_option("names") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add here names.pop(names.index(u'Custom'))
I added as comments how to fix the bug I'm seeing. The problem is the old I think the best thing to do (as I did) is to remove Of course, a potential problem will occur if a user decides to name a color scheme |
@ccordoba12 thanks for the suggested fix. There is no potential problem, 'cause all the custom names are stored in a different key. |
Oh yeah! But now I'm seeing this error when trying to create a new scheme: Traceback (most recent call last):
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1081, in update_preview
scheme_name = self.current_scheme
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1016, in current_scheme
return self.scheme_choices_dict[self.current_scheme_name]
KeyError: u''
Traceback (most recent call last):
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1055, in update_buttons
current_scheme = self.current_scheme
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1016, in current_scheme
return self.scheme_choices_dict[self.current_scheme_name]
KeyError: u'' |
And this error when trying to delete it (after closing and opening Preferences again after the error mentioned above): Traceback (most recent call last):
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1158, in delete_scheme
self.set_scheme('spyder')
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1182, in set_scheme
dlg.set_scheme(scheme_name)
File "/home/carlos/Projects/spyder/github-repo/spyderlib/plugins/configdialog.py", line 1231, in set_scheme
self.stack.setCurrentIndex(self.order.index(scheme_name))
ValueError: 'spyder' is not in list |
Are this errors because of the changes you suggested? |
I don't think so. My changes only remove |
Related to #820
Description
This PR aims to simplify the user experience for editing the color schemes.
It also incorporates the creation/deletion of an unlimited number of custom schemes.
This PR however does not (yet) add the custom schemes to the options in the other plugins (editor etc...) as the idea is to unify the different color schemes into a single global one, located in this updated preferences page. This will be accomplished in a subsequent PR.
The custom name is generated automatically (
custom-N
) but are modifiable. For default schemes colors are modifiable, but the scheme name is not.Final Screenshots