-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fixing CSS for Updater VM name Labels #197
Conversation
I don't like enforcing black/white text for all labels in all widgets - I'm afraid this will cause problems with users' custom themes or some other things we have not foreseen (as in, this looks like it works right now, but I'm somewhat worried about weird interactions in the future...) In the color definitions (qubes-colors-light/dark files) we have a text-color color defined that is the color you need (black for light themes, dark for light themes) - I think it would be a bit safer to add a 'qube-box-all-colors' or something css class to the in
|
That is an excellent suggestion. I will try this in next few days and see if nothing breaks. |
I just realized that this is effectively overwriting the previous
We do not have the color label index here. But we could do something like:
|
The latter sounds like a good idea, I like it. And good catch on the cascading... ugh, css is the worst sometimes :D |
e5d406d
to
3daa2f8
Compare
OK. I made the final changes and tested them. I used qube-box-custom-label class for the custom labels as it is a little bit more definitive than qube-box-all-colors Hope this is good. |
PipelineRetryFailed |
looks great! The tests failed due to some timeouts on server side, I bumped them to run again |
I am still not very proficient with builder2 and OpenQA testing workflow. Hopefully better in future. |
Oh, this was not your fault at all - sometimes the qa server has a bad day, and clearly, it was one of those. |
Ok, I see a lot of errors due to pylint-dev/astroid#2190 (so nice to be caught in upstream issues :D) ; I'm going to restart and pray, but other than that, I see that you are importing @marmarek, this is a question for you - here what is used is the |
Definitely not, |
@marmarta |
Or list them manually, with a comment in CSS and code saying "if you are adding new colors, you need to add it here and here and here"? It's ugly, but in practice what we want is not "is the label defined", but "is the relevant css defined in this package"... |
Ok. Lets do something like if Is this good? |
I think so? I'm mildly worried that it might be sorta slow in the long run if there is a lot of labels to label? Thus the idea of just manually listing them. But this is a bit more elegant, true. |
You are right. Not only it makes it slow. But also adds complexity. I still believe on adding It will be only necessary to remember to bump this number if CSS for any new standard label is added in the feature. |
I'm ok with that |
3daa2f8
to
5975ea5
Compare
I like this, just one issue - you seem to have accidentally pushed together with this the font change, which is problematic due to "this font is not installed, oops" problem... I'm good with either changing that commit to use |
I'd rather prefer to rely on what CSS classes you have defined, not label indexes (and hardcoding it's 8 of them). As I said before, there is no guarantee those won't change. |
OK. I will work on it.
Exactly. I was actually working on it. It is related to another issue which we discussed before. I have to git reset --hard and work from there. |
OK. I have came up with this so far. It loads the CSS data from file only once. It would be very nice if can somehow obtain Gtk.CssProvider data which was loaded via
|
I can't figure out a way to get the CSS provider from a widget, yeah. If this works fast enough, it's an option that we can use here. |
5975ea5
to
1fcfe2a
Compare
I have been testing the above fix for almost a week. I believe it to be a proper fix. It uses the already in-memory Css data without reading the CSS file twice. |
Regarding Pylink warning on EffectiveCssProvider Global mutable variable within the module, I had added underscores after and before the variable. I can not use a class variable here. |
qubes_config/widgets/gtk_utils.py
Outdated
@@ -203,6 +203,7 @@ def load_theme(widget: Gtk.Widget, light_theme_path: Optional[str] = None, | |||
:param package_name: name of the package | |||
:param light_file_name: name of the css file with light theme | |||
:param dark_file_name: name of the css file with dark theme | |||
Return Value is the Effective Css Provider which could be discarded |
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.
Return Value is the Effective Css Provider which could be discarded | |
Returns used CSS provider; it can be safely discarded if unused. |
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.
Applied the suggestion
1fcfe2a
to
31c3a76
Compare
I am reading the Pylink errors. Most of it is because of the existing code. Here is what is related to this commit: https://gitlab.com/QubesOS/qubes-desktop-linux-manager/-/jobs/7257225118#L128 p.s. I can work on the rest if this is a priority |
Most of those are because pylint is confusing GTK3 and GTK4... There is a fix pending (on pylint side) but it wasn't merged yet. |
There is a minor bug in the logic. If user creates labels such as |
I think this is edgeness of an edge case that can be safely ignored for this PR. |
Is there anything else that I should do for this patch @marmarek ? It is possible to properly encapsulate the Css Provider within a class inside |
PipelineRetry |
I'm okay with leaving it a global variable, but pylint needs to not complain. That's one |
Done. I made the pylint fixes in a new commit to make it easier for review. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
=======================================
Coverage 93.54% 93.54%
=======================================
Files 57 57
Lines 10816 10833 +17
=======================================
+ Hits 10118 10134 +16
- Misses 698 699 +1 ☔ View full report in Codecov by Sentry. |
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.
looks good to me :)
Setting the default VM Name Label colors for custom labels
Reference to issue: Fixes QubesOS/qubes-issues#9236