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
Css pseudo states #358
Css pseudo states #358
Conversation
2cd08e4
to
9ab45b9
Compare
We want to know the state of all elements when processing CSS rules. E.g. `node:active component {}`
8668e6e
to
9776ee3
Compare
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 looks really good, I think the refactoring made this more clear which is awesome!
pyproject.toml
Outdated
@@ -35,7 +35,9 @@ classifiers = [ | |||
python = "^3.7" | |||
pycairo = "^1.18" | |||
PyGObject = "^3.30" | |||
gaphas = "^2.1" | |||
#gaphas = "^2.1" | |||
gaphas = { git = "https://github.com/gaphor/gaphas.git", branch = "master" } |
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.
I'm sure you're on top of it, but just a reminder to not forget to change this back now that you released a new version
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.
I wanted to make sure I do not need to make more changes to Gaphas before creating a new Gaphas release.
I'm not finished yet. There's still some tough nuts to crack. I moved the style lookup out of the Presentation class, since I also need to add state info (focused, selected). This information lives in the View. Styling information is used in 2 places:
The ItemWrapper (bad name) objects should have a reference to the view, since they need to look up state information for the rendered item, but possible also for its parent and children. From a conceptual point of view it makes sense to let Diagram own (or reference) a style sheet. |
* Require Gaphas 2.1.1 (master) code * Everything styling related to gaphor.core.styling. * Provide style data through update/draw contexts * Style is requested via the diagram object * Use Style type all around
Makes more sense than going via the canvas
Also defined a protocol for the style node.
Each item type should bring its own style node implementation (wrapper).
Since that's how it's defined for HTML as well.
9776ee3
to
3964dfd
Compare
Fallback styles is only needed for diagram items.
Now I can change background color based on elements in the diagram: diagram:has(classitem) { background-color: beige; }
Remove vertical-align|spacing from fallback CSS.
No need to implement this in 2 places.
Avoid name conflicts
Did not know that code was in tinycss2 as well.
d5bbce8
to
9a0fb75
Compare
9a0fb75
to
7a6889a
Compare
Sourcery Code Quality Report (beta)✅ Merging this PR will increase code quality in the affected files by 0.03 out of 10.
Here are some functions in these files that still need a tune-up:
Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! |
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Style can be defined, but style can not be changed on the view state of an item (focused, selected, etc.).
Issue Number: #284
What is the new behavior?
Style will be updated based on the view state of an item.
Does this PR introduce a breaking change?
Other information
This PR does some serious rearrangement of code:
gaphor.core.styling
(also the code previously ingaphor.diagram.style
).