-
Notifications
You must be signed in to change notification settings - Fork 197
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
Style elements in stylesheet do not get applied #334
Comments
The feature probably doesn't work with a local style. You're welcome to submit a pull request to fix it. |
Well, okay ... but could you clarify when one should using
If that's wrong, it should probably be changed. I also don't understand what the difference is between the two specifications in the config in the first place. |
@dalthviz, could you provide a little help here? |
So I have done some digging, and I admit to still being thoroughly turned around regarding where/what object/what initialization all of this is going on in, but think I've discovered at least one thing that looks inconsistent, but also something really weird. In qtconsoleapp.py, in the There is a discrepancy with how (a) and (b) are handled, because toward the end of the function, the file path in (a) actually gets opened and read, with the resulting string going into a variable I thought at first that might be why it dies when I try to use I also noted that perhaps it would fix the missing syntax highlighting (even for option (a)) if I think this may be above my level of familiarity, because at this point I'm completely stumped. |
@Jeitan sorry for the delay to respond. After reviewing this, as far as I can tell, the |
@dalthviz Thanks for the explanation! I perused the PRs you mentioned, and now I can kind of see how things ended up. If I have some free time at some point I might try to see if I can get some sort of local style input working ... maybe by looking at what Spyder does. |
@daegontaven awesome! As far as I remember what I did in that PR was to create some methods to set the |
Some of that was a bit hard to follow for me (sorry), but I'm all for that last sentence! At some point in the past I looked into a pygments plugin (since I'm not admin and can't modify the pygments/styles directory), but I got pretty confused pretty quickly since I've never had the need to use setuptools. I'm not a programmer, merely a scientist who programs :P. So having a stylesheet-type input would be lovely! |
@dalthviz My use case is specifically to set syntax style from jupyter_widget = RichJupyterWidget()
jupyter_widget.style_sheet = get_theme_contents(
"dracula",
"jupyter.css"
) # Custom method that grabs a stylesheet css file
jupyter_widget.syntax_style = "dracula" The above works in so far as I register a pygments plugin in advance. It does not work if i try to set a pygments qtconsole/qtconsole/jupyter_widget.py Lines 90 to 95 in b2fa483
There is no way to set it from |
@daegontaven you are right, reviewing more in deep what we did for Spyder, we reimplemented the method |
(Trying to confirm my understanding) We can not use local CSS files with qtconsole? Would it work if I upload the file to an HTTP server and use |
Right now it doesn't work locally nor via web. |
I am trying to apply a custom style to Jupyter QtConsole, and am finding that I can influence the style using one of Pygments' builtin styles(
jupyter qtconsole --style=native
), and I can influence the Qt and prompts (.in-prompt, etc.) using a stylesheet, but I cannot influence the syntax style using a stylesheet. In particular, I have a file I obtained by doingpygmentize -S native -f html > native.css
, but then when I tryjupyter qtconsole --stylesheet=native.css
, nothing happens to the style. It also appears to not work when specified inc.JupyterQtConsoleApp.stylesheet
in the config file (the Qt parts change, but the style parts don't). When I put it intoc.JupyterWidget.style_sheet
in the config, it actually makes qtconsole crash. I can't tell from the documentation why this doesn't work ... the config notes near the latter seem to indicate that all should be just fine.I am trying to use some custom styles I like, and I must do it by config or by command line - I have no control over the installation so I cannot put a new style into Pygments' folder in site-packages.
The systems I actually work on are all offline, but it also appears not to work in the developer version I'm testing with from the most recent code, it says 4.5.0.dev0. Python 3.7.3, pyqt 5.9.2.
The text was updated successfully, but these errors were encountered: