Skip to content
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

Add a Style widget #219

Merged
merged 8 commits into from
Nov 18, 2015
Merged

Add a Style widget #219

merged 8 commits into from
Nov 18, 2015

Conversation

jdfreder
Copy link
Contributor

Which, when displayed, is capable of changing style attributes on the parent.

TODO

  • Use union for all trait definitions in Style??
  • Add display logic to DOMWidgetView for Style child widget
  • Test it

@jdfreder jdfreder added this to the 5.0 milestone Oct 30, 2015
@jdfreder jdfreder force-pushed the stylewidget branch 2 times, most recently from 6afb8f1 to 0086bbe Compare October 30, 2015 22:27
style: {deserialize: unpack_models},
}, WidgetModel.serializers),

setStyle: function(style, oldStyle) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to undo the styles applied by the oldStyle when a new one is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably should try to do this, but it gets tricky. I'll try doing this and ping back.

@jdfreder
Copy link
Contributor Author

Action shot:

style

@SylvainCorlay ready for review

@jdfreder
Copy link
Contributor Author

@SylvainCorlay a couple of questions:

  • Should I add a deprecation message to the horde of style traits in DOMWidget? If so, both on the Python and JS sides?
  • Do you think using the CUnicode trait in Style is the right thing to do? Or instead should I be using a Union(Unicode, Int) and Union(Unicode, Float) where possible?

I'm sure you see the design of this is a little different than we talked about. This is basically a large subset of CSS keys, all that I could find which were cross platform. I think it makes sense to do this, instead of shooting ourselves in the foot by trying to abstract CSS into simpler keys.

@jdfreder
Copy link
Contributor Author

Funny, I use bind for the controller widget, but there is no browser supporting controllers that does not support bind.

IKR, we really need to move away from Phantom. I'll make that a priority for 6.0

@@ -160,7 +160,7 @@ define([

// Trigger the displayed event of the child view.
that.displayed.then(function() {
view.trigger('displayed');
view.trigger('displayed', that);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you need to add this argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Widgets and WidgetModels don't have a notion of parent, this is as-designed. However, DOM nodes have a notion of parent and children yet DOMWidgetViews do not. By adding that, I'm adding the idea of a parent view to the DOMWidgetView. I though this made sense, because the alternative would be to make the StyleView have an invisible el which gets attached to the DOM, and then use that to get the parent. All of this is because the Style applies to the parent.

@jdfreder jdfreder changed the title WIP: Add a Style widget Add a Style widget Nov 12, 2015
@SylvainCorlay
Copy link
Member

What do you mean regarding the Union?

@jdfreder
Copy link
Contributor Author

I was wondering if, for things like .left, I should use Union(Int, Unicode) or if Any is okay.

@jdfreder
Copy link
Contributor Author

I talked to @SylvainCorlay before he left for the airport and he said it was okay to merge this.

jdfreder added a commit that referenced this pull request Nov 18, 2015
@jdfreder jdfreder merged commit 69c8670 into jupyter-widgets:master Nov 18, 2015
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 25, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants