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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Information Widget: code clean up and slight facelift #2119
Conversation
* For OneSong, lyrics and bookmarks are optional * Start cleaning up and extracting common code in advance of proper modularisation * Use more modern features where available (`defaultdict`, comprehensions, `if` expressions) to shorten code * Lose the bold and underline, go for a lighter approach in keeping with other UIs / web * Italicise tracks / album names where relevant, to indicate these are (chosen) names not values. * Add `comments` (Fixes #1558) `website` (mainly for Soundcloud) into a new section. * Use regular table layout more for neatness * More is possible / changeable, this is just to make sure people are happyish 馃槃
|
||
|
||
def get_colors(widget): | ||
context = widget.get_style_context() |
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 needs save()/set_state()/restore(): https://github.com/quodlibet/quodlibet/blob/master/quodlibet/quodlibet/ext/events/waveformseekbar.py#L232
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.
Oh, I saw that code originally... applied a few inlinings (assuming referential transparency etc, I guess) and it seemed redundant. Seemed to work without it, so I left the simplified version.
Guess it does something magic on state saving?
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.
Yeah, it's not obvious and only a problem since gtk 3.20+. The problem is that the getters invalidate things for gtk and when called from the wrong code path you get in an invalidation loop. (new-state -> update css/drawing -> new-state ...). The save/restore part prevents gtk from noticing.
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.
Madness! Thanks
|
||
def get_colors(widget): | ||
context = widget.get_style_context() | ||
bg_color = context.get_background_color(Gtk.StateFlags.NORMAL) |
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.
get_background_color no longer works with newer gtk+ (it only returns the css solid color part, which might not be used when rendering afaik)
regarding colors and layout, maybe interesting: |
...wasn't being used anyway...
(btw: it's always a good idea to test theme specific things with the Adwaita theme (also the dark variant), check out the theme switcher plugin) |
Yep, might just ditch that colours thing. Wanted to avoid using bold (only) for the frames but increasingly I'm believing that |
* Grouped views have more People information now. * Use italics better (notably *not* when we're indicating missing tag values) * Remove use of custom colours * Extract a bit more common code out. * Tighten `Tinformation` assertions
lgtm |
Thanks |
defaultdict
, comprehensions,if
expressions) to shorten codecomments
(Fixes Add "comment" field to information window.聽#1558)website
(mainly for Soundcloud) into a new section.